Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix sysfs duplicate filename if multiple BERT tables exist
@ 2026-07-08  8:37 Thomas Renninger
  2026-07-08  8:37 ` [PATCH 1/3] Use correct region size for BERT region size check Thomas Renninger
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Thomas Renninger @ 2026-07-08  8:37 UTC (permalink / raw)
  To: linux-pm; +Cc: Thomas Renninger, rafael, msuchanek

Cmp with:
https://bugzilla.suse.com/show_bug.cgi?id=1270211

dmesg | grep BERT
ACPI: BERT 0x00000000DD695238 000030 (v01 AMD    AMD BERT 00000000      00000000)
ACPI: BERT 0x00000000DD6955C8 000030 (v01 AMI    AMI.BERT 00000000 AMI. 00000000)
ACPI: Reserving BERT table memory at [mem 0xdd695238-0xdd695267]
ACPI: Reserving BERT table memory at [mem 0xdd6955c8-0xdd6955f7]
sysfs: cannot create duplicate filename '/firmware/acpi/tables/data/BERT'

Thomas Renninger (3):
  Use correct region size for BERT region size check
  ACPI: Pass table_attr instead of table_header to create acpi data
    tables
  ACPI: Properly map BERT and CCEL acpi tables to their data tables

 drivers/acpi/sysfs.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

-- 
2.54.0


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

* [PATCH 1/3] Use correct region size for BERT region size check
  2026-07-08  8:37 [PATCH 0/3] Fix sysfs duplicate filename if multiple BERT tables exist Thomas Renninger
@ 2026-07-08  8:37 ` Thomas Renninger
  2026-07-08  8:37 ` [PATCH 2/3] ACPI: Pass table_attr instead of table_header to create acpi data tables Thomas Renninger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Renninger @ 2026-07-08  8:37 UTC (permalink / raw)
  To: linux-pm; +Cc: Thomas Renninger, rafael, msuchanek

Looks like only acpi_hest_generic_status was defined when
the patch was created. Use the correct one now.

Signed-off-by: Thomas Renninger <trenn@suse.de>
---
 drivers/acpi/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 908cc5c7e643..8395efbe248b 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -447,7 +447,7 @@ static int acpi_bert_data_init(void *th, struct acpi_data_attr *data_attr)
 	struct acpi_table_bert *bert = th;
 
 	if (bert->header.length < sizeof(struct acpi_table_bert) ||
-	    bert->region_length < sizeof(struct acpi_hest_generic_status)) {
+	    bert->region_length < sizeof(struct acpi_bert_region)) {
 		kfree(data_attr);
 		return -EINVAL;
 	}
-- 
2.54.0


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

* [PATCH 2/3] ACPI: Pass table_attr instead of table_header to create acpi data tables
  2026-07-08  8:37 [PATCH 0/3] Fix sysfs duplicate filename if multiple BERT tables exist Thomas Renninger
  2026-07-08  8:37 ` [PATCH 1/3] Use correct region size for BERT region size check Thomas Renninger
