u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] smbios: riscv: set correct SMBIOS processor family value
@ 2023-12-28  7:30 Heinrich Schuchardt
  2023-12-28  7:30 ` [PATCH 1/2] smbios: enable setting processor family > 0xff Heinrich Schuchardt
  2023-12-28  7:30 ` [PATCH 2/2] cpu: riscv: set correct SMBIOS processor family value Heinrich Schuchardt
  0 siblings, 2 replies; 5+ messages in thread
From: Heinrich Schuchardt @ 2023-12-28  7:30 UTC (permalink / raw)
  To: Simon Glass; +Cc: Rick Chen, Leo, Ilias Apalodimas, u-boot, Heinrich Schuchardt

Many value of processor type exceed 0xff and have to be stored as u16
value. In the type 4 table set processor_family = 0xfe signaling that
field processor_family2 is used and write the actual value into the
processor_family2 field.

The values for RISC-V are:

* 0x200 for 32-bit
* 0x201 for 64-bit

With this series dmidecode shows

    Handle 0x0004, DMI type 4, 48 bytes
    Processor Information
	Socket Designation: Not Specified
	Type: Central Processor
	Family: RV64

for qemu-riscv64_smode_defconfig.

Heinrich Schuchardt (2):
  smbios: enable setting processor family > 0xff
  cpu: riscv: set correct SMBIOS processor family value

 drivers/cpu/riscv_cpu.c | 4 ++++
 lib/smbios.c            | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

-- 
2.43.0


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

* [PATCH 1/2] smbios: enable setting processor family > 0xff
  2023-12-28  7:30 [PATCH 0/2] smbios: riscv: set correct SMBIOS processor family value Heinrich Schuchardt
@ 2023-12-28  7:30 ` Heinrich Schuchardt
  2023-12-28 13:37   ` Simon Glass
  2023-12-28  7:30 ` [PATCH 2/2] cpu: riscv: set correct SMBIOS processor family value Heinrich Schuchardt
  1 sibling, 1 reply; 5+ messages in thread
From: Heinrich Schuchardt @ 2023-12-28  7:30 UTC (permalink / raw)
  To: Simon Glass; +Cc: Rick Chen, Leo, Ilias Apalodimas, u-boot, Heinrich Schuchardt

Many value of processor type exceed 0xff and have to be stored as u16
value. In the type 4 table set processor_family = 0xfe signaling that
field processor_family2 is used and write the actual value into the
processor_family2 field.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 lib/smbios.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/smbios.c b/lib/smbios.c
index 45480b01af..550b2471f9 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -467,7 +467,8 @@ static void smbios_write_type4_dm(struct smbios_type4 *t,
 	}
 #endif
 
-	t->processor_family = processor_family;
+	t->processor_family = 0xfe;
+	t->processor_family2 = processor_family;
 	t->processor_manufacturer = smbios_add_prop(ctx, NULL, vendor);
 	t->processor_version = smbios_add_prop(ctx, NULL, name);
 }
@@ -489,7 +490,6 @@ static int smbios_write_type4(ulong *current, int handle,
 	t->l1_cache_handle = 0xffff;
 	t->l2_cache_handle = 0xffff;
 	t->l3_cache_handle = 0xffff;
-	t->processor_family2 = t->processor_family;
 
 	len = t->length + smbios_string_table_len(ctx);
 	*current += len;
-- 
2.43.0


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

* [PATCH 2/2] cpu: riscv: set correct SMBIOS processor family value
  2023-12-28  7:30 [PATCH 0/2] smbios: riscv: set correct SMBIOS processor family value Heinrich Schuchardt
  2023-12-28  7:30 ` [PATCH 1/2] smbios: enable setting processor family > 0xff Heinrich Schuchardt
@ 2023-12-28  7:30 ` Heinrich Schuchardt
  1 sibling, 0 replies; 5+ messages in thread
From: Heinrich Schuchardt @ 2023-12-28  7:30 UTC (permalink / raw)
  To: Simon Glass; +Cc: Rick Chen, Leo, Ilias Apalodimas, u-boot, Heinrich Schuchardt

The SMBIOS specification requires to set the processor family in the type 4
(Processor Information) table to specific values depending only on the
bitness of the system (0x200 for RV32 and 0x201 for RV64).

With this patch dmidecode shows

    Handle 0x0004, DMI type 4, 48 bytes
    Processor Information
	Socket Designation: Not Specified
	Type: Central Processor
	Family: RV64

for qemu-riscv64_smode_defconfig.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 drivers/cpu/riscv_cpu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/cpu/riscv_cpu.c b/drivers/cpu/riscv_cpu.c
index d6484d7f4b..034b9b49c0 100644
--- a/drivers/cpu/riscv_cpu.c
+++ b/drivers/cpu/riscv_cpu.c
@@ -98,6 +98,10 @@ static int riscv_cpu_bind(struct udevice *dev)
 
 	/* save the hart id */
 	plat->cpu_id = dev_read_addr(dev);
+	if (IS_ENABLED(CONFIG_64BIT))
+		plat->family = 0x201;
+	else
+		plat->family = 0x200;
 	/* first examine the property in current cpu node */
 	ret = dev_read_u32(dev, "timebase-frequency", &plat->timebase_freq);
 	/* if not found, then look at the parent /cpus node */
-- 
2.43.0


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

* Re: [PATCH 1/2] smbios: enable setting processor family > 0xff
  2023-12-28  7:30 ` [PATCH 1/2] smbios: enable setting processor family > 0xff Heinrich Schuchardt
