Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1580216 > unrolled thread

[PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area

Started by"Huang, Ying" <ying.huang@intel.com>
First post2017-02-14 03:10 +0100
Last post2017-02-20 02:00 +0100
Articles 9 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area "Huang, Ying" <ying.huang@intel.com> - 2017-02-14 03:10 +0100
    Re: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS  area "Baicar, Tyler" <tbaicar@codeaurora.org> - 2017-02-14 19:50 +0100
    Re: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-02-16 00:50 +0100
      Re: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS  area Borislav Petkov <bp@suse.de> - 2017-02-16 11:00 +0100
        Re: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area "Huang\, Ying" <ying.huang@intel.com> - 2017-02-16 11:30 +0100
          Re: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS  area Borislav Petkov <bp@suse.de> - 2017-02-16 11:50 +0100
            Re: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area "Huang\, Ying" <ying.huang@intel.com> - 2017-02-17 01:40 +0100
              Re: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS  area Borislav Petkov <bp@suse.de> - 2017-02-17 11:10 +0100
                Re: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area "Huang\, Ying" <ying.huang@intel.com> - 2017-02-20 02:00 +0100

#1580216 — [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area

From"Huang, Ying" <ying.huang@intel.com>
Date2017-02-14 03:10 +0100
Subject[PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area
Message-ID<taAJ3-3JR-1@gated-at.bofh.it>
From: Huang Ying <ying.huang@intel.com>

It was reported that some firmware will use ACPI NVS area for BERT
address range.  This will cause resources conflict because the ACPI
NVS area is marked as busy already.  Fix this via excluding ACPI NVS
area when requesting IO resources for BERT.

Reported-and-tested-by: Hans Kristian Rosbach <hansr@raskesider.no>
Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
---
 drivers/acpi/apei/bert.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/apei/bert.c b/drivers/acpi/apei/bert.c
index a05b5c0cf181..12771fcf0417 100644
--- a/drivers/acpi/apei/bert.c
+++ b/drivers/acpi/apei/bert.c
@@ -97,6 +97,7 @@ static int __init bert_check_table(struct acpi_table_bert *bert_tab)
 
 static int __init bert_init(void)
 {
+	struct apei_resources bert_resources;
 	struct acpi_bert_region *boot_error_region;
 	struct acpi_table_bert *bert_tab;
 	unsigned int region_len;
@@ -127,13 +128,14 @@ static int __init bert_init(void)
 	}
 
 	region_len = bert_tab->region_length;
-	if (!request_mem_region(bert_tab->address, region_len, "APEI BERT")) {
-		pr_err("Can't request iomem region <%016llx-%016llx>.\n",
-		       (unsigned long long)bert_tab->address,
-		       (unsigned long long)bert_tab->address + region_len - 1);
-		return -EIO;
-	}
-
+	apei_resources_init(&bert_resources);
+	rc = apei_resources_add(&bert_resources, bert_tab->address,
+				region_len, true);
+	if (rc)
+		return rc;
+	rc = apei_resources_request(&bert_resources, "APEI BERT");
+	if (rc)
+		goto out_fini;
 	boot_error_region = ioremap_cache(bert_tab->address, region_len);
 	if (boot_error_region) {
 		bert_print_all(boot_error_region, region_len);
@@ -142,7 +144,9 @@ static int __init bert_init(void)
 		rc = -ENOMEM;
 	}
 
-	release_mem_region(bert_tab->address, region_len);
+	apei_resources_release(&bert_resources);
+out_fini:
+	apei_resources_fini(&bert_resources);
 
 	return rc;
 }
-- 
2.11.0

[toc] | [next] | [standalone]


#1580756 — Re: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area

From"Baicar, Tyler" <tbaicar@codeaurora.org>
Date2017-02-14 19:50 +0100
SubjectRe: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area
Message-ID<taQkN-5op-7@gated-at.bofh.it>
In reply to#1580216
On 2/13/2017 7:01 PM, Huang, Ying wrote:
> From: Huang Ying <ying.huang@intel.com>
>
> It was reported that some firmware will use ACPI NVS area for BERT
> address range.  This will cause resources conflict because the ACPI
> NVS area is marked as busy already.  Fix this via excluding ACPI NVS
> area when requesting IO resources for BERT.
>
> Reported-and-tested-by: Hans Kristian Rosbach <hansr@raskesider.no>
> Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
Tested-by: Tyler Baicar <tbaicar@codeaurora.org>

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

[toc] | [prev] | [next] | [standalone]


#1582028

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2017-02-16 00:50 +0100
Message-ID<tbhuH-6zA-57@gated-at.bofh.it>
In reply to#1580216
On Tuesday, February 14, 2017 10:01:13 AM Huang, Ying wrote:
> From: Huang Ying <ying.huang@intel.com>
> 
> It was reported that some firmware will use ACPI NVS area for BERT
> address range.  This will cause resources conflict because the ACPI
> NVS area is marked as busy already.  Fix this via excluding ACPI NVS
> area when requesting IO resources for BERT.
> 
> Reported-and-tested-by: Hans Kristian Rosbach <hansr@raskesider.no>
> Signed-off-by: "Huang, Ying" <ying.huang@intel.com>

Boris, what do you think?

> ---
>  drivers/acpi/apei/bert.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/acpi/apei/bert.c b/drivers/acpi/apei/bert.c
> index a05b5c0cf181..12771fcf0417 100644
> --- a/drivers/acpi/apei/bert.c
> +++ b/drivers/acpi/apei/bert.c
> @@ -97,6 +97,7 @@ static int __init bert_check_table(struct acpi_table_bert *bert_tab)
>  
>  static int __init bert_init(void)
>  {
> +	struct apei_resources bert_resources;
>  	struct acpi_bert_region *boot_error_region;
>  	struct acpi_table_bert *bert_tab;
>  	unsigned int region_len;
> @@ -127,13 +128,14 @@ static int __init bert_init(void)
>  	}
>  
>  	region_len = bert_tab->region_length;
> -	if (!request_mem_region(bert_tab->address, region_len, "APEI BERT")) {
> -		pr_err("Can't request iomem region <%016llx-%016llx>.\n",
> -		       (unsigned long long)bert_tab->address,
> -		       (unsigned long long)bert_tab->address + region_len - 1);
> -		return -EIO;
> -	}
> -
> +	apei_resources_init(&bert_resources);
> +	rc = apei_resources_add(&bert_resources, bert_tab->address,
> +				region_len, true);
> +	if (rc)
> +		return rc;
> +	rc = apei_resources_request(&bert_resources, "APEI BERT");
> +	if (rc)
> +		goto out_fini;
>  	boot_error_region = ioremap_cache(bert_tab->address, region_len);
>  	if (boot_error_region) {
>  		bert_print_all(boot_error_region, region_len);
> @@ -142,7 +144,9 @@ static int __init bert_init(void)
>  		rc = -ENOMEM;
>  	}
>  
> -	release_mem_region(bert_tab->address, region_len);
> +	apei_resources_release(&bert_resources);
> +out_fini:
> +	apei_resources_fini(&bert_resources);
>  
>  	return rc;
>  }
> 