@ 2026-07-08  8:37 ` Thomas Renninger
  2026-07-08  8:37 ` [PATCH 3/3] ACPI: Properly map BERT and CCEL acpi tables to their " Thomas Renninger
  2026-07-09 14:08 ` [PATCH 0/3] Fix sysfs duplicate filename if multiple BERT tables exist Rafael J. Wysocki (Intel)
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Renninger @ 2026-07-08  8:37 UTC (permalink / raw)
  To: linux-pm; +Cc: Thomas Renninger, rafael, msuchanek

Data tables must match the exact table they describe.
This patch prepares things to make it possible in a follow up patch.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Reported-by: Michal Suchanek <msuchanek@suse.com>
Closes: https://bugzilla.suse.com/show_bug.cgi?id=1270211
---
 drivers/acpi/sysfs.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 8395efbe248b..16eaa0af7d0b 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -484,11 +484,18 @@ static struct acpi_data_obj {
 
 #define NUM_ACPI_DATA_OBJS ARRAY_SIZE(acpi_data_objs)
 
-static int acpi_table_data_init(struct acpi_table_header *th)
+static int acpi_table_data_init(struct acpi_table_attr *table_attr)
 {
 	struct acpi_data_attr *data_attr;
+	struct acpi_table_header *th;
+	acpi_status status;
 	int i;
 
+	status = acpi_get_table(table_attr->name, table_attr->instance,
+				&th);
+	if (ACPI_FAILURE(status))
+		return -ENODEV;
+
 	for (i = 0; i < NUM_ACPI_DATA_OBJS; i++) {
 		if (ACPI_COMPARE_NAMESEG(th->signature, acpi_data_objs[i].name)) {
 			data_attr = kzalloc_obj(*data_attr);
@@ -543,7 +550,7 @@ static int acpi_tables_sysfs_init(void)
 			return ret;
 		}
 		list_add_tail(&table_attr->node, &acpi_table_attr_list);
-		acpi_table_data_init(table_header);
+		acpi_table_data_init(table_attr);
 	}
 
 	kobject_uevent(tables_kobj, KOBJ_ADD);
-- 
2.54.0


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

* [PATCH 3/3] ACPI: Properly map BERT and CCEL acpi tables to their data tables
  2026-07-08  8:37 [PATCH 0/3] Fix sysfs duplicate filename if multiple BERT tables exist Thomas Renninger
  2026-07-08  8:37 ` [PATCH 1/3] Use correct region size for BERT region size check Thomas Renninger
  2026-07-08  8:37 ` [PATCH 2/3] ACPI: Pass table_attr instead of table_header to create acpi data tables Thomas Renninger
@ 2026-07-08  8:37 ` Thomas Renninger
  2026-07-09 14:08 ` [PATCH 0/3] Fix sysfs duplicate filename if multiple BERT tables exist Rafael J. Wysocki (Intel)
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Renninger @ 2026-07-08  8:37 UTC (permalink / raw)
  To: linux-pm; +Cc: Thomas Renninger, rafael, msuchanek

In case of multiple BERT ACPI tables one gets:
sysfs: cannot create duplicate filename '/firmware/acpi/tables/data/BERT'

This is because both:
/firmware/acpi/tables/BERT1
/firmware/acpi/tables/BERT2
are tried to be mapped to the same data table:
/firmware/acpi/tables/data/BERT

This patch fixes this problem by passing and using the same filename
for data tables.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Reported-by: Michal Suchanek <msuchanek@suse.com>
Closes: https://bugzilla.suse.com/show_bug.cgi?id=1270211
---
 drivers/acpi/sysfs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 16eaa0af7d0b..265fbdb10aeb 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -316,6 +316,7 @@ struct acpi_table_attr {
 struct acpi_data_attr {
 	struct bin_attribute attr;
 	u64	addr;
+	char filename[ACPI_NAMESEG_SIZE+ACPI_INST_SIZE];
 };
 
 static ssize_t acpi_table_show(struct file *filp, struct kobject *kobj,
@@ -453,7 +454,6 @@ static int acpi_bert_data_init(void *th, struct acpi_data_attr *data_attr)
 	}
 	data_attr->addr = bert->address;
 	data_attr->attr.size = bert->region_length;
-	data_attr->attr.attr.name = "BERT";
 
 	return sysfs_create_bin_file(tables_data_kobj, &data_attr->attr);
 }
@@ -469,7 +469,6 @@ static int acpi_ccel_data_init(void *th, struct acpi_data_attr *data_attr)
 	}
 	data_attr->addr = ccel->log_area_start_address;
 	data_attr->attr.size = ccel->log_area_minimum_length;
-	data_attr->attr.attr.name = "CCEL";
 
 	return sysfs_create_bin_file(tables_data_kobj, &data_attr->attr);
 }
@@ -504,6 +503,8 @@ static int acpi_table_data_init(struct acpi_table_attr *table_attr)
 			sysfs_attr_init(&data_attr->attr.attr);
 			data_attr->attr.read = acpi_data_show;
 			data_attr->attr.attr.mode = 0400;
+			strscpy(data_attr->filename, table_attr->filename);
+			data_attr->attr.attr.name = data_attr->filename;
 			return acpi_data_objs[i].fn(th, data_attr);
 		}
 	}
-- 
2.54.0


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

* Re: [PATCH 0/3] Fix sysfs duplicate filename if multiple BERT tables exist
  2026-07-08  8:37 [PATCH 0/3] Fix sysfs duplicate filename if multiple BERT tables exist Thomas Renninger
                   ` (2 preceding siblings ...)
  2026-07-08  8:37 ` [PATCH 3/3] ACPI: Properly map BERT and CCEL acpi tables to their " Thomas Renninger
@ 2026-07-09 14:08 ` Rafael J. Wysocki (Intel)
  3 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-07-09 14:08 UTC (permalink / raw)
  To: Thomas Renninger; +Cc: linux-pm, rafael, msuchanek

On Wed, Jul 8, 2026 at 10:38 AM Thomas Renninger <trenn@suse.de> wrote:
>
> Cmp with:
> https://bugzilla.suse.com/show_bug.cgi?id=1270211
>
> dmesg | grep BERT
> ACPI: BERT 0x00000000DD695238 000030 (v01 AMD    AMD BERT 00000000      00000000)
> ACPI: BERT 0x00000000DD6955C8 000030 (v01 AMI    AMI.BERT 00000000 AMI. 00000000)
> ACPI: Reserving BERT table memory at [mem 0xdd695238-0xdd695267]
> ACPI: Reserving BERT table memory at [mem 0xdd6955c8-0xdd6955f7]
> sysfs: cannot create duplicate filename '/firmware/acpi/tables/data/BERT'

This is a bit terse, so it took me some time to understand what it is about.

But OK.

First off, these are ACPI patches, so please send them to linux-acpi.

> Thomas Renninger (3):
>   Use correct region size for BERT region size check

This is sort of misleading because the compiled code before and after
the patch is exactly the same AFAICS.

So I would just plain say "Use struct acpi_bert_region size for BERT
region size check" in the subject and in the changelog I would say
something like "The structure representing BERT data is struct
acpi_bert_region, so its size should be used in the BERT region size
check.  Adjust the code accordingly."

>   ACPI: Pass table_attr instead of table_header to create acpi data
>     tables
>   ACPI: Properly map BERT and CCEL acpi tables to their data tables

And I would merge the other two patches because splitting them is kind
of artificial.

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

end of thread, other threads:[~2026-07-09 14:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08  8:37 [PATCH 0/3] Fix sysfs duplicate filename if multiple BERT tables exist Thomas Renninger
2026-07-08  8:37 ` [PATCH 1/3] Use correct region size for BERT region size check Thomas Renninger
2026-07-08  8:37 ` [PATCH 2/3] ACPI: Pass table_attr instead of table_header to create acpi data tables Thomas Renninger
2026-07-08  8:37 ` [PATCH 3/3] ACPI: Properly map BERT and CCEL acpi tables to their " Thomas Renninger
2026-07-09 14:08 ` [PATCH 0/3] Fix sysfs duplicate filename if multiple BERT tables exist Rafael J. Wysocki (Intel)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox