ACPI: FPDT: expose FBPT and S3PT subtables via sysfs
PATCH 1/1 ACPI: FPDT: expose FBPT and S3PT subtables via sysfs
Add sysfs attributes at /sys/firmware/acpi/fpdt/tables/FBPT and /sys/firmware/acpi/fpdt/tables/S3PT that expose the raw contents of the FPDT subtables. Note that /sys/firmware/acpi/tables/FPDT only provides the top level table, not the subtables. Adding access to the subtables enables a usage model similar to /sys/firmware/dmi/tables/DMI, allowing userspace tools to interpret newer record types (e.g. String Event Records, Microcontroller Boot Performance Data Records, etc.) defined in recent ACPI specifications[1] without requiring kernel changes.
--- drivers/acpi/acpi_fpdt.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
drivers/acpi/acpi_fpdt.c +38 -0
@@ -141,7 +141,11 @@ static const struct attribute_group boot_attr_group = { .name = "boot", }; +static BIN_ATTR(FBPT, 0444, sysfs_bin_attr_simple_read, NULL, 0); +static BIN_ATTR(S3PT, 0444, sysfs_bin_attr_simple_read, NULL, 0); +static struct kobject *fpdt_kobj; +static struct kobject *tables_kobj;#if definedCONFIG_X86 && definedCONFIG_PHYS_ADDR_T_64BIT #include <linux/processor.h>
@@ -254,9 +258,34 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type)break ; } } + +if (subtable_type ==SUBTABLE_FBPT ) { + bin_attr_FBPT.private = subtable_header; + bin_attr_FBPT.size = length; + result =sysfs_create_bin_file (tables_kobj, &bin_attr_FBPT); +if (result) + goto err; + }else if (subtable_type ==SUBTABLE_S3PT ) { + bin_attr_S3PT.private = subtable_header; + bin_attr_S3PT.size = length; + result =sysfs_create_bin_file (tables_kobj, &bin_attr_S3PT); +if (result) + goto err; + } +return 0 ; err: +if (bin_attr_FBPT.private) { +sysfs_remove_bin_file (tables_kobj, &bin_attr_FBPT); + bin_attr_FBPT.private =NULL ; + } + +if (bin_attr_S3PT.private) { +sysfs_remove_bin_file (tables_kobj, &bin_attr_S3PT); + bin_attr_S3PT.private =NULL ; + } +if (record_boot)sysfs_remove_group (fpdt_kobj, &boot_attr_group);
@@ -288,6 +317,12 @@ static int __init acpi_init_fpdt(void) goto err_nomem; } + tables_kobj =kobject_create_and_add ("tables" , fpdt_kobj); +if (!tables_kobj) { + result = -ENOMEM ; + goto err_tables; + } +while (offset < header->length) { subtable = (void *)header + offset;switch (subtable->type) {
@@ -306,6 +341,9 @@ static int __init acpi_init_fpdt(void) }return 0 ; err_subtable: +kobject_put (tables_kobj); + +err_tables:kobject_put (fpdt_kobj); err_nomem:
base-commit: 8bf22c33e7a172fbc72464f4cc484d23a6b412ba
Signature · 1 line
2.34.1
Quoted 8 lines
Add sysfs attributes at
/sys/firmware/acpi/fpdt/tables/FBPTand/sys/firmware/acpi/fpdt/tables/S3PTthat expose the raw contents of the FPDT subtables. Note that/sys/firmware/acpi/tables/FPDTonly provides the top level table, not the subtables. Adding access to the subtables enables a usage model similar to/sys/firmware/dmi/tables/DMI, allowing userspace tools to interpret newer record types (e.g. String Event Records, Microcontroller Boot Performance Data Records, etc.) defined in recent ACPI specifications[1] without requiring kernel changes.
Is the existing (for BERT) /sys/firmware/acpi/tables/data directory a more appropriate spot for these? Naming the new subdirectory "tables" seems misleading as there aren't a top-level ACPI "FBPT" or "S3PT" tables?
Once naming is resolved, needs update to Documentation/ABI/testing/sysfs-firmware-acpi for whatever names are chosed for the new files.
Code looks good.
-Tony
Quoted 9 lines
Quoted 8 lines
Add sysfs attributes at
/sys/firmware/acpi/fpdt/tables/FBPTand/sys/firmware/acpi/fpdt/tables/S3PTthat expose the raw contents of the FPDT subtables. Note that/sys/firmware/acpi/tables/FPDTonly provides the top level table, not the subtables. Adding access to the subtables enables a usage model similar to/sys/firmware/dmi/tables/DMI, allowing userspace tools to interpret newer record types (e.g. String Event Records, Microcontroller Boot Performance Data Records, etc.) defined in recent ACPI specifications[1] without requiring kernel changes.
Quoted 3 lines
Is the existing (for BERT)
/sys/firmware/acpi/tables/datadirectory a more appropriate spot for these? Naming the new subdirectory "tables" seems misleading as there aren't a top-level ACPI "FBPT" or "S3PT" tables?
I'm not experienced with the organizational semantics of sysfs. I made a best-guess when choosing /sys/firmware/acpi/fpdt/tables/FBPT. Should I do something like /sys/firmware/acpi/tables/data/fpdt/FBPT? That way the data source is explicit and there won't be name collisions with other data in the future?
Wherever the kernel maintainers think is the best place to put these new sysfs attributes I'm completely on-board with. Please let me know where in the filesystem they should go and I'll get a v2 patch implemented!
Quoted 3 lines
Once naming is resolved, needs update to Documentation/ABI/testing/sysfs-fi= rmware-acpi
for whatever names are chosed for the new files.
I will happily add that as well in a v2 patch series.
Quoted 4 lines
Code looks good.
-Tony
Thank You!
-Nate
v2 cover ACPI: FPDT: expose FBPT and S3PT subtables via sysfs
In reply to Nate DeSimoneThe ACPI Firmware Performance Data Table (FPDT) can contain two subtables:
1. Firmware Basic Boot Performance Table (FBPT)
2. S3 Performance Table (S3PT)
The existing /sys/firmware/acpi/tables/FPDT sysfs entry only exposes the top-level FPDT header, not the subtables themselves.
This series adds sysfs attributes at /sys/firmware/acpi/fpdt/FBPT and /sys/firmware/acpi/fpdt/S3PT that expose the raw contents of these subtables. This mirrors the model used by /sys/firmware/dmi/tables/DMI for DMI/SMBIOS data, and allows userspace tools to parse newer FPDT record types defined in recent ACPI specifications[1] (e.g. String Event Records, Microcontroller Boot Performance Data Records, etc.) without requiring kernel changes for each new record type.
Nate DeSimone (2):
ACPI: FPDT: expose FBPT and S3PT subtables via sysfs
Documentation: ABI: add FBPT and S3PT entries to sysfs-firmware-acpi
Documentation/ABI/testing/sysfs-firmware-acpi | 6 ++++ drivers/acpi/acpi_fpdt.c | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+)
--
2.34.1
PATCH v2 1/2 ACPI: FPDT: expose FBPT and S3PT subtables via sysfs
Add sysfs files at /sys/firmware/acpi/fpdt/FBPT and /sys/firmware/acpi/fpdt/S3PT that expose the raw contents of the FPDT subtables. Note that /sys/firmware/acpi/tables/FPDT only provides the top level table, not the subtables. Adding access to the subtables enables a usage model similar to /sys/firmware/dmi/tables/DMI, allowing userspace tools to interpret newer record types (e.g. String Event Records, Microcontroller Boot Performance Data Records, etc.) defined in recent ACPI specifications[1] without requiring kernel changes.
--- drivers/acpi/acpi_fpdt.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/acpi/acpi_fpdt.c +28 -0
@@ -141,6 +141,9 @@ static const struct attribute_group boot_attr_group = { .name = "boot", }; +static BIN_ATTR(FBPT, 0400, sysfs_bin_attr_simple_read, NULL, 0); +static BIN_ATTR(S3PT, 0400, sysfs_bin_attr_simple_read, NULL, 0); +static struct kobject *fpdt_kobj;#if definedCONFIG_X86 && definedCONFIG_PHYS_ADDR_T_64BIT
@@ -254,9 +257,34 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type)break ; } } + +if (subtable_type ==SUBTABLE_FBPT ) { + bin_attr_FBPT.private = subtable_header; + bin_attr_FBPT.size = length; + result =sysfs_create_bin_file (fpdt_kobj, &bin_attr_FBPT); +if (result) + goto err; + }else if (subtable_type ==SUBTABLE_S3PT ) { + bin_attr_S3PT.private = subtable_header; + bin_attr_S3PT.size = length; + result =sysfs_create_bin_file (fpdt_kobj, &bin_attr_S3PT); +if (result) + goto err; + } +return 0 ; err: +if (bin_attr_FBPT.private) { +sysfs_remove_bin_file (fpdt_kobj, &bin_attr_FBPT); + bin_attr_FBPT.private =NULL ; + } + +if (bin_attr_S3PT.private) { +sysfs_remove_bin_file (fpdt_kobj, &bin_attr_S3PT); + bin_attr_S3PT.private =NULL ; + } +if (record_boot)sysfs_remove_group (fpdt_kobj, &boot_attr_group);
base-commit: 8bf22c33e7a172fbc72464f4cc484d23a6b412ba
Signature · 1 line
2.34.1
Rafael J. Wysocki
maintainerQuoted 33 lines · Nate DeSimone
Add sysfs files at
/sys/firmware/acpi/fpdt/FBPTand/sys/firmware/acpi/fpdt/S3PTthat expose the raw contents of the FPDT subtables. Note that/sys/firmware/acpi/tables/FPDTonly provides the top level table, not the subtables. Adding access to the subtables enables a usage model similar to/sys/firmware/dmi/tables/DMI, allowing userspace tools to interpret newer record types (e.g. String Event Records, Microcontroller Boot Performance Data Records, etc.) defined in recent ACPI specifications[1] without requiring kernel changes.Signed-off-by Nate DeSimone <[email protected]>--- drivers/acpi/acpi_fpdt.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)drivers/acpi/acpi_fpdt.c +3
-0@@ -141,6 +141,9 @@ static const struct attribute_group boot_attr_group = { .name = "boot", }; +static BIN_ATTR(FBPT, 0400, sysfs_bin_attr_simple_read, NULL, 0); +static BIN_ATTR(S3PT, 0400, sysfs_bin_attr_simple_read, NULL, 0); +static struct kobject *fpdt_kobj;#if definedCONFIG_X86 && definedCONFIG_PHYS_ADDR_T_64BIT
drivers/acpi/acpi_fpdt.c static int fpdt_process_subtable(u64 address, u32 subtable_type) · line 266
Quoted 10 lines
drivers/acpi/acpi_fpdt.c +7
-0@@ -254,9 +257,34 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type)break ; } } + +if (subtable_type ==SUBTABLE_FBPT ) { + bin_attr_FBPT.private = subtable_header; + bin_attr_FBPT.size = length; + result =sysfs_create_bin_file (fpdt_kobj, &bin_attr_FBPT); +if (result) + goto err;
Is failing the function the right thing to do here (and below).
A failure to create the sysfs attribute is not critical I suppose, so would printing a message be sufficient?
Quoted 27 lines
drivers/acpi/acpi_fpdt.c +18
-0+ }else if (subtable_type ==SUBTABLE_S3PT ) { + bin_attr_S3PT.private = subtable_header; + bin_attr_S3PT.size = length; + result =sysfs_create_bin_file (fpdt_kobj, &bin_attr_S3PT); +if (result) + goto err; + } +return 0 ; err: +if (bin_attr_FBPT.private) { +sysfs_remove_bin_file (fpdt_kobj, &bin_attr_FBPT); + bin_attr_FBPT.private =NULL ; + } + +if (bin_attr_S3PT.private) { +sysfs_remove_bin_file (fpdt_kobj, &bin_attr_S3PT); + bin_attr_S3PT.private =NULL ; + } +if (record_boot)sysfs_remove_group (fpdt_kobj, &boot_attr_group);base-commit:
8bf22c33e7a172fbc72464f4cc484d23a6b412ba--
Quoted 19 lines · On Wed, 11 Mar 2026 14:18:13 +0100 Rafael J. Wysocki <[email protected]> wrote:
drivers/acpi/acpi_fpdt.c static int fpdt_process_subtable(u64 address, u32 su=
Quoted 8 lines · On Tue, Mar 10, 2026 at 5:35=E2=80=AFAM Nate DeSimone…
drivers/acpi/acpi_fpdt.c +3
-0+static BIN_ATTR(FBPT, 0400, sysfs_bin_attr_simple_read, NULL, 0); +static BIN_ATTR(S3PT, 0400, sysfs_bin_attr_simple_read, NULL, 0); +static struct kobject *fpdt_kobj;#if definedCONFIG_X86 && definedCONFIG_PHYS_ADDR_T_64BIT @@ -254,9 +257,34 @@ static int fpdt_process_subtable(u64 address, u32 su=
btable_type)drivers/acpi/acpi_fpdt.c static int fpdt_process_subtable(u64 address, u32 subtable_type)
Quoted 8 lines
drivers/acpi/acpi_fpdt.c +5
-0break ; } } + + if (subtable_type =3D=3D SUBTABLE_FBPT) { + bin_attr_FBPT.private =3D subtable_header; + bin_attr_FBPT.size =3D length; + result =3D sysfs_create_bin_file(fpdt_kobj, &bin_attr_FBP=
Quoted 8 lines
T);
Review static int fpdt_process_subtable(u64 address, u32 su= · line 266
Quoted 2 lines
(quoted diff) +2
-0+ if (result) + goto err;Is failing the function the right thing to do here (and below).
A failure to create the sysfs attribute is not critical I suppose, so would printing a message be sufficient?
Thank you for the feedback!
I have sent a new V3 patch series with the sysfs_create_bin_file() failure handling changed from a hard error to a non-fatal warning.
Quoted 26 lines
Review static int fpdt_process_subtable(u64 address, u32 su= · line 270
Quoted 4 lines
(quoted diff) +4
-0+ } else if (subtable_type =3D=3D SUBTABLE_S3PT) { + bin_attr_S3PT.private =3D subtable_header; + bin_attr_S3PT.size =3D length; + result =3D sysfs_create_bin_file(fpdt_kobj, &bin_attr_S3P=T);
Quoted 21 lines
drivers/acpi/acpi_fpdt.c +14
-0+if (result) + goto err; + } +return 0 ; err: +if (bin_attr_FBPT.private) { +sysfs_remove_bin_file (fpdt_kobj, &bin_attr_FBPT); + bin_attr_FBPT.private =3D NULL; + } + +if (bin_attr_S3PT.private) { +sysfs_remove_bin_file (fpdt_kobj, &bin_attr_S3PT); + bin_attr_S3PT.private =3D NULL; + } +if (record_boot)sysfs_remove_group (fpdt_kobj, &boot_attr_group);
Quoted 2 lines
Quoted 2 lines
base-commit:
8bf22c33e7a172fbc72464f4cc484d23a6b412ba--
Best Regards,
-Nate
PATCH v2 2/2 Documentation: ABI: add FBPT and S3PT entries to sysfs-firmware-acpi
In reply to Nate DeSimoneDocument the FBPT and S3PT sysfs attributes under/sys/firmware/acpi/fpdt/
--- Documentation/ABI/testing/sysfs-firmware-acpi | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/ABI/testing/sysfs-firmware-acpi +6 -0
@@ -41,6 +41,12 @@ Description: platform runtime firmware S3 resume, just prior to handoff to the OS waking vector. In nanoseconds. + FBPT: The raw binary contents of the Firmware Basic Boot + Performance Table (FBPT) subtable. + + S3PT: The raw binary contents of the S3 Performance Table + (S3PT) subtable. + What: /sys/firmware/acpi/bgrt/ Date: January 2012 Contact: Matthew Garrett <[email protected]>
Signature · 1 line
2.34.1