[toc] | [prev] | [next] | [standalone]


#1582425 — Re: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area

FromBorislav Petkov <bp@suse.de>
Date2017-02-16 11:00 +0100
SubjectRe: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area
Message-ID<tbr10-4os-17@gated-at.bofh.it>
In reply to#1582028
On Thu, Feb 16, 2017 at 12:42:00AM +0100, Rafael J. Wysocki wrote:
> On Tuesday, February 14, 2017 10:01:13 AM Huang, Ying wrote:
> > From: Huang Ying <ying.huang@intel.com>
> > 
> > It was reported that some firmware will use ACPI NVS area for BERT
> > address range.  This will cause resources conflict because the ACPI
> > NVS area is marked as busy already.  Fix this via excluding ACPI NVS
> > area when requesting IO resources for BERT.
> > 
> > Reported-and-tested-by: Hans Kristian Rosbach <hansr@raskesider.no>
> > Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
> 
> Boris, what do you think?

Lemme see, so the BERT is for hw errors which have happened during the
previous boot and the machine couldn't handle them. So they do get saved
in some mem in the fw for inspection during the next boot.

And "some firmware" has decided to write them into non-volatile storage
- because you should never ever forget those errors! :-)

And I don't understand the "fix" here: we're excluding the NVS area when
mapping the BERT table but then how are we supposed to read those errors
from there?

Or am I missing something obvious?

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

[toc] | [prev] | [next] | [standalone]


#1582441

