From patchwork Thu Feb 26 10:04:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sosnowski, Maciej" X-Patchwork-Id: 23759 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 739ADDDDF9 for ; Thu, 26 Feb 2009 21:13:15 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755520AbZBZKNI (ORCPT ); Thu, 26 Feb 2009 05:13:08 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755398AbZBZKNH (ORCPT ); Thu, 26 Feb 2009 05:13:07 -0500 Received: from mga11.intel.com ([192.55.52.93]:60479 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753870AbZBZKNF (ORCPT ); Thu, 26 Feb 2009 05:13:05 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 26 Feb 2009 02:11:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.38,270,1233561600"; d="scan'208";a="434322768" Received: from gklab-190-232.igk.intel.com (HELO linux.site) ([172.28.190.232]) by fmsmga002.fm.intel.com with ESMTP; 26 Feb 2009 02:08:53 -0800 From: Maciej Sosnowski Subject: [PATCH 1/7] I/OAT: add verification for proper APICID_TAG_MAP setting by BIOS To: dan.j.williams@intel.com Cc: snakebyte@gmx.de, shannon.nelson@intel.com, jeffrey.t.krisher@intel.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Date: Thu, 26 Feb 2009 11:04:23 +0100 Message-ID: <20090226100408.3615.48145.stgit@linux.site> In-Reply-To: <20090226100327.3615.21419.stgit@linux.site> References: <20090226100327.3615.21419.stgit@linux.site> User-Agent: StGIT/0.13 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org BIOS versions for systems with I/OAT ver.2 have been found which fail to program APICID_TAG_MAP for DCA. The ioatdma driver should recognize incorrectly set APICID_TAG_MAP and disable DCA in that case. Signed-off-by: Maciej Sosnowski Signed-off-by: Shannon Nelson Acked-by: Jeff Kirsher --- drivers/dma/ioat_dca.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/dma/ioat_dca.c b/drivers/dma/ioat_dca.c index 6cf622d..78705ca 100644 --- a/drivers/dma/ioat_dca.c +++ b/drivers/dma/ioat_dca.c @@ -49,6 +49,23 @@ #define DCA3_TAG_MAP_LITERAL_VAL 0x1 #define DCA_TAG_MAP_MASK 0xDF +/* expected tag map bytes for I/OAT ver.2 */ +#define DCA2_TAG_MAP_BYTE0 0x80 +#define DCA2_TAG_MAP_BYTE1 0x0 +#define DCA2_TAG_MAP_BYTE2 0x81 +#define DCA2_TAG_MAP_BYTE3 0x82 +#define DCA2_TAG_MAP_BYTE4 0x82 + +/* verify if tag map matches expected values */ +static inline int dca2_tag_map_valid(u8 *tag_map) +{ + return ((tag_map[0] == DCA2_TAG_MAP_BYTE0) && + (tag_map[1] == DCA2_TAG_MAP_BYTE1) && + (tag_map[2] == DCA2_TAG_MAP_BYTE2) && + (tag_map[3] == DCA2_TAG_MAP_BYTE3) && + (tag_map[4] == DCA2_TAG_MAP_BYTE4)); +} + /* * "Legacy" DCA systems do not implement the DCA register set in the * I/OAT device. Software needs direct support for their tag mappings. @@ -452,6 +469,13 @@ struct dca_provider *ioat2_dca_init(stru ioatdca->tag_map[i] = 0; } + if (!dca2_tag_map_valid(ioatdca->tag_map)) { + dev_err(&pdev->dev, "APICID_TAG_MAP set incorrectly by BIOS, " + "disabling DCA\n"); + free_dca_provider(dca); + return NULL; + } + err = register_dca_provider(dca, &pdev->dev); if (err) { free_dca_provider(dca);