57 lines
2.0 KiB
Diff
57 lines
2.0 KiB
Diff
|
|
From 937e22eda2480a64095928ee8df0d37b3313bb64 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Ying Fang <fangying1@huawei.com>
|
||
|
|
Date: Tue, 14 Apr 2020 14:53:44 +0800
|
||
|
|
Subject: [PATCH] smbios: Add missing member of type 4 for smbios 3.0
|
||
|
|
|
||
|
|
According to smbios 3.0 spec, for processor information (type 4),
|
||
|
|
it adds three new members (Core Count 2, Core enabled 2, thread count 2) for 3.0, Without this three members, we can not get correct cpu frequency from dmi,
|
||
|
|
Because it will failed to check the length of Processor Infomation in DMI.
|
||
|
|
|
||
|
|
The corresponding codes in kernel is like:
|
||
|
|
if (dm->type == DMI_ENTRY_PROCESSOR &&
|
||
|
|
dm->length >= DMI_ENTRY_PROCESSOR_MIN_LENGTH) {
|
||
|
|
u16 val = (u16)get_unaligned((const u16 *)
|
||
|
|
(dmi_data + DMI_PROCESSOR_MAX_SPEED));
|
||
|
|
*mhz = val > *mhz ? val : *mhz;
|
||
|
|
}
|
||
|
|
|
||
|
|
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
|
||
|
|
Signed-off-by: Yan Wang <wangyan122@huawei.com>
|
||
|
|
---
|
||
|
|
hw/smbios/smbios.c | 4 +++-
|
||
|
|
include/hw/firmware/smbios.h | 3 +++
|
||
|
|
2 files changed, 6 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
|
||
|
|
index 7397e56737..66be9aee09 100644
|
||
|
|
--- a/hw/smbios/smbios.c
|
||
|
|
+++ b/hw/smbios/smbios.c
|
||
|
|
@@ -688,7 +688,9 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
|
||
|
|
t->thread_count = ms->smp.threads;
|
||
|
|
t->processor_characteristics = cpu_to_le16(0x02); /* Unknown */
|
||
|
|
t->processor_family2 = cpu_to_le16(0x01); /* Other */
|
||
|
|
-
|
||
|
|
+ t->corecount2 = 0;
|
||
|
|
+ t->enabledcorecount2 = 0;
|
||
|
|
+ t->threadcount2 = 0;
|
||
|
|
SMBIOS_BUILD_TABLE_POST;
|
||
|
|
smbios_type4_count++;
|
||
|
|
}
|
||
|
|
diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
|
||
|
|
index 5a0dd0c8cf..5a696cf75a 100644
|
||
|
|
--- a/include/hw/firmware/smbios.h
|
||
|
|
+++ b/include/hw/firmware/smbios.h
|
||
|
|
@@ -193,6 +193,9 @@ struct smbios_type_4 {
|
||
|
|
uint8_t thread_count;
|
||
|
|
uint16_t processor_characteristics;
|
||
|
|
uint16_t processor_family2;
|
||
|
|
+ uint16_t corecount2;
|
||
|
|
+ uint16_t enabledcorecount2;
|
||
|
|
+ uint16_t threadcount2;
|
||
|
|
} QEMU_PACKED;
|
||
|
|
|
||
|
|
/* SMBIOS type 11 - OEM strings */
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|