diff mbox

hvmloader: add fields for SMBIOS 2.4 compliance

Message ID 20170822125023.70960-1-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monne Aug. 22, 2017, 12:50 p.m. UTC
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

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reported by: Chris Gilbert <chris.gilbert@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Chris Gilbert <chris.gilbert@citrix.com>
---
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(+)

Comments

Wei Liu Aug. 23, 2017, 10:51 a.m. UTC | #1
On Tue, Aug 22, 2017 at 01:50:23PM +0100, Roger Pau Monne wrote:
[...]
> diff --git a/tools/firmware/hvmloader/smbios_types.h b/tools/firmware/hvmloader/smbios_types.h
> index e924f819b3..2bf1645bfa 100644
> --- a/tools/firmware/hvmloader/smbios_types.h
> +++ b/tools/firmware/hvmloader/smbios_types.h
> @@ -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 ?
Roger Pau Monne Aug. 23, 2017, 11:52 a.m. UTC | #2
On Wed, Aug 23, 2017 at 11:51:49AM +0100, Wei Liu wrote:
> On Tue, Aug 22, 2017 at 01:50:23PM +0100, Roger Pau Monne wrote:
> [...]
> > diff --git a/tools/firmware/hvmloader/smbios_types.h b/tools/firmware/hvmloader/smbios_types.h
> > index e924f819b3..2bf1645bfa 100644
> > --- a/tools/firmware/hvmloader/smbios_types.h
> > +++ b/tools/firmware/hvmloader/smbios_types.h
> > @@ -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.
Wei Liu Aug. 23, 2017, 11:59 a.m. UTC | #3
On Wed, Aug 23, 2017 at 12:52:49PM +0100, Roger Pau Monne wrote:
> On Wed, Aug 23, 2017 at 11:51:49AM +0100, Wei Liu wrote:
> > On Tue, Aug 22, 2017 at 01:50:23PM +0100, Roger Pau Monne wrote:
> > [...]
> > > diff --git a/tools/firmware/hvmloader/smbios_types.h b/tools/firmware/hvmloader/smbios_types.h
> > > index e924f819b3..2bf1645bfa 100644
> > > --- a/tools/firmware/hvmloader/smbios_types.h
> > > +++ b/tools/firmware/hvmloader/smbios_types.h
> > > @@ -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]).
> 

I think that would be better but it is up to Jan and Andrew to decide.
Jan Beulich Aug. 23, 2017, 12:15 p.m. UTC | #4
>>> On 23.08.17 at 13:59, <wei.liu2@citrix.com> wrote:
> On Wed, Aug 23, 2017 at 12:52:49PM +0100, Roger Pau Monne wrote:
>> On Wed, Aug 23, 2017 at 11:51:49AM +0100, Wei Liu wrote:
>> > On Tue, Aug 22, 2017 at 01:50:23PM +0100, Roger Pau Monne wrote:
>> > [...]
>> > > diff --git a/tools/firmware/hvmloader/smbios_types.h 
> b/tools/firmware/hvmloader/smbios_types.h
>> > > index e924f819b3..2bf1645bfa 100644
>> > > --- a/tools/firmware/hvmloader/smbios_types.h
>> > > +++ b/tools/firmware/hvmloader/smbios_types.h
>> > > @@ -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]).
>> 
> 
> 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
diff mbox

Patch

diff --git a/tools/firmware/hvmloader/smbios.c b/tools/firmware/hvmloader/smbios.c
index 210c7b0d35..2c1da7b38e 100644
--- a/tools/firmware/hvmloader/smbios.c
+++ b/tools/firmware/hvmloader/smbios.c
@@ -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);
 
diff --git a/tools/firmware/hvmloader/smbios_types.h b/tools/firmware/hvmloader/smbios_types.h
index e924f819b3..2bf1645bfa 100644
--- a/tools/firmware/hvmloader/smbios_types.h
+++ b/tools/firmware/hvmloader/smbios_types.h
@@ -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 */