@ 2023-12-28 13:37   ` Simon Glass
  2023-12-29 11:18     ` Heinrich Schuchardt
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Glass @ 2023-12-28 13:37 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Rick Chen, Leo, Ilias Apalodimas, u-boot

Hi Heinrich,

On Thu, Dec 28, 2023 at 7:30 AM Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Many value of processor type exceed 0xff and have to be stored as u16
> value. In the type 4 table set processor_family = 0xfe signaling that
> field processor_family2 is used and write the actual value into the
> processor_family2 field.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  lib/smbios.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

> diff --git a/lib/smbios.c b/lib/smbios.c
> index 45480b01af..550b2471f9 100644
> --- a/lib/smbios.c
> +++ b/lib/smbios.c
> @@ -467,7 +467,8 @@ static void smbios_write_type4_dm(struct smbios_type4 *t,
>         }
>  #endif
>
> -       t->processor_family = processor_family;
> +       t->processor_family = 0xfe;
> +       t->processor_family2 = processor_family;

Why not use 'family' if it fits?

>         t->processor_manufacturer = smbios_add_prop(ctx, NULL, vendor);
>         t->processor_version = smbios_add_prop(ctx, NULL, name);
>  }
> @@ -489,7 +490,6 @@ static int smbios_write_type4(ulong *current, int handle,
>         t->l1_cache_handle = 0xffff;
>         t->l2_cache_handle = 0xffff;
>         t->l3_cache_handle = 0xffff;
> -       t->processor_family2 = t->processor_family;
>
>         len = t->length + smbios_string_table_len(ctx);
>         *current += len;
> --
> 2.43.0
>

Regards,
Simon

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

* Re: [PATCH 1/2] smbios: enable setting processor family > 0xff
  2023-12-28 13:37   ` Simon Glass
@ 2023-12-29 11:18     ` Heinrich Schuchardt
  0 siblings, 0 replies; 5+ messages in thread
From: Heinrich Schuchardt @ 2023-12-29 11:18 UTC (permalink / raw)
  To: Simon Glass; +Cc: Rick Chen, Leo, Ilias Apalodimas, u-boot

On 12/28/23 14:37, Simon Glass wrote:
> Hi Heinrich,
> 
> On Thu, Dec 28, 2023 at 7:30 AM Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>> Many value of processor type exceed 0xff and have to be stored as u16
>> value. In the type 4 table set processor_family = 0xfe signaling that
>> field processor_family2 is used and write the actual value into the
>> processor_family2 field.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
>> ---
>>   lib/smbios.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
>> diff --git a/lib/smbios.c b/lib/smbios.c
>> index 45480b01af..550b2471f9 100644
>> --- a/lib/smbios.c
>> +++ b/lib/smbios.c
>> @@ -467,7 +467,8 @@ static void smbios_write_type4_dm(struct smbios_type4 *t,
>>          }
>>   #endif
>>
>> -       t->processor_family = processor_family;
>> +       t->processor_family = 0xfe;
>> +       t->processor_family2 = processor_family;
> 
> Why not use 'family' if it fits?

Using family for values less then 0x100 is allowable.
But there would be no benefit in making our code more complicated.

Best regards

Heinrich

> 
>>          t->processor_manufacturer = smbios_add_prop(ctx, NULL, vendor);
>>          t->processor_version = smbios_add_prop(ctx, NULL, name);
>>   }
>> @@ -489,7 +490,6 @@ static int smbios_write_type4(ulong *current, int handle,
>>          t->l1_cache_handle = 0xffff;
>>          t->l2_cache_handle = 0xffff;
>>          t->l3_cache_handle = 0xffff;
>> -       t->processor_family2 = t->processor_family;
>>
>>          len = t->length + smbios_string_table_len(ctx);
>>          *current += len;
>> --
>> 2.43.0
>>
> 
> Regards,
> Simon


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

end of thread, other threads:[~2023-12-29 11:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-28  7:30 [PATCH 0/2] smbios: riscv: set correct SMBIOS processor family value Heinrich Schuchardt
2023-12-28  7:30 ` [PATCH 1/2] smbios: enable setting processor family > 0xff Heinrich Schuchardt
2023-12-28 13:37   ` Simon Glass
2023-12-29 11:18     ` Heinrich Schuchardt
2023-12-28  7:30 ` [PATCH 2/2] cpu: riscv: set correct SMBIOS processor family value Heinrich Schuchardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).