Print AGESA version at bootup
Subsystems (2)
v5 cover Print AGESA version at bootup
The SMBIOS additional entries on AMD Zen4+ systems running an AGESA based BIOS contain information about the AGESA version which can be useful for matching the software stack when debugging an issue.
Add support for parsing this from SMBIOS tables and output it into the logs at bootup.
v5:
* Fix LKP and Yzen reported failure by returning ""
* Drop prefix patch in amd.c
Mario Limonciello (AMD) (4):
firmware: dmi: Correct an indexing error in dmi.h
firmware: dmi: Adjust dmi_decode() to use enums
firmware: dmi: Add missing DMI entry types
firmware: dmi: Add pr_fmt() for dmi_scan.c
Yazen Ghannam (1):
x86/CPU/AMD: Print AGESA string from DMI additional information entry
arch/x86/kernel/cpu/amd.c | 53 +++++++++++++++++++++++++++++++++++++ drivers/firmware/dmi_scan.c | 34 +++++++++++++----------- include/linux/dmi.h | 23 ++++++++++++++++ 3 files changed, 95 insertions(+), 15 deletions(-)
Signature · 1 line
2.43.0
PATCH v5 1/5 firmware: dmi: Correct an indexing error in dmi.h
The entries later in enum dmi_entry_type don't match the SMBIOS specification. The entry for type 33: 64-Bit Memory Error Information is not present and thus the index for all later entries is incorrect.
Add the missing type 33 entry.
---
v3:
* Rename to DMI_ENTRY_64_MEM_ERROR (Jean)
--- include/linux/dmi.h | 1 + 1 file changed, 1 insertion(+)
include/linux/dmi.h +1 -0
@@ -60,6 +60,7 @@ enum dmi_entry_type {DMI_ENTRY_OOB_REMOTE_ACCESS ,DMI_ENTRY_BIS_ENTRY ,DMI_ENTRY_SYSTEM_BOOT , +DMI_ENTRY_64_MEM_ERROR ,DMI_ENTRY_MGMT_DEV ,DMI_ENTRY_MGMT_DEV_COMPONENT , DMI_ENTRY_MGMT_DEV_THRES,
Signature · 1 line
2.43.0
PATCH v5 2/5 firmware: dmi: Adjust dmi_decode() to use enums
In reply to Mario Limonciello (AMD)dmi_decode() has hardcoded values with comments for each DMI entry type. The same information is already in dmi.h though, so drop the comments and use the definitions instead.
---
v3:
* pick up tag (Jean)
--- drivers/firmware/dmi_scan.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/firmware/dmi_scan.c +9 -9
@@ -484,14 +484,14 @@ static void __init dmi_memdev_walk(void)static void __init dmi_decode (const struct dmi_header *dm,void *dummy) {switch (dm->type) { -case 0 :/* BIOS Information */ +case DMI_ENTRY_BIOS :dmi_save_ident (dm,DMI_BIOS_VENDOR ,4 );dmi_save_ident (dm,DMI_BIOS_VERSION ,5 );dmi_save_ident (dm,DMI_BIOS_DATE ,8 );dmi_save_release (dm,DMI_BIOS_RELEASE ,21 );dmi_save_release (dm,DMI_EC_FIRMWARE_RELEASE ,23 );break ; -case 1 :/* System Information */ +case DMI_ENTRY_SYSTEM :dmi_save_ident (dm,DMI_SYS_VENDOR ,4 );dmi_save_ident (dm,DMI_PRODUCT_NAME ,5 );dmi_save_ident (dm,DMI_PRODUCT_VERSION ,6 );
@@ -500,33 +500,33 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)dmi_save_ident (dm,DMI_PRODUCT_SKU ,25 );dmi_save_ident (dm,DMI_PRODUCT_FAMILY ,26 );break ; -case 2 :/* Base Board Information */ +case DMI_ENTRY_BASEBOARD :dmi_save_ident (dm,DMI_BOARD_VENDOR ,4 );dmi_save_ident (dm,DMI_BOARD_NAME ,5 );dmi_save_ident (dm,DMI_BOARD_VERSION ,6 );dmi_save_ident (dm,DMI_BOARD_SERIAL ,7 );dmi_save_ident (dm,DMI_BOARD_ASSET_TAG ,8 );break ; -case 3 :/* Chassis Information */ +case DMI_ENTRY_CHASSIS :dmi_save_ident (dm,DMI_CHASSIS_VENDOR ,4 );dmi_save_type (dm,DMI_CHASSIS_TYPE ,5 );dmi_save_ident (dm,DMI_CHASSIS_VERSION ,6 );dmi_save_ident (dm,DMI_CHASSIS_SERIAL ,7 );dmi_save_ident (dm,DMI_CHASSIS_ASSET_TAG ,8 );break ; -case 9 :/* System Slots */ +case DMI_ENTRY_SYSTEM_SLOT :dmi_save_system_slot (dm);break ; -case 10 :/* Onboard Devices Information */ +case DMI_ENTRY_ONBOARD_DEVICE :dmi_save_devices (dm);break ; -case 11 :/* OEM Strings */ +case DMI_ENTRY_OEMSTRINGS :dmi_save_oem_strings_devices (dm);break ; -case 38 :/* IPMI Device Information */ +case DMI_ENTRY_IPMI_DEV :dmi_save_ipmi_device (dm);break ; -case 41 :/* Onboard Devices Extended Information */ +case DMI_ENTRY_ONBOARD_DEV_EXT :dmi_save_extended_devices (dm); } }
Signature · 1 line
2.43.0
PATCH v5 3/5 firmware: dmi: Add missing DMI entry types
In reply to Mario Limonciello (AMD)Type 43 through type 46 entry types are missing from the definitions in the dmi_entry_type enum.
---
v4:
* Add tag (Yazen)
* Correct text (Yazen)
v3:
* Add tag (Jean)
--- include/linux/dmi.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/dmi.h +4 -0
@@ -70,6 +70,10 @@ enum dmi_entry_type {DMI_ENTRY_ADDITIONAL ,DMI_ENTRY_ONBOARD_DEV_EXT ,DMI_ENTRY_MGMT_CONTROLLER_HOST , +DMI_ENTRY_TPM_DEVICE , +DMI_ENTRY_PROCESSOR_ADDITIONAL , +DMI_ENTRY_FIRMWARE_INVENTORY , +DMI_ENTRY_STRING_PROPERTY ,DMI_ENTRY_INACTIVE =126 , DMI_ENTRY_END_OF_TABLE = 127, };
Signature · 1 line
2.43.0
PATCH v5 4/5 firmware: dmi: Add pr_fmt() for dmi_scan.c
In reply to Mario Limonciello (AMD)Several prints inconsistently use DMI: or dmi: or nothing. To make it clear which prints come from dmi_scan.c, add a pr_fmt macro.
---
v4:
* Adjust "DMI not present or invalid" message too (Yazen)
--- drivers/firmware/dmi_scan.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/firmware/dmi_scan.c +8 -5
@@ -1,4 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only + +#define pr_fmt (fmt) "DMI: " fmt +#include <linux/types.h> #include <linux/string.h> #include <linux/init.h>
@@ -634,7 +637,7 @@ static int __init dmi_present(const u8 *buf) dmi_ver >> 16, (dmi_ver >> 8) & 0xFF); }dmi_format_ids (dmi_ids_string,sizeof (dmi_ids_string)); -pr_info ("DMI: %s\n" , dmi_ids_string); +pr_info ("%s\n" , dmi_ids_string);return 0 ; } }
@@ -663,7 +666,7 @@ static int __init dmi_smbios3_present(const u8 *buf) dmi_ver >>16 , (dmi_ver >>8 ) &0xFF , dmi_ver & 0xFF);dmi_format_ids (dmi_ids_string,sizeof (dmi_ids_string)); -pr_info ("DMI: %s\n" , dmi_ids_string); +pr_info ("%s\n" , dmi_ids_string);return 0 ; } }
@@ -758,7 +761,7 @@ static void __init dmi_scan_machine(void)dmi_early_unmap (p,0x10000 ); } error: -pr_info ("DMI not present or invalid.\n" ); +pr_info ("not present or invalid.\n" ); }static __ro_after_init BIN_ATTR_SIMPLE_ADMIN_RO (smbios_entry_point);
@@ -810,7 +813,7 @@ static int __init dmi_init(void)kobject_del (tables_kobj);kobject_put (tables_kobj); err: -pr_err ("dmi: Firmware registration failed.\n" ); +pr_err ("Firmware registration failed.\n" );return ret; }
@@ -831,7 +834,7 @@ void __init dmi_setup(void)return ;dmi_memdev_walk (); -pr_info ("DMI: Memory slots populated: %d/%d\n" , +pr_info ("Memory slots populated: %d/%d\n" , dmi_memdev_populated_nr, dmi_memdev_nr);dump_stack_set_arch_desc ("%s" , dmi_ids_string); }
Signature · 1 line
2.43.0
PATCH v5 5/5 x86/CPU/AMD: Print AGESA string from DMI additional information entry
In reply to Mario Limonciello (AMD)From: Yazen Ghannam <[email protected]>
Type 40 entries (Additional Information) are summarized in section 7.41 as part of the SMBIOS specification. Generally, these entries aren't interesting to save.
However on some AMD Zen systems, the AGESA version is stored here. This is useful to save to the kernel message logs for debugging. It can be used to cross-reference issues.
Implement an iterator for the Additional Information entries. Use this to find and print the AGESA string. Do so in AMD code, since the use case is AMD-specific.
---
v5:
* Return "" in !CONFIG_DMI case (LKP robot, Yazen)
v4:
* New patch (based upon older versions though)
--- arch/x86/kernel/cpu/amd.c | 53 +++++++++++++++++++++++++++++++++++++ drivers/firmware/dmi_scan.c | 3 ++- include/linux/dmi.h | 18 +++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/amd.c +53 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only #include <linux/export.h> #include <linux/bitops.h> +#include <linux/dmi.h> #include <linux/elf.h> #include <linux/mm.h> #include <linux/kvm_types.h>
@@ -1404,3 +1405,55 @@ static __init int print_s5_reset_status_mmio(void)return 0 ; }late_initcall (print_s5_reset_status_mmio); + +static void __init amd_dmi_scan_additional (const struct dmi_header *d,void *p) +{ +struct dmi_a_info *info = (struct dmi_a_info *)d; +void *next, *end; + +/* +* DMI Additional Info table has a 'count' field. But it's not very +* helpful since the entries are variable length. So don't use it. +*/ +if (info->header.type !=DMI_ENTRY_ADDITIONAL || + info->header.length <DMI_A_INFO_MIN_SIZE ) +return ; + +/* +* Get the first entry. +* The minimum table size guarantees at least one entry is present. +*/ + next = (void *)(info +1 ); + end = (void *)info + info->header.length; + +do { +struct dmi_a_info_entry *entry; +const char *string_ptr; + + entry = (struct dmi_a_info_entry *)next; + +/* +* Not much can be done to validate data. At least the entry +* length shouldn't be 0. +*/ +if (!entry->length) +return ; + + string_ptr =dmi_string_nosave (&info->header, entry->str_num); + +/* Only one AGESA string is expected. */ +if (!strncmp (string_ptr,"AGESA" ,5 )) { +pr_info ("%s\n" , string_ptr); +break ; + } + + next += entry->length; + }while (end - next >=DMI_A_INFO_ENT_MIN_SIZE ); +} + +static __init int print_dmi_agesa (void ) +{ +dmi_walk (amd_dmi_scan_additional,NULL ); +return 0 ; +} +late_initcall (print_dmi_agesa);
drivers/firmware/dmi_scan.c +2 -1
@@ -47,7 +47,7 @@ static struct dmi_memdev_info {static int dmi_memdev_nr;static int dmi_memdev_populated_nr__initdata ; -static const char *__init dmi_string_nosave (const struct dmi_header *dm,u8 s) +const char *dmi_string_nosave (const struct dmi_header *dm,u8 s) {const u8 *bp = ((u8 *) dm) + dm->length;const u8 *nsp;
@@ -66,6 +66,7 @@ static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s)return dmi_empty_string; } +EXPORT_SYMBOL_GPL (dmi_string_nosave);static const char *__init dmi_string (const struct dmi_header *dm,u8 s) {
include/linux/dmi.h +18 -0
@@ -91,6 +91,21 @@ struct dmi_device {void *device_data;/* Type specific data */ }; +#define DMI_A_INFO_ENT_MIN_SIZE 0x6 +struct dmi_a_info_entry { +u8 length; +u16 handle; +u8 offset; +u8 str_num; +u8 value[]; +} __packed; + +#define DMI_A_INFO_MIN_SIZE 0xB +struct dmi_a_info { +struct dmi_header header; +u8 count; +} __packed; +#ifdef CONFIG_DMI struct dmi_dev_onboard {
@@ -120,6 +135,7 @@ extern void dmi_memdev_name(u16 handle, const char **bank, const char **device);extern u64 dmi_memdev_size (u16 handle);extern u8 dmi_memdev_type (u16 handle);extern u16 dmi_memdev_handle (int slot); +const char *dmi_string_nosave (const struct dmi_header *dm,u8 s);#else
@@ -153,6 +169,8 @@ static inline u8 dmi_memdev_type(u16 handle) { return 0x0; }static inline u16 dmi_memdev_handle (int slot) {return 0xffff ; }static inline const struct dmi_system_id *dmi_first_match (const struct dmi_system_id *list) {return NULL ; } +static inline const char * +dmi_string_nosave (const struct dmi_header *dm,u8 s) {return "" ; }#endif
Signature · 1 line
2.43.0
Borislav Petkov
maintainerRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 6 lines · Mario Limonciello (AMD)
From: Yazen Ghannam <[email protected]>
Type 40 entries (Additional Information) are summarized in section 7.41 as part of the SMBIOS specification. Generally, these entries aren't interesting to save.
Quoted 7 lines
However on some AMD Zen systems, the AGESA version is stored here. This is useful to save to the kernel message logs for debugging. It can be used to cross-reference issues.
Implement an iterator for the Additional Information entries. Use this to find and print the AGESA string. Do so in AMD code, since the use case is AMD-specific.
Please do not explain the diff.
Quoted 27 lines
Signed-off-by Yazen Ghannam <[email protected]>Co-developed-by "Mario Limonciello (AMD)" <[email protected]>Signed-off-by "Mario Limonciello (AMD)" <[email protected]>---
v5:
* Return "" in !CONFIG_DMI case (LKP robot, Yazen)
v4:
* New patch (based upon older versions though)--- arch/x86/kernel/cpu/amd.c | 53 +++++++++++++++++++++++++++++++++++++ drivers/firmware/dmi_scan.c | 3 ++- include/linux/dmi.h | 18 +++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/amd.c +1
-0@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only #include <linux/export.h> #include <linux/bitops.h> +#include <linux/dmi.h> #include <linux/elf.h> #include <linux/mm.h> #include <linux/kvm_types.h>
arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1409
Quoted 5 lines
arch/x86/kernel/cpu/amd.c +2
-0@@ -1404,3 +1405,55 @@ static __init int print_s5_reset_status_mmio(void)return 0 ; }late_initcall (print_s5_reset_status_mmio); + +static void __init amd_dmi_scan_additional (const struct dmi_header *d,void *p)
It's a static - no need for the "amd_" prefix.
arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1412
Quoted 3 lines
arch/x86/kernel/cpu/amd.c +3
-0+{ +struct dmi_a_info *info = (struct dmi_a_info *)d; +void *next, *end;
This needs a
if (!IS_ENABLED(CONFIG_DMI)) return;
Quoted 5 lines
arch/x86/kernel/cpu/amd.c +5
-0+ +/* +* DMI Additional Info table has a 'count' field. But it's not very +* helpful since the entries are variable length. So don't use it. +*/
arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1427
Quoted 10 lines
arch/x86/kernel/cpu/amd.c +10
-0+if (info->header.type !=DMI_ENTRY_ADDITIONAL || + info->header.length <DMI_A_INFO_MIN_SIZE ) +return ; + +/* +* Get the first entry. +* The minimum table size guarantees at least one entry is present. +*/ + next = (void *)(info +1 ); + end = (void *)info + info->header.length;
This end needs to be corrected to some sane upper limit because we don't trust firmware one bit.
Quoted 7 lines
arch/x86/kernel/cpu/amd.c +7
-0+ + do { + struct dmi_a_info_entry *entry; + const char *string_ptr; + + entry = (struct dmi_a_info_entry *)next; +
arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1444
Quoted 10 lines
arch/x86/kernel/cpu/amd.c +10
-0+/* +* Not much can be done to validate data. At least the entry +* length shouldn't be 0. +*/ +if (!entry->length) +return ; + + string_ptr =dmi_string_nosave (&info->header, entry->str_num); + +/* Only one AGESA string is expected. */
Superfluous comment.
arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1446
Quoted 2 lines
arch/x86/kernel/cpu/amd.c +2
-0+if (!strncmp (string_ptr,"AGESA" ,5 )) { +pr_info ("%s\n" , string_ptr);
So on this Zen5 laptop here, this dumps:
[ 0.840480] AGESA!V9 StrixPI-FP8 1.0.0.1d
I guess we can make that:
[ 0.840480] AGESA: V9 StrixPI-FP8 1.0.0.1d
no?
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 11 lines · Borislav Petkov
Quoted 10 lines · Mario Limonciello (AMD)
From: Yazen Ghannam <[email protected]>
Type 40 entries (Additional Information) are summarized in section 7.41 as part of the SMBIOS specification. Generally, these entries aren't interesting to save.
However on some AMD Zen systems, the AGESA version is stored here. This is useful to save to the kernel message logs for debugging. It can be used to cross-reference issues.
Quoted 6 lines
Quoted 3 lines
Implement an iterator for the Additional Information entries. Use this to find and print the AGESA string. Do so in AMD code, since the use case is AMD-specific.
Please do not explain the diff.
👍
Quoted 35 lines
Quoted 27 lines
Signed-off-by Yazen Ghannam <[email protected]>Co-developed-by "Mario Limonciello (AMD)" <[email protected]>Signed-off-by "Mario Limonciello (AMD)" <[email protected]>---
v5:
* Return "" in !CONFIG_DMI case (LKP robot, Yazen)
v4:
* New patch (based upon older versions though)--- arch/x86/kernel/cpu/amd.c | 53 +++++++++++++++++++++++++++++++++++++ drivers/firmware/dmi_scan.c | 3 ++- include/linux/dmi.h | 18 +++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/amd.c +1
-0@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only #include <linux/export.h> #include <linux/bitops.h> +#include <linux/dmi.h> #include <linux/elf.h> #include <linux/mm.h> #include <linux/kvm_types.h> arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1409
Quoted 5 lines
arch/x86/kernel/cpu/amd.c +2
-0@@ -1404,3 +1405,55 @@ static __init int print_s5_reset_status_mmio(void)return 0 ; }late_initcall (print_s5_reset_status_mmio); + +static void __init amd_dmi_scan_additional (const struct dmi_header *d,void *p)It's a static - no need for the "
amd_" prefix.
Quoted 9 lines
arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1412
Quoted 3 lines
arch/x86/kernel/cpu/amd.c +3
-0+{ +struct dmi_a_info *info = (struct dmi_a_info *)d; +void *next, *end;This needs a
if (!IS_ENABLED(CONFIG_DMI)) return;
👍
Quoted 10 lines
Quoted 10 lines
arch/x86/kernel/cpu/amd.c +10
-0+ +/* +* DMI Additional Info table has a 'count' field. But it's not very +* helpful since the entries are variable length. So don't use it. +*/ +if (info->header.type !=DMI_ENTRY_ADDITIONAL || + info->header.length <DMI_A_INFO_MIN_SIZE ) +return ; + +/*
Quoted 9 lines
arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1427
Quoted 5 lines
arch/x86/kernel/cpu/amd.c +5
-0+* Get the first entry. +* The minimum table size guarantees at least one entry is present. +*/ + next = (void *)(info +1 ); + end = (void *)info + info->header.length;This end needs to be corrected to some sane upper limit because we don't trust firmware one bit.
👍
Quoted 11 lines
Quoted 11 lines
arch/x86/kernel/cpu/amd.c +11
-0+ + do { + struct dmi_a_info_entry *entry; + const char *string_ptr; + + entry = (struct dmi_a_info_entry *)next; + + /* + * Not much can be done to validate data. At least the entry + * length shouldn't be 0. + */
Quoted 8 lines
arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1444
Quoted 6 lines
arch/x86/kernel/cpu/amd.c +6
-0+if (!entry->length) +return ; + + string_ptr =dmi_string_nosave (&info->header, entry->str_num); + +/* Only one AGESA string is expected. */ Superfluous comment.
👍
Quoted 6 lines
arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1446
Quoted 3 lines
arch/x86/kernel/cpu/amd.c +2
-0+if (!strncmp (string_ptr,"AGESA" ,5 )) { +pr_info ("%s\n" , string_ptr);So on this Zen5 laptop here, this dumps:
Quoted 7 lines
[ 0.840480] AGESA!V9 StrixPI-FP8 1.0.0.1dI guess we can make that:
[ 0.840480] AGESA: V9 StrixPI-FP8 1.0.0.1dno?
I think if slicing and dicing the string I would instead have us "match" "AGESA!V9" instead and then spit it out like this:
AGESA: StrixPI-FP8 1.0.0.1d
Then if there's a v10 sentinel some day or something like that we would add a new match then.
Borislav Petkov
maintainerRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 7 lines · Mario Limonciello (AMD) (kernel.org)
I think if slicing and dicing the string I would instead have us "match" "AGESA!V9" instead and then spit it out like this:
AGESA: StrixPI-FP8 1.0.0.1d
Then if there's a v10 sentinel some day or something like that we would add a new match then.
Or, we can simply keep it simple and do:
[ 0.840480] AGESA: AGESA!V9 StrixPI-FP8 1.0.0.1d
A little redundancy won't hurt - having the version is much more important.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 9 lines · Borislav Petkov
Quoted 7 lines · Mario Limonciello (AMD) (kernel.org)
I think if slicing and dicing the string I would instead have us "match" "AGESA!V9" instead and then spit it out like this:
AGESA: StrixPI-FP8 1.0.0.1d
Then if there's a v10 sentinel some day or something like that we would add a new match then.
Quoted 8 lines
Or, we can simply keep it simple and do:
[ 0.840480] AGESA: AGESA!V9 StrixPI-FP8 1.0.0.1dA little redundancy won't hurt - having the version is much more important.
Thx.
Well now you see why I was proposing the x86/amd: prefix in the first place. It could be no slicing and dicing and with that prefix:
x86/amd: AGESA!V9 StrixPI-FP8 1.0.0.1d
Borislav Petkov
maintainerRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 4 lines · Mario Limonciello (AMD) (kernel.org)
Well now you see why I was proposing the x86/amd: prefix in the first place. It could be no slicing and dicing and with that prefix:
x86/amd: AGESA!V9 StrixPI-FP8 1.0.0.1d
So the prefix tells so that it is somewhere from x86/.../amd.
The "AGESA:" prefix tells you it is AGESA.
I don't see how the "x86/amd" prefix works here...
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 4 lines · Borislav Petkov
Quoted 3 lines · Mario Limonciello (AMD) (kernel.org)
Well now you see why I was proposing the x86/amd: prefix in the first place. It could be no slicing and dicing and with that prefix:
Quoted 8 lines
Quoted 1 line
x86/amd: AGESA!V9 StrixPI-FP8 1.0.0.1d
So the prefix tells so that it is somewhere from x86/.../amd.
The "AGESA:" prefix tells you it is AGESA.
I don't see how the "x86/amd" prefix works here...
Mario, what's your intended debug flow?
Do you want to grab any and all messages related to AMD and then go through them? So here you'd like "x86/amd" or something similar as a first pass filter.
Or do you look for specific pieces of data, as needed? So here you'd just look for "AGESA" if you want that or "reset reason", etc.
Thanks,
Yazen
Re: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 20 lines · Yazen Ghannam
Quoted 4 lines · Borislav Petkov
Quoted 3 lines · Mario Limonciello (AMD) (kernel.org)
Well now you see why I was proposing the x86/amd: prefix in the first place. It could be no slicing and dicing and with that prefix:
Quoted 8 lines
Quoted 1 line
x86/amd: AGESA!V9 StrixPI-FP8 1.0.0.1d
So the prefix tells so that it is somewhere from x86/.../amd.
The "AGESA:" prefix tells you it is AGESA.
I don't see how the "x86/amd" prefix works here...
Mario, what's your intended debug flow?
Do you want to grab any and all messages related to AMD and then go through them? So here you'd like "x86/amd" or something similar as a first pass filter.
Quoted 5 lines
Or do you look for specific pieces of data, as needed? So here you'd just look for "AGESA" if you want that or "reset reason", etc.
Thanks,
Yazen
Like all things - it's a case by case basis based upon the ticket and what's wrong.
I don't see any problem with just "grep AGESA" though.
Borislav Petkov
maintainerRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
In reply to Mario Limonciello (AMD)Quoted 6 lines · Mario Limonciello (AMD)
From: Yazen Ghannam <[email protected]>
Type 40 entries (Additional Information) are summarized in section 7.41 as part of the SMBIOS specification. Generally, these entries aren't interesting to save.
Quoted 7 lines
However on some AMD Zen systems, the AGESA version is stored here. This is useful to save to the kernel message logs for debugging. It can be used to cross-reference issues.
Implement an iterator for the Additional Information entries. Use this to find and print the AGESA string. Do so in AMD code, since the use case is AMD-specific.
Look what I said the last time:
https://lore.kernel.org/r/20260126130755.GIaXdnK65MTIiXqg-l@fat_crate.local
I'll have to teach AI to give feedback for commit messages explaining the diff.
Quoted 40 lines
Signed-off-by Yazen Ghannam <[email protected]>Co-developed-by "Mario Limonciello (AMD)" <[email protected]>Signed-off-by "Mario Limonciello (AMD)" <[email protected]>---
v5:
* Return "" in !CONFIG_DMI case (LKP robot, Yazen)
v4:
* New patch (based upon older versions though)--- arch/x86/kernel/cpu/amd.c | 53 +++++++++++++++++++++++++++++++++++++ drivers/firmware/dmi_scan.c | 3 ++- include/linux/dmi.h | 18 +++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/amd.c +11
-0@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only #include <linux/export.h> #include <linux/bitops.h> +#include <linux/dmi.h> #include <linux/elf.h> #include <linux/mm.h> #include <linux/kvm_types.h> @@ -1404,3 +1405,55 @@ static __init int print_s5_reset_status_mmio(void)return 0 ; }late_initcall (print_s5_reset_status_mmio); + +static void __init amd_dmi_scan_additional (const struct dmi_header *d,void *p) +{ +struct dmi_a_info *info = (struct dmi_a_info *)d; +void *next, *end; + +/* +* DMI Additional Info table has a 'count' field. But it's not very +* helpful since the entries are variable length. So don't use it. +*/
arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1427
Quoted 10 lines
arch/x86/kernel/cpu/amd.c +10
-0+if (info->header.type !=DMI_ENTRY_ADDITIONAL || + info->header.length <DMI_A_INFO_MIN_SIZE ) +return ; + +/* +* Get the first entry. +* The minimum table size guarantees at least one entry is present. +*/ + next = (void *)(info +1 ); + end = (void *)info + info->header.length;
From last time:
"This end needs to be corrected to some sane upper limit because we don't trust firmware one bit."
Lemme stop review here until you address all review comments from the last time.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 11 lines · Borislav Petkov
Quoted 10 lines · Mario Limonciello (AMD)
From: Yazen Ghannam <[email protected]>
Type 40 entries (Additional Information) are summarized in section 7.41 as part of the SMBIOS specification. Generally, these entries aren't interesting to save.
However on some AMD Zen systems, the AGESA version is stored here. This is useful to save to the kernel message logs for debugging. It can be used to cross-reference issues.
Quoted 5 lines
Quoted 3 lines
Implement an iterator for the Additional Information entries. Use this to find and print the AGESA string. Do so in AMD code, since the use case is AMD-specific.
Look what I said the last time:
FYI - you're replying to the v5 not the v6 [1].
Quoted 5 lines
https://lore.kernel.org/r/20260126130755.GIaXdnK65MTIiXqg-l@fat_crate.local
I'll have to teach AI to give feedback for commit messages explaining the diff.
Sorry about that one, I missed it even in v6.
Quoted 54 lines
Quoted 41 lines
Signed-off-by Yazen Ghannam <[email protected]>Co-developed-by "Mario Limonciello (AMD)" <[email protected]>Signed-off-by "Mario Limonciello (AMD)" <[email protected]>---
v5:
* Return "" in !CONFIG_DMI case (LKP robot, Yazen)
v4:
* New patch (based upon older versions though)--- arch/x86/kernel/cpu/amd.c | 53 +++++++++++++++++++++++++++++++++++++ drivers/firmware/dmi_scan.c | 3 ++- include/linux/dmi.h | 18 +++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/amd.c +11
-0@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only #include <linux/export.h> #include <linux/bitops.h> +#include <linux/dmi.h> #include <linux/elf.h> #include <linux/mm.h> #include <linux/kvm_types.h> @@ -1404,3 +1405,55 @@ static __init int print_s5_reset_status_mmio(void)return 0 ; }late_initcall (print_s5_reset_status_mmio); + +static void __init amd_dmi_scan_additional (const struct dmi_header *d,void *p) +{ +struct dmi_a_info *info = (struct dmi_a_info *)d; +void *next, *end; + +/* +* DMI Additional Info table has a 'count' field. But it's not very +* helpful since the entries are variable length. So don't use it. +*/ arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1427
Quoted 10 lines
arch/x86/kernel/cpu/amd.c +10
-0+if (info->header.type !=DMI_ENTRY_ADDITIONAL || + info->header.length <DMI_A_INFO_MIN_SIZE ) +return ; + +/* +* Get the first entry. +* The minimum table size guarantees at least one entry is present. +*/ + next = (void *)(info +1 ); + end = (void *)info + info->header.length;From last time:
Quoted 3 lines
"This end needs to be corrected to some sane upper limit because we don't trust firmware one bit."
I did add a check for info->count < 1, but that's not what you were actually looking for. Do you have a suggestion for an upper limit to bound things?
I was thinking something like this:
#define DMI_LIMIT 10
int limit = info -> count > DMI_LIMIT ? DMI_LIMIT : info->count; end = (void *)info + limit * info->header.length;
Borislav Petkov
maintainerRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 1 line · Mario Limonciello
FYI - you're replying to the v5 not the v6 [1].
Whoops, sorry about that.
It looks I've still used the right set tho:
v6_20260307_superm1_print_agesa_version_at_bootup.mbx
:)
Quoted 8 lines
I did add a check for
info->count< 1, but that's not what you were actually looking for. Do you have a suggestion for an upper limit to bound things?I was thinking something like this:
#define
DMI_LIMIT10
int limit = info -> count >DMI_LIMIT?DMI_LIMIT:info->count; end = (void *)info + limit *info->header.length;
So that Zen5 laptop here says:
[ 0.853836] dmi_scan_additional: next: 0xffffc9000051950c, end: 0xffffc90000519515, hdr length: 14 [ 0.854364] entry 0: length: 9 [ 0.854576] AGESA: StrixPI-FP8 1.0.0.1d
So after that first loop pass we have
next = 0xffffc9000051950c + 9 = 0xffffc90000519515
And we should terminate. So I guess that's not a lot of entries.
In terms of limiting, I'd do something like:
/* A generous max size for the additional DMI entries */
#define MAX_DMI_ADDITIONAL_ENTRIES_LEN 256
if (info->header.length > MAX_DMI_ADDITIONAL_ENTRIES_LEN) info->header.length = MAX_DMI_ADDITIONAL_ENTRIES_LEN;
And now you have a sane upper limit and we don't rely on any numbers the BIOS is telling us.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 37 lines · Borislav Petkov
Quoted 1 line · Mario Limonciello
FYI - you're replying to the v5 not the v6 [1].
Whoops, sorry about that.
It looks I've still used the right set tho:
v6_20260307_superm1_print_agesa_version_at_bootup.mbx
:)
Quoted 8 lines
I did add a check for
info->count< 1, but that's not what you were actually looking for. Do you have a suggestion for an upper limit to bound things?I was thinking something like this:
#define
DMI_LIMIT10
int limit = info -> count >DMI_LIMIT?DMI_LIMIT:info->count; end = (void *)info + limit *info->header.length;So that Zen5 laptop here says:
[ 0.853836] dmi_scan_additional: next: 0xffffc9000051950c, end: 0xffffc90000519515, hdr length: 14 [ 0.854364] entry 0: length: 9 [ 0.854576] AGESA: StrixPI-FP8 1.0.0.1dSo after that first loop pass we have
next = 0xffffc9000051950c + 9 = 0xffffc90000519515And we should terminate. So I guess that's not a lot of entries.
In terms of limiting, I'd do something like:
/* A generous max size for the additional DMI entries */
#defineMAX_DMI_ADDITIONAL_ENTRIES_LEN256
Quoted 8 lines
if (info->header.length > MAX_DMI_ADDITIONAL_ENTRIES_LEN) info->header.length = MAX_DMI_ADDITIONAL_ENTRIES_LEN;And now you have a sane upper limit and we don't rely on any numbers the BIOS is telling us.
Thx.
But that can't actually happen. info->header.length is u8.
So we're never going to end up with that many entries such that it would exhaust the check.
Borislav Petkov
maintainerRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 4 lines · Mario Limonciello
But that can't actually happen.
info->header.lengthis u8.So we're never going to end up with that many entries such that it would exhaust the check.
Ah ok, I didn't see that. That's good then. I guess we can start queueing the next version you send with all the feedback incorporated.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 11 lines · Borislav Petkov
Quoted 4 lines · Mario Limonciello
But that can't actually happen.
info->header.lengthis u8.So we're never going to end up with that many entries such that it would exhaust the check.
Ah ok, I didn't see that. That's good then. I guess we can start queueing the next version you send with all the feedback incorporated.
Thx.
The only remaining feedback is commit message IIRC. Do you want to just massage that yourself while committing or do you want me to spin again and do it?
Borislav Petkov
maintainerRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 3 lines · Mario Limonciello
The only remaining feedback is commit message IIRC. Do you want to just massage that yourself while committing or do you want me to spin again and do it?
Sure, I can do that.
@Jean, ack to the first 4 patches to go through tip?
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteJean Delvare
Reviewed-byRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Hi Borislav,
Quoted 8 lines · Borislav Petkov
Quoted 3 lines · Mario Limonciello
The only remaining feedback is commit message IIRC. Do you want to just massage that yourself while committing or do you want me to spin again and do it?
Sure, I can do that.
@Jean, ack to the first 4 patches to go through tip?
I have reviewed the first 4 patches and they look good to me. You can add:
to the patches which do not have it yet, and I am OK with them going through tip.
Thanks Mario, Borislav and Yazen for all the work on this series!
Signature · 2 lines
Jean Delvare SUSE L3 Support
Borislav Petkov
maintainerRe: [PATCH v5 5/5] x86/CPU/AMD: Print AGESA string from DMI additional information entry
Quoted 15 lines · Jean Delvare
Hi Borislav,
Quoted 8 lines · Borislav Petkov
Quoted 3 lines · Mario Limonciello
The only remaining feedback is commit message IIRC. Do you want to just massage that yourself while committing or do you want me to spin again and do it?
Sure, I can do that.
@Jean, ack to the first 4 patches to go through tip?
I have reviewed the first 4 patches and they look good to me. You can add:
Quoted 6 lines
Reviewed-by Jean Delvare <[email protected]>to the patches which do not have it yet, and I am OK with them going through tip.
Thanks Mario, Borislav and Yazen for all the work on this series!
Cool, thanks for the review!
I'll queue them soon.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette