From patchwork Fri Aug 26 04:13:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 1100062 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7Q4DmpL025044 for ; Fri, 26 Aug 2011 04:13:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750771Ab1HZENf (ORCPT ); Fri, 26 Aug 2011 00:13:35 -0400 Received: from mga09.intel.com ([134.134.136.24]:1690 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750704Ab1HZENe (ORCPT ); Fri, 26 Aug 2011 00:13:34 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 25 Aug 2011 21:13:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.67,351,1309762800"; d="scan'208";a="42089998" Received: from yhuang-dev.sh.intel.com (HELO [10.239.13.105]) ([10.239.13.105]) by orsmga002.jf.intel.com with ESMTP; 25 Aug 2011 21:13:27 -0700 Message-ID: <4E571D66.1070302@intel.com> Date: Fri, 26 Aug 2011 12:13:26 +0800 From: Huang Ying User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.20) Gecko/20110820 Iceowl/1.0b2 Icedove/3.1.12 MIME-Version: 1.0 To: Pavel Ivanov CC: Bjorn Helgaas , linux-kernel , "linux-acpi@vger.kernel.org" Subject: Re: APEI: Can not request iomem region for GARs References: <4E520149.3010802@intel.com> In-Reply-To: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 26 Aug 2011 04:13:48 +0000 (UTC) Hi, Pavel, Sorry, there is a minor issue in the patch. Do you have time to try the updated version attached. Best Regards, Haung Ying On 08/25/2011 10:45 AM, Pavel Ivanov wrote: > Huang, > > Applying of your patches didn't help. I'm attaching new dmesg in case > if you need it. > > > Pavel > > > On Mon, Aug 22, 2011 at 3:12 AM, Huang Ying wrote: >> Hi, Pavel, >> >> Do you have time to try the patch attached with the mail? >> acpi_nvs.patch should go first. >> >> Best Regards, >> Huang Ying >> >> Subject: [BUGFIX] ACPI, APEI, Resolve false conflict between ACPI NVS and APEI Some firmware will access memory in ACPI NVS region via APEI. That is, instructions in APEI ERST/EINJ table will read/write ACPI NVS region. The original resource conflict checking in APEI code will check memory/ioport accessed by APEI via general resource management mech. But ACPI NVS region is marked as busy already, so that the false resource conflict will prevent APEI ERST/EINJ to work. To fix this, this patch excludes ACPI NVS regions when APEI components request resources. So that they will not conflict with ACPI NVS regions. Reported-by: Pavel Ivanov Signed-off-by: Huang Ying --- drivers/acpi/apei/apei-base.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c @@ -438,8 +438,19 @@ int apei_resources_sub(struct apei_resou } EXPORT_SYMBOL_GPL(apei_resources_sub); +static int apei_get_nvs_callback(__u64 start, __u64 size, void *data) +{ + struct apei_resources *resources = data; + return apei_res_add(&resources->iomem, start, size); +} + +static int apei_get_nvs_resources(struct apei_resources *resources) +{ + return acpi_nvs_for_each_region(apei_get_nvs_callback, resources); +} + /* - * IO memory/port rersource management mechanism is used to check + * IO memory/port resource management mechanism is used to check * whether memory/port area used by GARs conflicts with normal memory * or IO memory/port of devices. */ @@ -448,12 +459,26 @@ int apei_resources_request(struct apei_r { struct apei_res *res, *res_bak = NULL; struct resource *r; + struct apei_resources nvs_resources; int rc; rc = apei_resources_sub(resources, &apei_resources_all); if (rc) return rc; + /* + * Some firmware uses ACPI NVS region, that has been marked as + * busy, so exclude it from APEI resources to avoid false + * conflict. + */ + apei_resources_init(&nvs_resources); + rc = apei_get_nvs_resources(&nvs_resources); + if (rc) + goto res_fini; + rc = apei_resources_sub(resources, &nvs_resources); + if (rc) + goto res_fini; + rc = -EINVAL; list_for_each_entry(res, &resources->iomem, list) { r = request_mem_region(res->start, res->end - res->start, @@ -500,6 +525,8 @@ err_unmap_iomem: break; release_mem_region(res->start, res->end - res->start); } +res_fini: + apei_resources_fini(&nvs_resources); return rc; } EXPORT_SYMBOL_GPL(apei_resources_request);