From patchwork Thu Dec 11 02:14:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gong X-Patchwork-Id: 5473791 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C62B09F2E8 for ; Thu, 11 Dec 2014 02:54:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CDFCE20160 for ; Thu, 11 Dec 2014 02:54:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C1A402017D for ; Thu, 11 Dec 2014 02:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933460AbaLKCyh (ORCPT ); Wed, 10 Dec 2014 21:54:37 -0500 Received: from mga11.intel.com ([192.55.52.93]:22813 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933176AbaLKCyg (ORCPT ); Wed, 10 Dec 2014 21:54:36 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 10 Dec 2014 18:54:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,555,1413270000"; d="scan'208";a="635907935" Received: from gchen-sby.bj.intel.com (HELO localhost) ([10.238.158.88]) by fmsmga001.fm.intel.com with ESMTP; 10 Dec 2014 18:54:34 -0800 From: "Chen, Gong" To: bp@alien8.de Cc: linux-acpi@vger.kernel.org, "Chen, Gong" , Tony Luck Subject: [PATCH] ACPI, EINJ: Enhance error injection tolerance level Date: Wed, 10 Dec 2014 21:14:58 -0500 Message-Id: <1418264098-27397-1-git-send-email-gong.chen@linux.intel.com> X-Mailer: git-send-email 2.1.3 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some BIOSes utilize PCI MMCFG space read/write opertion to trigger specific errors. EINJ will report errors as below when hitting such cases: APEI: Can not request [mem 0x83f990a0-0x83f990a3] for APEI EINJ Trigger registers It is because on x86 platform ACPI based PCI MMCFG logic has reserved all MMCFG spaces so that EINJ can't reserve it again. We trust EINJ trigger action won't do anything bad so just skip check on MMCFG space. Signed-off-by: Chen, Gong Signed-off-by: Tony Luck --- drivers/acpi/apei/apei-base.c | 58 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index 2cd7bdd6c8b3..e809d3c4904d 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c @@ -41,6 +41,9 @@ #include #include #include +#ifdef CONFIG_PCI_MMCONFIG +#include +#endif #include "apei-internal.h" @@ -449,7 +452,7 @@ int apei_resources_sub(struct apei_resources *resources1, } EXPORT_SYMBOL_GPL(apei_resources_sub); -static int apei_get_nvs_callback(__u64 start, __u64 size, void *data) +static int apei_get_res_callback(__u64 start, __u64 size, void *data) { struct apei_resources *resources = data; return apei_res_add(&resources->iomem, start, size); @@ -457,9 +460,42 @@ static int apei_get_nvs_callback(__u64 start, __u64 size, void *data) static int apei_get_nvs_resources(struct apei_resources *resources) { - return acpi_nvs_for_each_region(apei_get_nvs_callback, resources); + return acpi_nvs_for_each_region(apei_get_res_callback, resources); } +#ifdef CONFIG_PCI_MMCONFIG +static int pci_mmcfg_for_each_region(int (*func)(__u64 start, __u64 size, + void *data), void *data) +{ + struct pci_mmcfg_region *cfg; + int rc; + + if ((pci_probe & PCI_PROBE_MMCONF) == 0) + return 0; + + if (list_empty(&pci_mmcfg_list)) + return 0; + + list_for_each_entry(cfg, &pci_mmcfg_list, list) { + rc = func(cfg->res.start, resource_size(&cfg->res), data); + if (rc) + return rc; + } + + return 0; +} + +static int apei_get_mmcfg_resources(struct apei_resources *resources) +{ + return pci_mmcfg_for_each_region(apei_get_res_callback, resources); +} +#else +static int apei_get_mmcfg_resources(struct apei_resources *resources) +{ + return 0; +} +#endif + /* * IO memory/port resource management mechanism is used to check * whether memory/port area used by GARs conflicts with normal memory @@ -470,7 +506,7 @@ int apei_resources_request(struct apei_resources *resources, { struct apei_res *res, *res_bak = NULL; struct resource *r; - struct apei_resources nvs_resources; + struct apei_resources nvs_resources, mmcfg_res; int rc; rc = apei_resources_sub(resources, &apei_resources_all); @@ -485,10 +521,18 @@ int apei_resources_request(struct apei_resources *resources, apei_resources_init(&nvs_resources); rc = apei_get_nvs_resources(&nvs_resources); if (rc) - goto res_fini; + goto nvs_res_fini; rc = apei_resources_sub(resources, &nvs_resources); if (rc) - goto res_fini; + goto nvs_res_fini; + + apei_resources_init(&mmcfg_res); + rc = apei_get_mmcfg_resources(&mmcfg_res); + if (rc) + goto mmcfg_res_fini; + rc = apei_resources_sub(resources, &mmcfg_res); + if (rc) + goto mmcfg_res_fini; rc = -EINVAL; list_for_each_entry(res, &resources->iomem, list) { @@ -536,7 +580,9 @@ err_unmap_iomem: break; release_mem_region(res->start, res->end - res->start); } -res_fini: +mmcfg_res_fini: + apei_resources_fini(&mmcfg_res); +nvs_res_fini: apei_resources_fini(&nvs_resources); return rc; }