From"Huang\, Ying" <ying.huang@intel.com>
Date2017-02-16 11:30 +0100
Message-ID<tbru1-4Oj-3@gated-at.bofh.it>
In reply to#1582425
Borislav Petkov <bp@suse.de> writes:

> On Thu, Feb 16, 2017 at 12:42:00AM +0100, Rafael J. Wysocki wrote:
>> On Tuesday, February 14, 2017 10:01:13 AM Huang, Ying wrote:
>> > From: Huang Ying <ying.huang@intel.com>
>> > 
>> > It was reported that some firmware will use ACPI NVS area for BERT
>> > address range.  This will cause resources conflict because the ACPI
>> > NVS area is marked as busy already.  Fix this via excluding ACPI NVS
>> > area when requesting IO resources for BERT.
>> > 
>> > Reported-and-tested-by: Hans Kristian Rosbach <hansr@raskesider.no>
>> > Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
>> 
>> Boris, what do you think?
>
> Lemme see, so the BERT is for hw errors which have happened during the
> previous boot and the machine couldn't handle them. So they do get saved
> in some mem in the fw for inspection during the next boot.
>
> And "some firmware" has decided to write them into non-volatile storage
> - because you should never ever forget those errors! :-)
>
> And I don't understand the "fix" here: we're excluding the NVS area when
> mapping the BERT table but then how are we supposed to read those errors
> from there?

The NVS area is excluded when request the resources, because the NVS
area has been marked as busy already.  But the whole BERT memory area is
mapped, so we can read from it.

> Or am I missing something obvious?

Best Regards,
Huang, Ying

[toc] | [prev] | [next] | [standalone]


#1582459 — Re: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area

FromBorislav Petkov <bp@suse.de>
Date2017-02-16 11:50 +0100
SubjectRe: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area
Message-ID<tbrNo-4YN-19@gated-at.bofh.it>
In reply to#1582441
On Thu, Feb 16, 2017 at 06:24:39PM +0800, Huang, Ying wrote:
> The NVS area is excluded when request the resources, because the NVS
> area has been marked as busy already.  But the whole BERT memory area is
> mapped, so we can read from it.

So you're saying the NVS area is part of the BERT area and we can access
the whole range?

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

[toc] | [prev] | [next] | [standalone]


#1583000

From"Huang\, Ying" <ying.huang@intel.com>
Date2017-02-17 01:40 +0100
Message-ID<tbEKC-5qy-19@gated-at.bofh.it>
In reply to#1582459
Borislav Petkov <bp@suse.de> writes:

> On Thu, Feb 16, 2017 at 06:24:39PM +0800, Huang, Ying wrote:
>> The NVS area is excluded when request the resources, because the NVS
>> area has been marked as busy already.  But the whole BERT memory area is
>> mapped, so we can read from it.
>
> So you're saying the NVS area is part of the BERT area and we can access
> the whole range?

I am not sure whether the NVS area is a part of the BERT area, but
apparently they are overlapped in some way.  We will access the whole
BERT area here via ioremap the whole range.

Best Regards,
Huang, Ying

[toc] | [prev] | [next] | [standalone]


#1583287 — Re: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area

FromBorislav Petkov <bp@suse.de>
Date2017-02-17 11:10 +0100
SubjectRe: [PATCH] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area
Message-ID<tbNEd-2WR-13@gated-at.bofh.it>
In reply to#1583000
On Fri, Feb 17, 2017 at 08:31:12AM +0800, Huang, Ying wrote:
> I am not sure whether the NVS area is a part of the BERT area, but
> apparently they are overlapped in some way.  We will access the whole
> BERT area here via ioremap the whole range.

This is the part that was missing from the commit message - explaining
*why* we need this fix.

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

[toc] | [prev] | [next] | [standalone]


#1584296

From"Huang\, Ying" <ying.huang@intel.com>
Date2017-02-20 02:00 +0100
Message-ID<tcKuC-5Yh-13@gated-at.bofh.it>
In reply to#1583287
Borislav Petkov <bp@suse.de> writes:

> On Fri, Feb 17, 2017 at 08:31:12AM +0800, Huang, Ying wrote:
>> I am not sure whether the NVS area is a part of the BERT area, but
>> apparently they are overlapped in some way.  We will access the whole
>> BERT area here via ioremap the whole range.
>
> This is the part that was missing from the commit message - explaining
> *why* we need this fix.

OK.  I will revise the patch description accordingly.

Best Regards,
Huang, Ying

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web