Re: [PATCH v2] efi: Unify dmi setup code over architectures arm/arm64, io64 and x86
On Thu, 28 Mar 2019 at 08:55, Robert Richter wrote: > > On 27.03.19 19:53:47, Ard Biesheuvel wrote: > > On Wed, 20 Mar 2019 at 16:23, Robert Richter wrote: > > > > > > On 20.03.19 14:16:07, Robert Richter wrote: > > > > On 20.03.19 13:05:37, Robert Richter wrote: > > > > > @@ -167,6 +167,7 @@ static int __init arm_dmi_init(void) > > > > > * itself, depends on dmi_scan_machine() having been called > > > > > already. > > > > > */ > > > > > dmi_scan_machine(); > > > > > + dmi_memdev_walk(); > > > > > if (dmi_available) > > > > > dmi_set_dump_stack_arch_desc(); > > > > > return 0; > > > > > > > > After > > > > > > > > [PATCH] efi/arm: Show SMBIOS bank/device location in cper and > > > > ghes error logs > > > > > > > > wents in for arm/arm64, we can unify the code. See patch below. > > > > > > V2 with the fix in arm_dmi_init() below. > > > > > > > Could you please resend this as a proper patch? I am having trouble > > applying it. > > I just resent the patch. But this worked for me: > > $ wget -nd -O - https://lore.kernel.org/patchwork/patch/1052718/mbox/ | git > am -smc -3 - > > Not sure what was wrong. > Thanks. Not sure either, but I managed to apply it now, with s/io64/ia64/, and Jean's R-b added. -- Ard.
Re: [PATCH v2] efi: Unify dmi setup code over architectures arm/arm64, io64 and x86
On 27.03.19 19:53:47, Ard Biesheuvel wrote: > On Wed, 20 Mar 2019 at 16:23, Robert Richter wrote: > > > > On 20.03.19 14:16:07, Robert Richter wrote: > > > On 20.03.19 13:05:37, Robert Richter wrote: > > > > @@ -167,6 +167,7 @@ static int __init arm_dmi_init(void) > > > > * itself, depends on dmi_scan_machine() having been called already. > > > > */ > > > > dmi_scan_machine(); > > > > + dmi_memdev_walk(); > > > > if (dmi_available) > > > > dmi_set_dump_stack_arch_desc(); > > > > return 0; > > > > > > After > > > > > > [PATCH] efi/arm: Show SMBIOS bank/device location in cper and > > > ghes error logs > > > > > > wents in for arm/arm64, we can unify the code. See patch below. > > > > V2 with the fix in arm_dmi_init() below. > > > > Could you please resend this as a proper patch? I am having trouble applying > it. I just resent the patch. But this worked for me: $ wget -nd -O - https://lore.kernel.org/patchwork/patch/1052718/mbox/ | git am -smc -3 - Not sure what was wrong. Thanks, -Robert
Re: [PATCH v2] efi: Unify dmi setup code over architectures arm/arm64, io64 and x86
On Wed, 20 Mar 2019 at 16:23, Robert Richter wrote: > > On 20.03.19 14:16:07, Robert Richter wrote: > > On 20.03.19 13:05:37, Robert Richter wrote: > > > @@ -167,6 +167,7 @@ static int __init arm_dmi_init(void) > > > * itself, depends on dmi_scan_machine() having been called already. > > > */ > > > dmi_scan_machine(); > > > + dmi_memdev_walk(); > > > if (dmi_available) > > > dmi_set_dump_stack_arch_desc(); > > > return 0; > > > > After > > > > [PATCH] efi/arm: Show SMBIOS bank/device location in cper and > > ghes error logs > > > > wents in for arm/arm64, we can unify the code. See patch below. > > V2 with the fix in arm_dmi_init() below. > Could you please resend this as a proper patch? I am having trouble applying it. > > -- >8 -- > From: Robert Richter > Subject: [PATCH v2] efi: Unify dmi setup code over architectures arm/arm64, > io64 and x86 > > All architectures (arm/arm64, io64 and x86) do the same here, so unify > the code. > > Note: We do not need to call dump_stack_set_arch_desc() in case of > !dmi_available. Both strings, dmi_ids_string and dump_stack_arch_ > desc_str are initialized zero and thus nothing would change. > > Signed-off-by: Robert Richter > --- > arch/ia64/kernel/setup.c | 4 +--- > arch/x86/kernel/setup.c| 6 ++ > drivers/firmware/dmi_scan.c| 28 +++- > drivers/firmware/efi/arm-runtime.c | 7 ++- > include/linux/dmi.h| 8 ++-- > 5 files changed, 22 insertions(+), 31 deletions(-) > > diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c > index 583a3746d70b..c9cfa760cd57 100644 > --- a/arch/ia64/kernel/setup.c > +++ b/arch/ia64/kernel/setup.c > @@ -1058,9 +1058,7 @@ check_bugs (void) > > static int __init run_dmi_scan(void) > { > - dmi_scan_machine(); > - dmi_memdev_walk(); > - dmi_set_dump_stack_arch_desc(); > + dmi_setup(); > return 0; > } > core_initcall(run_dmi_scan); > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > index 3d872a527cd9..3773905cd2c1 100644 > --- a/arch/x86/kernel/setup.c > +++ b/arch/x86/kernel/setup.c > @@ -1005,13 +1005,11 @@ void __init setup_arch(char **cmdline_p) > if (efi_enabled(EFI_BOOT)) > efi_init(); > > - dmi_scan_machine(); > - dmi_memdev_walk(); > - dmi_set_dump_stack_arch_desc(); > + dmi_setup(); > > /* > * VMware detection requires dmi to be available, so this > -* needs to be done after dmi_scan_machine(), for the boot CPU. > +* needs to be done after dmi_setup(), for the boot CPU. > */ > init_hypervisor_platform(); > > diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c > index 099d83e4e910..fae2d5c43314 100644 > --- a/drivers/firmware/dmi_scan.c > +++ b/drivers/firmware/dmi_scan.c > @@ -416,11 +416,8 @@ static void __init save_mem_devices(const struct > dmi_header *dm, void *v) > nr++; > } > > -void __init dmi_memdev_walk(void) > +static void __init dmi_memdev_walk(void) > { > - if (!dmi_available) > - return; > - > if (dmi_walk_early(count_mem_devices) == 0 && dmi_memdev_nr) { > dmi_memdev = dmi_alloc(sizeof(*dmi_memdev) * dmi_memdev_nr); > if (dmi_memdev) > @@ -614,7 +611,7 @@ static int __init dmi_smbios3_present(const u8 *buf) > return 1; > } > > -void __init dmi_scan_machine(void) > +static void __init dmi_scan_machine(void) > { > char __iomem *p, *q; > char buf[32]; > @@ -769,15 +766,20 @@ static int __init dmi_init(void) > subsys_initcall(dmi_init); > > /** > - * dmi_set_dump_stack_arch_desc - set arch description for dump_stack() > + * dmi_setup - scan and setup DMI system information > * > - * Invoke dump_stack_set_arch_desc() with DMI system information so that > - * DMI identifiers are printed out on task dumps. Arch boot code should > - * call this function after dmi_scan_machine() if it wants to print out DMI > - * identifiers on task dumps. > + * Scan the DMI system information. This setups DMI identifiers > + * (dmi_system_id) for printing it out on task dumps and prepares > + * DIMM entry information (dmi_memdev_info) from the SMBIOS table > + * for using this when reporting memory errors. > */ > -void __init dmi_set_dump_stack_arch_desc(void) > +void __init dmi_setup(void) > { > + dmi_scan_machine(); > + if (!dmi_available) > + return; > + > + dmi_memdev_walk(); > dump_stack_set_arch_desc("%s", dmi_ids_string); > } > > @@ -841,7 +843,7 @@ static bool dmi_is_end_of_table(const struct > dmi_system_id *dmi) > * returns non zero or we hit the end. Callback function is called for > * each successful match. Returns the number of matches. > * > - * dmi_scan_machine must be called before this function is called. > + * dmi_setup must be
Re: [PATCH v2] efi: Unify dmi setup code over architectures arm/arm64, io64 and x86
On Thu, 21 Mar 2019 at 11:11, Jean Delvare wrote: > > On Thu, 2019-03-21 at 10:51 +0100, Ard Biesheuvel wrote: > > On Thu, 21 Mar 2019 at 10:39, Robert Richter wrote: > > > > > > On 20.03.19 23:02:09, Ard Biesheuvel wrote: > > > > On Wed, 20 Mar 2019 at 16:23, Robert Richter > > > > wrote: > > > > > > > > > > On 20.03.19 14:16:07, Robert Richter wrote: > > > > > > On 20.03.19 13:05:37, Robert Richter wrote: > > > > > > > @@ -167,6 +167,7 @@ static int __init arm_dmi_init(void) > > > > > > > * itself, depends on dmi_scan_machine() having been called > > > > > > > already. > > > > > > > */ > > > > > > > dmi_scan_machine(); > > > > > > > + dmi_memdev_walk(); > > > > > > > if (dmi_available) > > > > > > > dmi_set_dump_stack_arch_desc(); > > > > > > > return 0; > > > > > > > > > > > > After > > > > > > > > > > > > [PATCH] efi/arm: Show SMBIOS bank/device location in cper and > > > > > > ghes error logs > > > > > > > > > > > > wents in for arm/arm64, we can unify the code. See patch below. > > > > > > > > > > V2 with the fix in arm_dmi_init() below. > > > > > > > > > > -Robert > > > > > > > > > > > > > > > -- >8 -- > > > > > From: Robert Richter > > > > > Subject: [PATCH v2] efi: Unify dmi setup code over architectures > > > > > arm/arm64, > > > > > io64 and x86 > > > > > > > > > > All architectures (arm/arm64, io64 and x86) do the same here, so unify > > > > > the code. > > > > > > > > > > Note: We do not need to call dump_stack_set_arch_desc() in case of > > > > > !dmi_available. Both strings, dmi_ids_string and dump_stack_arch_ > > > > > desc_str are initialized zero and thus nothing would change. > > > > > > > > > > > > > I don't understand the last sentence - we do not need to call > > > > dump_stack_set_arch_desc() when !dmi_available, but we do so anyway, > > > > right? Doesn't that wipe the arch description we set based on the DT > > > > machine name? > > > > > > No, in dmi_setup() we exit early when !dmi_available. So for arm/arm64 > > > nothing changed. But for x86 and ia64 we no longer call dump_stack_ > > > set_arch_desc() in this case. This is ok since both strings, > > > dmi_ids_string and dump_stack_arch_desc_str, are initialized zero and > > > copying one to the other does not change anything. > > > > > > > Ah, of course. Apologies for not reading more carefully. > > > > I'll take this patch via the EFI tree. > > I like the idea. If this is not going through my tree then: > > Reviewed-by: Jean Delvare > Thanks Jean.
Re: [PATCH v2] efi: Unify dmi setup code over architectures arm/arm64, io64 and x86
On Thu, 2019-03-21 at 10:51 +0100, Ard Biesheuvel wrote: > On Thu, 21 Mar 2019 at 10:39, Robert Richter wrote: > > > > On 20.03.19 23:02:09, Ard Biesheuvel wrote: > > > On Wed, 20 Mar 2019 at 16:23, Robert Richter wrote: > > > > > > > > On 20.03.19 14:16:07, Robert Richter wrote: > > > > > On 20.03.19 13:05:37, Robert Richter wrote: > > > > > > @@ -167,6 +167,7 @@ static int __init arm_dmi_init(void) > > > > > > * itself, depends on dmi_scan_machine() having been called > > > > > > already. > > > > > > */ > > > > > > dmi_scan_machine(); > > > > > > + dmi_memdev_walk(); > > > > > > if (dmi_available) > > > > > > dmi_set_dump_stack_arch_desc(); > > > > > > return 0; > > > > > > > > > > After > > > > > > > > > > [PATCH] efi/arm: Show SMBIOS bank/device location in cper and > > > > > ghes error logs > > > > > > > > > > wents in for arm/arm64, we can unify the code. See patch below. > > > > > > > > V2 with the fix in arm_dmi_init() below. > > > > > > > > -Robert > > > > > > > > > > > > -- >8 -- > > > > From: Robert Richter > > > > Subject: [PATCH v2] efi: Unify dmi setup code over architectures > > > > arm/arm64, > > > > io64 and x86 > > > > > > > > All architectures (arm/arm64, io64 and x86) do the same here, so unify > > > > the code. > > > > > > > > Note: We do not need to call dump_stack_set_arch_desc() in case of > > > > !dmi_available. Both strings, dmi_ids_string and dump_stack_arch_ > > > > desc_str are initialized zero and thus nothing would change. > > > > > > > > > > I don't understand the last sentence - we do not need to call > > > dump_stack_set_arch_desc() when !dmi_available, but we do so anyway, > > > right? Doesn't that wipe the arch description we set based on the DT > > > machine name? > > > > No, in dmi_setup() we exit early when !dmi_available. So for arm/arm64 > > nothing changed. But for x86 and ia64 we no longer call dump_stack_ > > set_arch_desc() in this case. This is ok since both strings, > > dmi_ids_string and dump_stack_arch_desc_str, are initialized zero and > > copying one to the other does not change anything. > > > > Ah, of course. Apologies for not reading more carefully. > > I'll take this patch via the EFI tree. I like the idea. If this is not going through my tree then: Reviewed-by: Jean Delvare -- Jean Delvare SUSE L3 Support
Re: [PATCH v2] efi: Unify dmi setup code over architectures arm/arm64, io64 and x86
On Thu, 21 Mar 2019 at 11:08, Robert Richter wrote: > > On 21.03.19 10:51:34, Ard Biesheuvel wrote: > > On Thu, 21 Mar 2019 at 10:39, Robert Richter wrote: > > > > > > On 20.03.19 23:02:09, Ard Biesheuvel wrote: > > > > On Wed, 20 Mar 2019 at 16:23, Robert Richter > > > > wrote: > > > > > > > > > > On 20.03.19 14:16:07, Robert Richter wrote: > > > > > > On 20.03.19 13:05:37, Robert Richter wrote: > > > > > > > @@ -167,6 +167,7 @@ static int __init arm_dmi_init(void) > > > > > > > * itself, depends on dmi_scan_machine() having been called > > > > > > > already. > > > > > > > */ > > > > > > > dmi_scan_machine(); > > > > > > > + dmi_memdev_walk(); > > > > > > > if (dmi_available) > > > > > > > dmi_set_dump_stack_arch_desc(); > > > > > > > return 0; > > > > > > > > > > > > After > > > > > > > > > > > > [PATCH] efi/arm: Show SMBIOS bank/device location in cper and > > > > > > ghes error logs > > > > > > > > > > > > wents in for arm/arm64, we can unify the code. See patch below. > > > > > > > > > > V2 with the fix in arm_dmi_init() below. > > > > > > > > > > -Robert > > > > > > > > > > > > > > > -- >8 -- > > > > > From: Robert Richter > > > > > Subject: [PATCH v2] efi: Unify dmi setup code over architectures > > > > > arm/arm64, > > > > > io64 and x86 > > > > > > > > > > All architectures (arm/arm64, io64 and x86) do the same here, so unify > > > > > the code. > > > > > > > > > > Note: We do not need to call dump_stack_set_arch_desc() in case of > > > > > !dmi_available. Both strings, dmi_ids_string and dump_stack_arch_ > > > > > desc_str are initialized zero and thus nothing would change. > > > > > > > > > > > > > I don't understand the last sentence - we do not need to call > > > > dump_stack_set_arch_desc() when !dmi_available, but we do so anyway, > > > > right? Doesn't that wipe the arch description we set based on the DT > > > > machine name? > > > > > > No, in dmi_setup() we exit early when !dmi_available. So for arm/arm64 > > > nothing changed. But for x86 and ia64 we no longer call dump_stack_ > > > set_arch_desc() in this case. This is ok since both strings, > > > dmi_ids_string and dump_stack_arch_desc_str, are initialized zero and > > > copying one to the other does not change anything. > > > > > > > Ah, of course. Apologies for not reading more carefully. > > > > I'll take this patch via the EFI tree. > > > > It seems to me though that the previous patch makes the memdev_walk() > > call unconditional for ARM, and this change subsequently makes it > > dependent on dmi_available. Should we fix that? > > The first patch has the check in memdev_walk(). So that is looking > good. The check is then moved to dmi_setup() in the 2nd patch. > OK, that works for me. > Thanks for handling this. > Thanks for the contribution.
Re: [PATCH v2] efi: Unify dmi setup code over architectures arm/arm64, io64 and x86
On 21.03.19 10:51:34, Ard Biesheuvel wrote: > On Thu, 21 Mar 2019 at 10:39, Robert Richter wrote: > > > > On 20.03.19 23:02:09, Ard Biesheuvel wrote: > > > On Wed, 20 Mar 2019 at 16:23, Robert Richter wrote: > > > > > > > > On 20.03.19 14:16:07, Robert Richter wrote: > > > > > On 20.03.19 13:05:37, Robert Richter wrote: > > > > > > @@ -167,6 +167,7 @@ static int __init arm_dmi_init(void) > > > > > > * itself, depends on dmi_scan_machine() having been called > > > > > > already. > > > > > > */ > > > > > > dmi_scan_machine(); > > > > > > + dmi_memdev_walk(); > > > > > > if (dmi_available) > > > > > > dmi_set_dump_stack_arch_desc(); > > > > > > return 0; > > > > > > > > > > After > > > > > > > > > > [PATCH] efi/arm: Show SMBIOS bank/device location in cper and > > > > > ghes error logs > > > > > > > > > > wents in for arm/arm64, we can unify the code. See patch below. > > > > > > > > V2 with the fix in arm_dmi_init() below. > > > > > > > > -Robert > > > > > > > > > > > > -- >8 -- > > > > From: Robert Richter > > > > Subject: [PATCH v2] efi: Unify dmi setup code over architectures > > > > arm/arm64, > > > > io64 and x86 > > > > > > > > All architectures (arm/arm64, io64 and x86) do the same here, so unify > > > > the code. > > > > > > > > Note: We do not need to call dump_stack_set_arch_desc() in case of > > > > !dmi_available. Both strings, dmi_ids_string and dump_stack_arch_ > > > > desc_str are initialized zero and thus nothing would change. > > > > > > > > > > I don't understand the last sentence - we do not need to call > > > dump_stack_set_arch_desc() when !dmi_available, but we do so anyway, > > > right? Doesn't that wipe the arch description we set based on the DT > > > machine name? > > > > No, in dmi_setup() we exit early when !dmi_available. So for arm/arm64 > > nothing changed. But for x86 and ia64 we no longer call dump_stack_ > > set_arch_desc() in this case. This is ok since both strings, > > dmi_ids_string and dump_stack_arch_desc_str, are initialized zero and > > copying one to the other does not change anything. > > > > Ah, of course. Apologies for not reading more carefully. > > I'll take this patch via the EFI tree. > > It seems to me though that the previous patch makes the memdev_walk() > call unconditional for ARM, and this change subsequently makes it > dependent on dmi_available. Should we fix that? The first patch has the check in memdev_walk(). So that is looking good. The check is then moved to dmi_setup() in the 2nd patch. Thanks for handling this. -Robert > > > > > > > > Signed-off-by: Robert Richter > > > > --- > > > > arch/ia64/kernel/setup.c | 4 +--- > > > > arch/x86/kernel/setup.c| 6 ++ > > > > drivers/firmware/dmi_scan.c| 28 +++- > > > > drivers/firmware/efi/arm-runtime.c | 7 ++- > > > > include/linux/dmi.h| 8 ++-- > > > > 5 files changed, 22 insertions(+), 31 deletions(-) > > > > > > > > diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c > > > > index 583a3746d70b..c9cfa760cd57 100644 > > > > --- a/arch/ia64/kernel/setup.c > > > > +++ b/arch/ia64/kernel/setup.c > > > > @@ -1058,9 +1058,7 @@ check_bugs (void) > > > > > > > > static int __init run_dmi_scan(void) > > > > { > > > > - dmi_scan_machine(); > > > > - dmi_memdev_walk(); > > > > - dmi_set_dump_stack_arch_desc(); > > > > + dmi_setup(); > > > > return 0; > > > > } > > > > core_initcall(run_dmi_scan); > > > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > > > > index 3d872a527cd9..3773905cd2c1 100644 > > > > --- a/arch/x86/kernel/setup.c > > > > +++ b/arch/x86/kernel/setup.c > > > > @@ -1005,13 +1005,11 @@ void __init setup_arch(char **cmdline_p) > > > > if (efi_enabled(EFI_BOOT)) > > > > efi_init(); > > > > > > > > - dmi_scan_machine(); > > > > - dmi_memdev_walk(); > > > > - dmi_set_dump_stack_arch_desc(); > > > > + dmi_setup(); > > > > > > > > /* > > > > * VMware detection requires dmi to be available, so this > > > > -* needs to be done after dmi_scan_machine(), for the boot CPU. > > > > +* needs to be done after dmi_setup(), for the boot CPU. > > > > */ > > > > init_hypervisor_platform(); > > > > > > > > diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c > > > > index 099d83e4e910..fae2d5c43314 100644 > > > > --- a/drivers/firmware/dmi_scan.c > > > > +++ b/drivers/firmware/dmi_scan.c > > > > @@ -416,11 +416,8 @@ static void __init save_mem_devices(const struct > > > > dmi_header *dm, void *v) > > > > nr++; > > > > } > > > > > > > > -void __init dmi_memdev_walk(void) > > > > +static void __init dmi_memdev_walk(void) > > > > { > > > > - if (!dmi_available) > > > > - return; > > > > - > > > > if (dmi_walk_early(count_mem_devices) == 0 && dmi_memdev_nr) {
Re: [PATCH v2] efi: Unify dmi setup code over architectures arm/arm64, io64 and x86
On Thu, 21 Mar 2019 at 10:39, Robert Richter wrote: > > On 20.03.19 23:02:09, Ard Biesheuvel wrote: > > On Wed, 20 Mar 2019 at 16:23, Robert Richter wrote: > > > > > > On 20.03.19 14:16:07, Robert Richter wrote: > > > > On 20.03.19 13:05:37, Robert Richter wrote: > > > > > @@ -167,6 +167,7 @@ static int __init arm_dmi_init(void) > > > > > * itself, depends on dmi_scan_machine() having been called > > > > > already. > > > > > */ > > > > > dmi_scan_machine(); > > > > > + dmi_memdev_walk(); > > > > > if (dmi_available) > > > > > dmi_set_dump_stack_arch_desc(); > > > > > return 0; > > > > > > > > After > > > > > > > > [PATCH] efi/arm: Show SMBIOS bank/device location in cper and > > > > ghes error logs > > > > > > > > wents in for arm/arm64, we can unify the code. See patch below. > > > > > > V2 with the fix in arm_dmi_init() below. > > > > > > -Robert > > > > > > > > > -- >8 -- > > > From: Robert Richter > > > Subject: [PATCH v2] efi: Unify dmi setup code over architectures > > > arm/arm64, > > > io64 and x86 > > > > > > All architectures (arm/arm64, io64 and x86) do the same here, so unify > > > the code. > > > > > > Note: We do not need to call dump_stack_set_arch_desc() in case of > > > !dmi_available. Both strings, dmi_ids_string and dump_stack_arch_ > > > desc_str are initialized zero and thus nothing would change. > > > > > > > I don't understand the last sentence - we do not need to call > > dump_stack_set_arch_desc() when !dmi_available, but we do so anyway, > > right? Doesn't that wipe the arch description we set based on the DT > > machine name? > > No, in dmi_setup() we exit early when !dmi_available. So for arm/arm64 > nothing changed. But for x86 and ia64 we no longer call dump_stack_ > set_arch_desc() in this case. This is ok since both strings, > dmi_ids_string and dump_stack_arch_desc_str, are initialized zero and > copying one to the other does not change anything. > Ah, of course. Apologies for not reading more carefully. I'll take this patch via the EFI tree. It seems to me though that the previous patch makes the memdev_walk() call unconditional for ARM, and this change subsequently makes it dependent on dmi_available. Should we fix that? > > > > > Signed-off-by: Robert Richter > > > --- > > > arch/ia64/kernel/setup.c | 4 +--- > > > arch/x86/kernel/setup.c| 6 ++ > > > drivers/firmware/dmi_scan.c| 28 +++- > > > drivers/firmware/efi/arm-runtime.c | 7 ++- > > > include/linux/dmi.h| 8 ++-- > > > 5 files changed, 22 insertions(+), 31 deletions(-) > > > > > > diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c > > > index 583a3746d70b..c9cfa760cd57 100644 > > > --- a/arch/ia64/kernel/setup.c > > > +++ b/arch/ia64/kernel/setup.c > > > @@ -1058,9 +1058,7 @@ check_bugs (void) > > > > > > static int __init run_dmi_scan(void) > > > { > > > - dmi_scan_machine(); > > > - dmi_memdev_walk(); > > > - dmi_set_dump_stack_arch_desc(); > > > + dmi_setup(); > > > return 0; > > > } > > > core_initcall(run_dmi_scan); > > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > > > index 3d872a527cd9..3773905cd2c1 100644 > > > --- a/arch/x86/kernel/setup.c > > > +++ b/arch/x86/kernel/setup.c > > > @@ -1005,13 +1005,11 @@ void __init setup_arch(char **cmdline_p) > > > if (efi_enabled(EFI_BOOT)) > > > efi_init(); > > > > > > - dmi_scan_machine(); > > > - dmi_memdev_walk(); > > > - dmi_set_dump_stack_arch_desc(); > > > + dmi_setup(); > > > > > > /* > > > * VMware detection requires dmi to be available, so this > > > -* needs to be done after dmi_scan_machine(), for the boot CPU. > > > +* needs to be done after dmi_setup(), for the boot CPU. > > > */ > > > init_hypervisor_platform(); > > > > > > diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c > > > index 099d83e4e910..fae2d5c43314 100644 > > > --- a/drivers/firmware/dmi_scan.c > > > +++ b/drivers/firmware/dmi_scan.c > > > @@ -416,11 +416,8 @@ static void __init save_mem_devices(const struct > > > dmi_header *dm, void *v) > > > nr++; > > > } > > > > > > -void __init dmi_memdev_walk(void) > > > +static void __init dmi_memdev_walk(void) > > > { > > > - if (!dmi_available) > > > - return; > > > - > > > if (dmi_walk_early(count_mem_devices) == 0 && dmi_memdev_nr) { > > > dmi_memdev = dmi_alloc(sizeof(*dmi_memdev) * > > > dmi_memdev_nr); > > > if (dmi_memdev) > > > @@ -614,7 +611,7 @@ static int __init dmi_smbios3_present(const u8 *buf) > > > return 1; > > > } > > > > > > -void __init dmi_scan_machine(void) > > > +static void __init dmi_scan_machine(void) > > > { > > > char __iomem *p, *q; > > > char buf[32]; > > > @@ -769,15 +766,20 @@ static int __init
Re: [PATCH v2] efi: Unify dmi setup code over architectures arm/arm64, io64 and x86
On 20.03.19 23:02:09, Ard Biesheuvel wrote: > On Wed, 20 Mar 2019 at 16:23, Robert Richter wrote: > > > > On 20.03.19 14:16:07, Robert Richter wrote: > > > On 20.03.19 13:05:37, Robert Richter wrote: > > > > @@ -167,6 +167,7 @@ static int __init arm_dmi_init(void) > > > > * itself, depends on dmi_scan_machine() having been called already. > > > > */ > > > > dmi_scan_machine(); > > > > + dmi_memdev_walk(); > > > > if (dmi_available) > > > > dmi_set_dump_stack_arch_desc(); > > > > return 0; > > > > > > After > > > > > > [PATCH] efi/arm: Show SMBIOS bank/device location in cper and > > > ghes error logs > > > > > > wents in for arm/arm64, we can unify the code. See patch below. > > > > V2 with the fix in arm_dmi_init() below. > > > > -Robert > > > > > > -- >8 -- > > From: Robert Richter > > Subject: [PATCH v2] efi: Unify dmi setup code over architectures arm/arm64, > > io64 and x86 > > > > All architectures (arm/arm64, io64 and x86) do the same here, so unify > > the code. > > > > Note: We do not need to call dump_stack_set_arch_desc() in case of > > !dmi_available. Both strings, dmi_ids_string and dump_stack_arch_ > > desc_str are initialized zero and thus nothing would change. > > > > I don't understand the last sentence - we do not need to call > dump_stack_set_arch_desc() when !dmi_available, but we do so anyway, > right? Doesn't that wipe the arch description we set based on the DT > machine name? No, in dmi_setup() we exit early when !dmi_available. So for arm/arm64 nothing changed. But for x86 and ia64 we no longer call dump_stack_ set_arch_desc() in this case. This is ok since both strings, dmi_ids_string and dump_stack_arch_desc_str, are initialized zero and copying one to the other does not change anything. -Robert > > > Signed-off-by: Robert Richter > > --- > > arch/ia64/kernel/setup.c | 4 +--- > > arch/x86/kernel/setup.c| 6 ++ > > drivers/firmware/dmi_scan.c| 28 +++- > > drivers/firmware/efi/arm-runtime.c | 7 ++- > > include/linux/dmi.h| 8 ++-- > > 5 files changed, 22 insertions(+), 31 deletions(-) > > > > diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c > > index 583a3746d70b..c9cfa760cd57 100644 > > --- a/arch/ia64/kernel/setup.c > > +++ b/arch/ia64/kernel/setup.c > > @@ -1058,9 +1058,7 @@ check_bugs (void) > > > > static int __init run_dmi_scan(void) > > { > > - dmi_scan_machine(); > > - dmi_memdev_walk(); > > - dmi_set_dump_stack_arch_desc(); > > + dmi_setup(); > > return 0; > > } > > core_initcall(run_dmi_scan); > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > > index 3d872a527cd9..3773905cd2c1 100644 > > --- a/arch/x86/kernel/setup.c > > +++ b/arch/x86/kernel/setup.c > > @@ -1005,13 +1005,11 @@ void __init setup_arch(char **cmdline_p) > > if (efi_enabled(EFI_BOOT)) > > efi_init(); > > > > - dmi_scan_machine(); > > - dmi_memdev_walk(); > > - dmi_set_dump_stack_arch_desc(); > > + dmi_setup(); > > > > /* > > * VMware detection requires dmi to be available, so this > > -* needs to be done after dmi_scan_machine(), for the boot CPU. > > +* needs to be done after dmi_setup(), for the boot CPU. > > */ > > init_hypervisor_platform(); > > > > diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c > > index 099d83e4e910..fae2d5c43314 100644 > > --- a/drivers/firmware/dmi_scan.c > > +++ b/drivers/firmware/dmi_scan.c > > @@ -416,11 +416,8 @@ static void __init save_mem_devices(const struct > > dmi_header *dm, void *v) > > nr++; > > } > > > > -void __init dmi_memdev_walk(void) > > +static void __init dmi_memdev_walk(void) > > { > > - if (!dmi_available) > > - return; > > - > > if (dmi_walk_early(count_mem_devices) == 0 && dmi_memdev_nr) { > > dmi_memdev = dmi_alloc(sizeof(*dmi_memdev) * dmi_memdev_nr); > > if (dmi_memdev) > > @@ -614,7 +611,7 @@ static int __init dmi_smbios3_present(const u8 *buf) > > return 1; > > } > > > > -void __init dmi_scan_machine(void) > > +static void __init dmi_scan_machine(void) > > { > > char __iomem *p, *q; > > char buf[32]; > > @@ -769,15 +766,20 @@ static int __init dmi_init(void) > > subsys_initcall(dmi_init); > > > > /** > > - * dmi_set_dump_stack_arch_desc - set arch description for dump_stack() > > + * dmi_setup - scan and setup DMI system information > > * > > - * Invoke dump_stack_set_arch_desc() with DMI system information so that > > - * DMI identifiers are printed out on task dumps. Arch boot code should > > - * call this function after dmi_scan_machine() if it wants to print out DMI > > - * identifiers on task dumps. > > + * Scan the DMI system information. This setups DMI identifiers > > + * (dmi_system_id) for printing it out on
Re: [PATCH v2] efi: Unify dmi setup code over architectures arm/arm64, io64 and x86
On Wed, 20 Mar 2019 at 16:23, Robert Richter wrote: > > On 20.03.19 14:16:07, Robert Richter wrote: > > On 20.03.19 13:05:37, Robert Richter wrote: > > > @@ -167,6 +167,7 @@ static int __init arm_dmi_init(void) > > > * itself, depends on dmi_scan_machine() having been called already. > > > */ > > > dmi_scan_machine(); > > > + dmi_memdev_walk(); > > > if (dmi_available) > > > dmi_set_dump_stack_arch_desc(); > > > return 0; > > > > After > > > > [PATCH] efi/arm: Show SMBIOS bank/device location in cper and > > ghes error logs > > > > wents in for arm/arm64, we can unify the code. See patch below. > > V2 with the fix in arm_dmi_init() below. > > -Robert > > > -- >8 -- > From: Robert Richter > Subject: [PATCH v2] efi: Unify dmi setup code over architectures arm/arm64, > io64 and x86 > > All architectures (arm/arm64, io64 and x86) do the same here, so unify > the code. > > Note: We do not need to call dump_stack_set_arch_desc() in case of > !dmi_available. Both strings, dmi_ids_string and dump_stack_arch_ > desc_str are initialized zero and thus nothing would change. > I don't understand the last sentence - we do not need to call dump_stack_set_arch_desc() when !dmi_available, but we do so anyway, right? Doesn't that wipe the arch description we set based on the DT machine name? > Signed-off-by: Robert Richter > --- > arch/ia64/kernel/setup.c | 4 +--- > arch/x86/kernel/setup.c| 6 ++ > drivers/firmware/dmi_scan.c| 28 +++- > drivers/firmware/efi/arm-runtime.c | 7 ++- > include/linux/dmi.h| 8 ++-- > 5 files changed, 22 insertions(+), 31 deletions(-) > > diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c > index 583a3746d70b..c9cfa760cd57 100644 > --- a/arch/ia64/kernel/setup.c > +++ b/arch/ia64/kernel/setup.c > @@ -1058,9 +1058,7 @@ check_bugs (void) > > static int __init run_dmi_scan(void) > { > - dmi_scan_machine(); > - dmi_memdev_walk(); > - dmi_set_dump_stack_arch_desc(); > + dmi_setup(); > return 0; > } > core_initcall(run_dmi_scan); > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > index 3d872a527cd9..3773905cd2c1 100644 > --- a/arch/x86/kernel/setup.c > +++ b/arch/x86/kernel/setup.c > @@ -1005,13 +1005,11 @@ void __init setup_arch(char **cmdline_p) > if (efi_enabled(EFI_BOOT)) > efi_init(); > > - dmi_scan_machine(); > - dmi_memdev_walk(); > - dmi_set_dump_stack_arch_desc(); > + dmi_setup(); > > /* > * VMware detection requires dmi to be available, so this > -* needs to be done after dmi_scan_machine(), for the boot CPU. > +* needs to be done after dmi_setup(), for the boot CPU. > */ > init_hypervisor_platform(); > > diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c > index 099d83e4e910..fae2d5c43314 100644 > --- a/drivers/firmware/dmi_scan.c > +++ b/drivers/firmware/dmi_scan.c > @@ -416,11 +416,8 @@ static void __init save_mem_devices(const struct > dmi_header *dm, void *v) > nr++; > } > > -void __init dmi_memdev_walk(void) > +static void __init dmi_memdev_walk(void) > { > - if (!dmi_available) > - return; > - > if (dmi_walk_early(count_mem_devices) == 0 && dmi_memdev_nr) { > dmi_memdev = dmi_alloc(sizeof(*dmi_memdev) * dmi_memdev_nr); > if (dmi_memdev) > @@ -614,7 +611,7 @@ static int __init dmi_smbios3_present(const u8 *buf) > return 1; > } > > -void __init dmi_scan_machine(void) > +static void __init dmi_scan_machine(void) > { > char __iomem *p, *q; > char buf[32]; > @@ -769,15 +766,20 @@ static int __init dmi_init(void) > subsys_initcall(dmi_init); > > /** > - * dmi_set_dump_stack_arch_desc - set arch description for dump_stack() > + * dmi_setup - scan and setup DMI system information > * > - * Invoke dump_stack_set_arch_desc() with DMI system information so that > - * DMI identifiers are printed out on task dumps. Arch boot code should > - * call this function after dmi_scan_machine() if it wants to print out DMI > - * identifiers on task dumps. > + * Scan the DMI system information. This setups DMI identifiers > + * (dmi_system_id) for printing it out on task dumps and prepares > + * DIMM entry information (dmi_memdev_info) from the SMBIOS table > + * for using this when reporting memory errors. > */ > -void __init dmi_set_dump_stack_arch_desc(void) > +void __init dmi_setup(void) > { > + dmi_scan_machine(); > + if (!dmi_available) > + return; > + > + dmi_memdev_walk(); > dump_stack_set_arch_desc("%s", dmi_ids_string); > } > > @@ -841,7 +843,7 @@ static bool dmi_is_end_of_table(const struct > dmi_system_id *dmi) > * returns non zero or we hit the end. Callback function is called for > * each successful match.