Skip to contentSkip to conversation

hvmloader: add fields for SMBIOS 2.4 compliance

PATCH Superseded Roger Pau Monne 3 participants 5 messages Aug 22, 2017 – Aug 23, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hvmloader: add fields for SMBIOS 2.4 compliance

The version of SMBIOS set in the entry point is 2.4, however several structures are missing fields required by 2.4. Fix this by adding the missing fields, this is based on the documents found at the DMTF site [0].

Most fields are set to 0 (undefined/not specified), except for the cache related handlers that need to be initialized to 0xffff in order to signal that the information is not provided.

[0] https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.1.1.pdf

Reported by: Chris Gilbert <[email protected]>
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Chris Gilbert <[email protected]>
---
It seems like the code in smbios likes to initialize everything to 0, but I don't see the value in that since the struct is already memset to 0.

---
 tools/firmware/hvmloader/smbios.c       |  3 +++
 tools/firmware/hvmloader/smbios_types.h | 16 ++++++++++++++++
 2 files changed, 19 insertions(+)
tools/firmware/hvmloader/smbios.c +3 -0
index 210c7b0d35..2c1da7b38e 100644
@@ -608,6 +608,9 @@ smbios_type_4_init(
 
     p->status = 0x41; /* socket populated, CPU enabled */
     p->upgrade = 0x01; /* other */
+    p->l1_cache_handle = 0xffff; /* No cache information structure provided. */
+    p->l2_cache_handle = 0xffff; /* No cache information structure provided. */
+    p->l3_cache_handle = 0xffff; /* No cache information structure provided. */
 
     start += sizeof(struct smbios_type_4);
 
tools/firmware/hvmloader/smbios_types.h +16 -0
index e924f819b3..2bf1645bfa 100644
@@ -104,6 +104,11 @@ struct smbios_type_3 {
     uint8_t power_supply_state;
     uint8_t thermal_state;
     uint8_t security_status;
+    uint32_t oem_specific;
+    uint8_t height;
+    uint8_t number_of_power_cords;
+    uint8_t contained_element_count;
+    uint8_t contained_element_length;
 } __attribute__ ((packed));
 
 /* SMBIOS type 4 - Processor Information */
@@ -121,6 +126,12 @@ struct smbios_type_4 {
     uint16_t current_speed;
     uint8_t status;
     uint8_t upgrade;
+    uint16_t l1_cache_handle;
+    uint16_t l2_cache_handle;
+    uint16_t l3_cache_handle;
+    uint8_t serial_number_str;
+    uint8_t asset_tag_str;
+    uint8_t part_number_str;
 } __attribute__ ((packed));
 
 /* SMBIOS type 11 - OEM Strings */
@@ -158,6 +169,11 @@ struct smbios_type_17 {
     uint8_t bank_locator_str;
     uint8_t memory_type;
     uint16_t type_detail;
+    uint16_t speed;
+    uint8_t manufacturer_str;
+    uint8_t serial_number_str;
+    uint8_t asset_tag_str;
+    uint8_t part_number_str;
 } __attribute__ ((packed));
 
 /* SMBIOS type 19 - Memory Array Mapped Address */
Signature · 7 lines
2.11.0 (Apple Git-81)


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

On Tue, Aug 22, 2017 at 01:50:23PM +0100, Roger Pau Monne wrote:
[...]

tools/firmware/hvmloader/smbios_types.h struct smbios_type_3 { · line 111

Quoted 13 lines
tools/firmware/hvmloader/smbios_types.h +5 -0
index e924f819b3..2bf1645bfa 100644
@@ -104,6 +104,11 @@ struct smbios_type_3 {
     uint8_t power_supply_state;
     uint8_t thermal_state;
     uint8_t security_status;
+    uint32_t oem_specific;
+    uint8_t height;
+    uint8_t number_of_power_cords;
+    uint8_t contained_element_count;
+    uint8_t contained_element_length;

Missing contained_elements ?

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 17 lines · Wei Liu

On Tue, Aug 22, 2017 at 01:50:23PM +0100, Roger Pau Monne wrote:
[...]

tools/firmware/hvmloader/smbios_types.h struct smbios_type_3 { · line 111

Quoted 13 lines
tools/firmware/hvmloader/smbios_types.h +5 -0
index e924f819b3..2bf1645bfa 100644
@@ -104,6 +104,11 @@ struct smbios_type_3 {
     uint8_t power_supply_state;
     uint8_t thermal_state;
     uint8_t security_status;
+    uint32_t oem_specific;
+    uint8_t height;
+    uint8_t number_of_power_cords;
+    uint8_t contained_element_count;
+    uint8_t contained_element_length;

Missing contained_elements ?

contained_element_count is 0, so I don't think it's strictly needed. If you think it's required I can represent it as an empty array ([0]).

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 19 lines · Roger Pau Monne
Quoted 17 lines · Wei Liu

On Tue, Aug 22, 2017 at 01:50:23PM +0100, Roger Pau Monne wrote:
[...]

tools/firmware/hvmloader/smbios_types.h struct smbios_type_3 { · line 111

Quoted 13 lines
tools/firmware/hvmloader/smbios_types.h +5 -0
index e924f819b3..2bf1645bfa 100644
@@ -104,6 +104,11 @@ struct smbios_type_3 {
     uint8_t power_supply_state;
     uint8_t thermal_state;
     uint8_t security_status;
+    uint32_t oem_specific;
+    uint8_t height;
+    uint8_t number_of_power_cords;
+    uint8_t contained_element_count;
+    uint8_t contained_element_length;

Missing contained_elements ?

Quoted 3 lines

contained_element_count is 0, so I don't think it's strictly needed. If you think it's required I can represent it as an empty array ([0]).

I think that would be better but it is up to Jan and Andrew to decide.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 22 lines
Quoted 1 line
Quoted 1 line · On 23.08.17 at 13:59, <[email protected]> wrote:
Quoted 4 lines · Roger Pau Monne
Quoted 3 lines · Wei Liu

On Tue, Aug 22, 2017 at 01:50:23PM +0100, Roger Pau Monne wrote:
[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/tools/firmware/hvmloader/smbios_types.h

Quoted 15 lines
Quoted 14 lines

tools/firmware/hvmloader/smbios_types.h struct smbios_type_3 { · line 111

Quoted 12 lines

index e924f819b3..2bf1645bfa 100644

tools/firmware/hvmloader/smbios_types.h +5 -0
@@ -104,6 +104,11 @@ struct smbios_type_3 {
     uint8_t power_supply_state;
     uint8_t thermal_state;
     uint8_t security_status;
+    uint32_t oem_specific;
+    uint8_t height;
+    uint8_t number_of_power_cords;
+    uint8_t contained_element_count;
+    uint8_t contained_element_length;

Missing contained_elements ?

Quoted 5 lines
Quoted 3 lines

contained_element_count is 0, so I don't think it's strictly needed. If you think it's required I can represent it as an empty array ([0]).

I think that would be better but it is up to Jan and Andrew to decide.

Yes, I agree (but [] please, i.e. without the zero).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel