All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -v2] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area
@ 2017-02-20  1:12 Huang, Ying
  2017-02-20  9:44 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Huang, Ying @ 2017-02-20  1:12 UTC (permalink / raw)
  To: Rafael J . Wysocki
  Cc: Huang Ying, Len Brown, Borislav Petkov, Tomasz Nowicki,
	linux-acpi, linux-kernel

From: Huang Ying <ying.huang@intel.com>

It was reported that on some machines, there is overlap between ACPI
NVS area and BERT address range.  This appears reasonable because BERT
contents need to be non-volatile across reboot.  But this will cause
resources conflict in current Linux kernel implementation because the
ACPI NVS area is marked as busy.  The resource conflict is fixed via
excluding the ACPI NVS area when requesting IO resources for BERT.
When accessing the BERT contents, the whole BERT address range will be
ioremapped and accessed.

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -v2] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area
  2017-02-20  1:12 [PATCH -v2] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area Huang, Ying
@ 2017-02-20  9:44 ` Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2017-02-20  9:44 UTC (permalink / raw)
  To: Huang, Ying
  Cc: Rafael J . Wysocki, Len Brown, Tomasz Nowicki, linux-acpi, linux-kernel

On Mon, Feb 20, 2017 at 09:12:58AM +0800, Huang, Ying wrote:
> From: Huang Ying <ying.huang@intel.com>
> 
> It was reported that on some machines, there is overlap between ACPI
> NVS area and BERT address range.  This appears reasonable because BERT
> contents need to be non-volatile across reboot.  But this will cause
> resources conflict in current Linux kernel implementation because the
> ACPI NVS area is marked as busy.  The resource conflict is fixed via
> excluding the ACPI NVS area when requesting IO resources for BERT.
> When accessing the BERT contents, the whole BERT address range will be
> ioremapped and accessed.
> 
> 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(-)

Acked-by: Borislav Petkov <bp@suse.de>

-- 
Regards/Gruss,
    Boris.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-20  9:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-20  1:12 [PATCH -v2] ACPI, APEI: Fix BERT resources conflict with ACPI NVS area Huang, Ying
2017-02-20  9:44 ` Borislav Petkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.