hvmloader: allow overriding SMBIOS type 2 info
PATCH 1/1 hvmloader: allow overriding SMBIOS type 2 info
Extend smbios type 2 struct to match specification, add support to override strings from toolstack.
---
CC: Igor Druzhinin <[email protected]>
CC: Sergey Dyasli <[email protected]>
CC: Andrew Cooper <[email protected]>
--- tools/firmware/hvmloader/smbios.c | 64 ++++++++++++++++++++++++- tools/firmware/hvmloader/smbios_types.h | 6 +++ xen/include/public/hvm/hvm_xs_strings.h | 30 +++++++----- 3 files changed, 87 insertions(+), 13 deletions(-)
tools/firmware/hvmloader/smbios.c +63 -1
@@ -497,9 +497,11 @@ static void * smbios_type_2_init(void *start) {struct smbios_type_2 *p = (struct smbios_type_2 *)start; +const char *s;uint8_t *ptr;void *pts;uint32_t length; +uint32_t counter =0 ; pts =get_smbios_pt_struct (2 , &length);if ( (pts !=NULL )&&(length >0 ) )
@@ -518,7 +520,67 @@ smbios_type_2_init(void *start)return (start + length); } -/* Only present when passed in */ + s =xenstore_read (HVM_XS_BASEBOARD_MANUFACTURER ,NULL ); +if ( (s !=NULL ) && (*s !='\0' ) ) + { +memset (p,0 ,sizeof (*p)); + p->header.type =2 ; + p->header.length =sizeof (struct smbios_type_2 ); + p->header.handle =SMBIOS_HANDLE_TYPE2 ; + p->feature_flags =0x09 ;/* Board is a hosting board and replaceable */ + p->chassis_handle =SMBIOS_HANDLE_TYPE3 ; + p->board_type =0x0a ;/* Motherboard */ + start +=sizeof (struct smbios_type_2 ); + +strcpy ((char *)start, s); + start +=strlen (s) +1 ; + p->manufacturer_str = ++counter; + + s =xenstore_read (HVM_XS_BASEBOARD_PRODUCT_NAME ,NULL ); +if ( (s !=NULL ) && (*s !='\0' ) ) + { +strcpy ((char *)start, s); + start +=strlen (s) +1 ; + p->product_name_str = ++counter; + } + + s =xenstore_read (HVM_XS_BASEBOARD_VERSION ,NULL ); +if ( (s !=NULL ) && (*s !='\0' ) ) + { +strcpy ((char *)start, s); + start +=strlen (s) +1 ; + p->version_str = ++counter; + } + + s =xenstore_read (HVM_XS_BASEBOARD_SERIAL_NUMBER ,NULL ); +if ( (s !=NULL ) && (*s !='\0' ) ) + { +strcpy ((char *)start, s); + start +=strlen (s) +1 ; + p->serial_number_str = ++counter; + } + + s =xenstore_read (HVM_XS_BASEBOARD_ASSET_TAG ,NULL ); +if ( (s !=NULL ) && (*s !='\0' ) ) + { +strcpy ((char *)start, s); + start +=strlen (s) +1 ; + p->asset_tag_str = ++counter; + } + + s =xenstore_read (HVM_XS_BASEBOARD_LOCATION_IN_CHASSIS ,NULL ); +if ( (s !=NULL ) && (*s !='\0' ) ) + { +strcpy ((char *)start, s); + start +=strlen (s) +1 ; + p->location_in_chassis_str = ++counter; + } + + *((uint8_t *)start) =0 ; +return start +1 ; + } + +/* Only present when passed in or overriden */ return start; }
tools/firmware/hvmloader/smbios_types.h +6 -0
@@ -90,6 +90,12 @@ struct smbios_type_2 {uint8_t product_name_str;uint8_t version_str;uint8_t serial_number_str; +uint8_t asset_tag_str; +uint8_t feature_flags; +uint8_t location_in_chassis_str; +uint16_t chassis_handle; +uint8_t board_type; +uint8_t contained_handle_count; } __attribute__ ((packed));/* System Enclosure - Contained Elements */
xen/include/public/hvm/hvm_xs_strings.h +18 -12
@@ -62,18 +62,24 @@/* The following xenstore values are used to override some of the default * string values in the SMBIOS table constructed in hvmloader. */ -#define HVM_XS_BIOS_STRINGS "bios-strings" -#define HVM_XS_BIOS_VENDOR "bios-strings/bios-vendor" -#define HVM_XS_BIOS_VERSION "bios-strings/bios-version" -#define HVM_XS_SYSTEM_MANUFACTURER "bios-strings/system-manufacturer" -#define HVM_XS_SYSTEM_PRODUCT_NAME "bios-strings/system-product-name" -#define HVM_XS_SYSTEM_VERSION "bios-strings/system-version" -#define HVM_XS_SYSTEM_SERIAL_NUMBER "bios-strings/system-serial-number" -#define HVM_XS_ENCLOSURE_MANUFACTURER "bios-strings/enclosure-manufacturer" -#define HVM_XS_ENCLOSURE_SERIAL_NUMBER "bios-strings/enclosure-serial-number" -#define HVM_XS_ENCLOSURE_ASSET_TAG "bios-strings/enclosure-asset-tag" -#define HVM_XS_BATTERY_MANUFACTURER "bios-strings/battery-manufacturer" -#define HVM_XS_BATTERY_DEVICE_NAME "bios-strings/battery-device-name" +#define HVM_XS_BIOS_STRINGS "bios-strings" +#define HVM_XS_BIOS_VENDOR "bios-strings/bios-vendor" +#define HVM_XS_BIOS_VERSION "bios-strings/bios-version" +#define HVM_XS_SYSTEM_MANUFACTURER "bios-strings/system-manufacturer" +#define HVM_XS_SYSTEM_PRODUCT_NAME "bios-strings/system-product-name" +#define HVM_XS_SYSTEM_VERSION "bios-strings/system-version" +#define HVM_XS_SYSTEM_SERIAL_NUMBER "bios-strings/system-serial-number" +#define HVM_XS_BASEBOARD_MANUFACTURER "bios-strings/baseboard-manufacturer" +#define HVM_XS_BASEBOARD_PRODUCT_NAME "bios-strings/baseboard-product-name" +#define HVM_XS_BASEBOARD_VERSION "bios-strings/baseboard-version" +#define HVM_XS_BASEBOARD_SERIAL_NUMBER "bios-strings/baseboard-serial-number" +#define HVM_XS_BASEBOARD_ASSET_TAG "bios-strings/baseboard-asset-tag" +#define HVM_XS_BASEBOARD_LOCATION_IN_CHASSIS "bios-strings/baseboard-location-in-chassis" +#define HVM_XS_ENCLOSURE_MANUFACTURER "bios-strings/enclosure-manufacturer" +#define HVM_XS_ENCLOSURE_SERIAL_NUMBER "bios-strings/enclosure-serial-number" +#define HVM_XS_ENCLOSURE_ASSET_TAG "bios-strings/enclosure-asset-tag" +#define HVM_XS_BATTERY_MANUFACTURER "bios-strings/battery-manufacturer" +#define HVM_XS_BATTERY_DEVICE_NAME "bios-strings/battery-device-name"/* 1 to 99 OEM strings can be set in xenstore using values of the form * below. These strings will be loaded into the SMBIOS type 11 structure.
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 26.03.19 at 07:45, <[email protected]> wrote:
Extend smbios type 2 struct to match specification, add support to override strings from toolstack.
Signed-off-by Xin Li <[email protected]>---
CC: Igor Druzhinin <[email protected]>
CC: Sergey Dyasli <[email protected]>
CC: Andrew Cooper <[email protected]>
I wonder why I have not been Cc-ed.
tools/firmware/hvmloader/smbios.c smbios_type_2_init(void *start) · line 521
Quoted 3 lines
tools/firmware/hvmloader/smbios.c +0
-0@@ -518,7 +520,67 @@ smbios_type_2_init(void *start)return (start + length); }
In the subject you say "overriding", but you add new information only when it couldn't be found via get_smbios_pt_struct(). Which in turn already is sort of tool stack provided, so a means to override things already exists. Please clarify this in title and/or description.
tools/firmware/hvmloader/smbios.c smbios_type_2_init(void *start) · line 524
Quoted 3 lines
tools/firmware/hvmloader/smbios.c +2
-1-/* Only present when passed in */ + s =xenstore_read (HVM_XS_BASEBOARD_MANUFACTURER ,NULL ); +if ( (s !=NULL ) && (*s !='\0' ) )
Is it really a good idea to key everything else off of the presence of this one string in xenstore? Shouldn't it rather be that the structure gets instantiated whenever any of the strings are there?
tools/firmware/hvmloader/smbios.c smbios_type_2_init(void *start) · line 530
Quoted 6 lines
tools/firmware/hvmloader/smbios.c +6
-0+ { +memset (p,0 ,sizeof (*p)); + p->header.type =2 ; + p->header.length =sizeof (struct smbios_type_2 ); + p->header.handle =SMBIOS_HANDLE_TYPE2 ; + p->feature_flags =0x09 ;/* Board is a hosting board and replaceable */
Doesn't setting bit 3 sort of imply also setting bit 2? Yet do we really mean to mark the board as replaceable in the first place?
tools/firmware/hvmloader/smbios.c smbios_type_2_init(void *start) · line 535
Quoted 5 lines
tools/firmware/hvmloader/smbios.c +5
-0+ p->chassis_handle =SMBIOS_HANDLE_TYPE3 ; + p->board_type =0x0a ;/* Motherboard */ + start +=sizeof (struct smbios_type_2 ); + +strcpy ((char *)start, s);
There's at least one example in smbios_type_3_init() showing that casts like this one aren't needed.
tools/firmware/hvmloader/smbios_types.h struct smbios_type_2 { · line 98
Quoted 12 lines
tools/firmware/hvmloader/smbios_types.h +6
-0@@ -90,6 +90,12 @@ struct smbios_type_2 {uint8_t product_name_str;uint8_t version_str;uint8_t serial_number_str; +uint8_t asset_tag_str; +uint8_t feature_flags; +uint8_t location_in_chassis_str; +uint16_t chassis_handle; +uint8_t board_type; +uint8_t contained_handle_count;
uint16_t contained_handles[];
Quoted 26 lines
xen/include/public/hvm/hvm_xs_strings.h +8
-12@@ -62,18 +62,24 @@/* The following xenstore values are used to override some of the default * string values in the SMBIOS table constructed in hvmloader. */ -#define HVM_XS_BIOS_STRINGS "bios-strings" -#define HVM_XS_BIOS_VENDOR "bios-strings/bios-vendor" -#define HVM_XS_BIOS_VERSION "bios-strings/bios-version" -#define HVM_XS_SYSTEM_MANUFACTURER "bios-strings/system-manufacturer" -#define HVM_XS_SYSTEM_PRODUCT_NAME "bios-strings/system-product-name" -#define HVM_XS_SYSTEM_VERSION "bios-strings/system-version" -#define HVM_XS_SYSTEM_SERIAL_NUMBER "bios-strings/system-serial-number" -#define HVM_XS_ENCLOSURE_MANUFACTURER "bios-strings/enclosure-manufacturer" -#define HVM_XS_ENCLOSURE_SERIAL_NUMBER "bios-strings/enclosure-serial-number" -#define HVM_XS_ENCLOSURE_ASSET_TAG "bios-strings/enclosure-asset-tag" -#define HVM_XS_BATTERY_MANUFACTURER "bios-strings/battery-manufacturer" -#define HVM_XS_BATTERY_DEVICE_NAME "bios-strings/battery-device-name" +#define HVM_XS_BIOS_STRINGS "bios-strings" +#define HVM_XS_BIOS_VENDOR "bios-strings/bios-vendor" +#define HVM_XS_BIOS_VERSION "bios-strings/bios-version" +#define HVM_XS_SYSTEM_MANUFACTURER "bios-strings/system-manufacturer" +#define HVM_XS_SYSTEM_PRODUCT_NAME "bios-strings/system-product-name" +#define HVM_XS_SYSTEM_VERSION "bios-strings/system-version" +#define HVM_XS_SYSTEM_SERIAL_NUMBER "bios-strings/system-serial-number" +#define HVM_XS_BASEBOARD_MANUFACTURER "bios-strings/baseboard-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 82
Quoted 10 lines
xen/include/public/hvm/hvm_xs_strings.h +10
-0+#define HVM_XS_BASEBOARD_PRODUCT_NAME "bios-strings/baseboard-product-name" +#define HVM_XS_BASEBOARD_VERSION "bios-strings/baseboard-version" +#define HVM_XS_BASEBOARD_SERIAL_NUMBER "bios-strings/baseboard-serial-number" +#define HVM_XS_BASEBOARD_ASSET_TAG "bios-strings/baseboard-asset-tag" +#define HVM_XS_BASEBOARD_LOCATION_IN_CHASSIS "bios-strings/baseboard-location-in-chassis" +#define HVM_XS_ENCLOSURE_MANUFACTURER "bios-strings/enclosure-manufacturer" +#define HVM_XS_ENCLOSURE_SERIAL_NUMBER "bios-strings/enclosure-serial-number" +#define HVM_XS_ENCLOSURE_ASSET_TAG "bios-strings/enclosure-asset-tag" +#define HVM_XS_BATTERY_MANUFACTURER "bios-strings/battery-manufacturer" +#define HVM_XS_BATTERY_DEVICE_NAME "bios-strings/battery-device-name"
To be honest I'd prefer if you avoided the re-formatting, accepting the one definition that then doesn't properly align with the rest. But if others think differently, so be it.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Jan,
Thanks for reviewing.
Quoted 14 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 26, 2019 9:15 PM
To: Xin Li <[email protected]>
Cc: Andrew Cooper <[email protected]>; Igor Druzhinin <[email protected]>; Sergey Dyasli <[email protected]>; Xin Li (Talons) <[email protected]>; [email protected]
Subject: Re: [Xen-devel] [PATCH v1 1/1] hvmloader: allow overriding SMBIOS type 2 infoQuoted 4 lines
Quoted 1 line
Quoted 1 line · On 26.03.19 at 07:45, <[email protected]> wrote:
Extend smbios type 2 struct to match specification, add support to override strings from toolstack.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Xin Li <[email protected]>---
CC: Igor Druzhinin <[email protected]>
CC: Sergey Dyasli <[email protected]>
CC: Andrew Cooper <[email protected]>I wonder why I have not been Cc-ed.
Sorry, adding you.
Quoted 9 lines
tools/firmware/hvmloader/smbios.c smbios_type_2_init(void *start) · line 521
Quoted 4 lines
tools/firmware/hvmloader/smbios.c +0
-0@@ -518,7 +520,67 @@ smbios_type_2_init(void *start)return (start + length); }In the subject you say "overriding", but you add new information only when it couldn't be found via
get_smbios_pt_struct(). Which in turn already is sort of tool stack provided, so a means to override things already exists. Please clarify this in title and/or description.
OK. how about:
hvmloader: add SMBIOS type 2 info for customized string
Extend smbios type 2 struct to match specification, add support to write it when customized string provided and no smbios passed in.
Quoted 8 lines
tools/firmware/hvmloader/smbios.c smbios_type_2_init(void *start) · line 524
Quoted 4 lines
tools/firmware/hvmloader/smbios.c +2
-1-/* Only present when passed in */ + s =xenstore_read (HVM_XS_BASEBOARD_MANUFACTURER ,NULL ); +if ( (s !=NULL ) && (*s !='\0' ) )Is it really a good idea to key everything else off of the presence of this one string in xenstore? Shouldn't it rather be that the structure gets instantiated whenever any of the strings are there?
OK.
I wanted to avoid structure without manufacturer, the app we met only read this field.
Can I iterate the 6 keys twice?
first iteration to decide if any string is provided, the second iteration to initialize structure.
Quoted 11 lines
tools/firmware/hvmloader/smbios.c smbios_type_2_init(void *start)
Quoted 8 lines
tools/firmware/hvmloader/smbios.c +7
-0+ { +memset (p,0 ,sizeof (*p)); + p->header.type =2 ; + p->header.length =sizeof (struct smbios_type_2 ); + p->header.handle =SMBIOS_HANDLE_TYPE2 ; + p->feature_flags =0x09 ;/* Board is a hosting board and +replaceable */ Doesn't setting bit 3 sort of imply also setting bit 2? Yet do we really mean to mark the board as replaceable in the first place?
For the hosts I've checked, bit 3 is set but bit 2 isn't.
Quoted 9 lines
tools/firmware/hvmloader/smbios.c smbios_type_2_init(void *start) · line 535
Quoted 6 lines
tools/firmware/hvmloader/smbios.c +5
-0+ p->chassis_handle =SMBIOS_HANDLE_TYPE3 ; + p->board_type =0x0a ;/* Motherboard */ + start +=sizeof (struct smbios_type_2 ); + +strcpy ((char *)start, s);There's at least one example in
smbios_type_3_init()showing that casts like this one aren't needed.
OK. Will remove this unnecessary cast for void*.
Quoted 15 lines
tools/firmware/hvmloader/smbios_types.h struct smbios_type_2 { · line 98
Quoted 13 lines
tools/firmware/hvmloader/smbios_types.h +6
-0@@ -90,6 +90,12 @@ struct smbios_type_2 {uint8_t product_name_str;uint8_t version_str;uint8_t serial_number_str; +uint8_t asset_tag_str; +uint8_t feature_flags; +uint8_t location_in_chassis_str; +uint16_t chassis_handle; +uint8_t board_type; +uint8_t contained_handle_count;uint16_t contained_handles[];
Sure. Adding this.
Quoted 56 lines
xen/include/public/hvm/hvm_xs_strings.h line 68
Quoted 11 lines
xen/include/public/hvm/hvm_xs_strings.h +0
-4@@ -62,18 +62,24 @@/* The following xenstore values are used to override some of the default * string values in the SMBIOS table constructed in hvmloader. */ -#define HVM_XS_BIOS_STRINGS "bios-strings" -#define HVM_XS_BIOS_VENDOR "bios-strings/bios-vendor" -#define HVM_XS_BIOS_VERSION "bios-strings/bios-version" -#define HVM_XS_SYSTEM_MANUFACTURER "bios-strings/system-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 69
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_SYSTEM_PRODUCT_NAME "bios-strings/system-product-name"
xen/include/public/hvm/hvm_xs_strings.h line 71
Quoted 2 lines
xen/include/public/hvm/hvm_xs_strings.h +0
-2-#define HVM_XS_SYSTEM_VERSION "bios-strings/system-version" -#define HVM_XS_SYSTEM_SERIAL_NUMBER "bios-strings/system-serial-number"
xen/include/public/hvm/hvm_xs_strings.h line 72
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_ENCLOSURE_MANUFACTURER "bios-strings/enclosure-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 73
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_ENCLOSURE_SERIAL_NUMBER "bios-strings/enclosure-serial-number"
xen/include/public/hvm/hvm_xs_strings.h line 74
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_ENCLOSURE_ASSET_TAG "bios-strings/enclosure-asset-tag"
xen/include/public/hvm/hvm_xs_strings.h line 75
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_BATTERY_MANUFACTURER "bios-strings/battery-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 76
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_BATTERY_DEVICE_NAME "bios-strings/battery-device-name"
xen/include/public/hvm/hvm_xs_strings.h
Quoted 4 lines
xen/include/public/hvm/hvm_xs_strings.h +4
-0+#define HVM_XS_BIOS_STRINGS "bios-strings" +#define HVM_XS_BIOS_VENDOR "bios-strings/bios-vendor" +#define HVM_XS_BIOS_VERSION "bios-strings/bios-version" +#define HVM_XS_SYSTEM_MANUFACTURER "bios-strings/system-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 69
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_SYSTEM_PRODUCT_NAME "bios-strings/system-product-name"
xen/include/public/hvm/hvm_xs_strings.h line 70
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_SYSTEM_VERSION "bios-strings/system-version"
xen/include/public/hvm/hvm_xs_strings.h line 71
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_SYSTEM_SERIAL_NUMBER "bios-strings/system-serial-number"
xen/include/public/hvm/hvm_xs_strings.h line 72
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_MANUFACTURER "bios-strings/baseboard-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 73
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_PRODUCT_NAME "bios-strings/baseboard-product-name"
xen/include/public/hvm/hvm_xs_strings.h line 74
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_VERSION "bios-strings/baseboard-version"
xen/include/public/hvm/hvm_xs_strings.h line 75
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_SERIAL_NUMBER "bios-strings/baseboard-serial-number"
xen/include/public/hvm/hvm_xs_strings.h line 76
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_ASSET_TAG "bios-strings/baseboard-asset-tag"
xen/include/public/hvm/hvm_xs_strings.h line 77
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_LOCATION_IN_CHASSIS "bios-strings/baseboard-location-in-chassis"
xen/include/public/hvm/hvm_xs_strings.h line 78
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_ENCLOSURE_MANUFACTURER "bios-strings/enclosure-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 79
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_ENCLOSURE_SERIAL_NUMBER "bios-strings/enclosure-serial-number"
xen/include/public/hvm/hvm_xs_strings.h line 80
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_ENCLOSURE_ASSET_TAG "bios-strings/enclosure-asset-tag"
Quoted 8 lines
xen/include/public/hvm/hvm_xs_strings.h line 81
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BATTERY_MANUFACTURER "bios-strings/battery-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 82
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BATTERY_DEVICE_NAME "bios-strings/battery-device-name"
To be honest I'd prefer if you avoided the re-formatting, accepting the one definition that then doesn't properly align with the rest. But if others think differently, so be it.
Can I keep this style? This seems fit current code style.
Quoted 2 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 13 lines
Quoted 5 lines
Quoted 1 line · On 27.03.19 at 11:54, <[email protected]> wrote:
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, March 26, 2019 9:15 PMQuoted 1 line
Quoted 1 line
Quoted 1 line · On 26.03.19 at 07:45, <[email protected]> wrote:
Quoted 8 lines
tools/firmware/hvmloader/smbios.c smbios_type_2_init(void *start) · line 521
Quoted 3 lines
tools/firmware/hvmloader/smbios.c +0
-0@@ -518,7 +520,67 @@ smbios_type_2_init(void *start)return (start + length); }In the subject you say "overriding", but you add new information only when it couldn't be found via
get_smbios_pt_struct(). Which in turn already is sort of tool stack provided, so a means to override things already exists. Please clarify this in title and/or description.
Quoted 6 lines
OK. how about:
hvmloader: add SMBIOS type 2 info for customized string
Extend smbios type 2 struct to match specification, add support to write it when customized string provided and no smbios passed in.
Looks reasonable to me.
Quoted 7 lines
Quoted 7 lines
tools/firmware/hvmloader/smbios.c smbios_type_2_init(void *start) · line 524
Quoted 3 lines
tools/firmware/hvmloader/smbios.c +2
-1-/* Only present when passed in */ + s =xenstore_read (HVM_XS_BASEBOARD_MANUFACTURER ,NULL ); +if ( (s !=NULL ) && (*s !='\0' ) )Is it really a good idea to key everything else off of the presence of this one string in xenstore? Shouldn't it rather be that the structure gets instantiated whenever any of the strings are there?
Quoted 7 lines
OK.
I wanted to avoid structure without manufacturer, the app we met only read this field.Can I iterate the 6 keys twice?
first iteration to decide if any string is provided, the second iteration to initialize structure.
I'd suggest to avoid this. Fill the structure without the surrounding if(), and simply determine the function's return values based on whether counter is non-zero.
Quoted 11 lines
Quoted 10 lines
tools/firmware/hvmloader/smbios.c smbios_type_2_init(void *start)
Quoted 7 lines
tools/firmware/hvmloader/smbios.c +7
-0+ { +memset (p,0 ,sizeof (*p)); + p->header.type =2 ; + p->header.length =sizeof (struct smbios_type_2 ); + p->header.handle =SMBIOS_HANDLE_TYPE2 ; + p->feature_flags =0x09 ;/* Board is a hosting board and +replaceable */ Doesn't setting bit 3 sort of imply also setting bit 2? Yet do we really mean to mark the board as replaceable in the first place?
For the hosts I've checked, bit 3 is set but bit 2 isn't.
But my reading of the spec suggests this implication; the question just is whether that's an implication for the producer to follow or the consumer. If on actual hardware it's observed as you say, I won't object you keeping it as is.
Quoted 56 lines
Quoted 56 lines
xen/include/public/hvm/hvm_xs_strings.h line 68
Quoted 10 lines
xen/include/public/hvm/hvm_xs_strings.h +0
-4@@ -62,18 +62,24 @@/* The following xenstore values are used to override some of the default * string values in the SMBIOS table constructed in hvmloader. */ -#define HVM_XS_BIOS_STRINGS "bios-strings" -#define HVM_XS_BIOS_VENDOR "bios-strings/bios-vendor" -#define HVM_XS_BIOS_VERSION "bios-strings/bios-version" -#define HVM_XS_SYSTEM_MANUFACTURER "bios-strings/system-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 69
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_SYSTEM_PRODUCT_NAME "bios-strings/system-product-name"
xen/include/public/hvm/hvm_xs_strings.h line 71
Quoted 2 lines
xen/include/public/hvm/hvm_xs_strings.h +0
-2-#define HVM_XS_SYSTEM_VERSION "bios-strings/system-version" -#define HVM_XS_SYSTEM_SERIAL_NUMBER "bios-strings/system-serial-number"
xen/include/public/hvm/hvm_xs_strings.h line 72
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_ENCLOSURE_MANUFACTURER "bios-strings/enclosure-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 73
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_ENCLOSURE_SERIAL_NUMBER "bios-strings/enclosure-serial-number"
xen/include/public/hvm/hvm_xs_strings.h line 74
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_ENCLOSURE_ASSET_TAG "bios-strings/enclosure-asset-tag"
xen/include/public/hvm/hvm_xs_strings.h line 75
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_BATTERY_MANUFACTURER "bios-strings/battery-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 76
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_BATTERY_DEVICE_NAME "bios-strings/battery-device-name"
xen/include/public/hvm/hvm_xs_strings.h
Quoted 4 lines
xen/include/public/hvm/hvm_xs_strings.h +4
-0+#define HVM_XS_BIOS_STRINGS "bios-strings" +#define HVM_XS_BIOS_VENDOR "bios-strings/bios-vendor" +#define HVM_XS_BIOS_VERSION "bios-strings/bios-version" +#define HVM_XS_SYSTEM_MANUFACTURER "bios-strings/system-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 69
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_SYSTEM_PRODUCT_NAME "bios-strings/system-product-name"
xen/include/public/hvm/hvm_xs_strings.h line 70
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_SYSTEM_VERSION "bios-strings/system-version"
xen/include/public/hvm/hvm_xs_strings.h line 71
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_SYSTEM_SERIAL_NUMBER "bios-strings/system-serial-number"
xen/include/public/hvm/hvm_xs_strings.h line 72
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_MANUFACTURER "bios-strings/baseboard-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 73
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_PRODUCT_NAME "bios-strings/baseboard-product-name"
xen/include/public/hvm/hvm_xs_strings.h line 74
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_VERSION "bios-strings/baseboard-version"
xen/include/public/hvm/hvm_xs_strings.h line 75
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_SERIAL_NUMBER "bios-strings/baseboard-serial-number"
xen/include/public/hvm/hvm_xs_strings.h line 76
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_ASSET_TAG "bios-strings/baseboard-asset-tag"
xen/include/public/hvm/hvm_xs_strings.h line 77
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_LOCATION_IN_CHASSIS "bios-strings/baseboard-location-in-chassis"
xen/include/public/hvm/hvm_xs_strings.h line 78
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_ENCLOSURE_MANUFACTURER "bios-strings/enclosure-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 79
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_ENCLOSURE_SERIAL_NUMBER "bios-strings/enclosure-serial-number"
xen/include/public/hvm/hvm_xs_strings.h line 80
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_ENCLOSURE_ASSET_TAG "bios-strings/enclosure-asset-tag"
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BATTERY_MANUFACTURER "bios-strings/battery-
Quoted 8 lines
Quoted 7 lines
manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 82
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BATTERY_DEVICE_NAME "bios-strings/battery-device-name"
To be honest I'd prefer if you avoided the re-formatting, accepting the one definition that then doesn't properly align with the rest. But if others think differently, so be it.
Can I keep this style? This seems fit current code style.
I'm afraid I don't understand the question in the light of me having asked to avoid the re-formatting. Is the question perhaps targeted at others, not me?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 22 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Wednesday, March 27, 2019 7:24 PM
To: Xin Li (Talons) <[email protected]>
Cc: Andrew Cooper <[email protected]>; Igor Druzhinin <[email protected]>; Sergey Dyasli <[email protected]>; Xin Li <[email protected]>; [email protected]
Subject: RE: [Xen-devel] [PATCH v1 1/1] hvmloader: allow overriding SMBIOS type 2 infoQuoted 11 lines
Quoted 7 lines
tools/firmware/hvmloader/smbios.c smbios_type_2_init(void *start) · line 524
Quoted 3 lines
tools/firmware/hvmloader/smbios.c +2
-1-/* Only present when passed in */ + s =xenstore_read (HVM_XS_BASEBOARD_MANUFACTURER ,NULL ); +if ( (s !=NULL ) && (*s !='\0' ) )Is it really a good idea to key everything else off of the presence of this one string in xenstore? Shouldn't it rather be that the structure gets instantiated whenever any of the strings are there?
OK.
I wanted to avoid structure without manufacturer, the app we met only read this field.
Quoted 7 lines
Quoted 3 lines
Can I iterate the 6 keys twice?
first iteration to decide if any string is provided, the second iteration to initialize structure.I'd suggest to avoid this. Fill the structure without the surrounding
if(), and simply determine the function's return values based on whether counter is non-zero.
OK. Other structs can override this header.
Quoted 71 lines
Quoted 4 lines
Quoted 4 lines
xen/include/public/hvm/hvm_xs_strings.h line 62
Quoted 4 lines
xen/include/public/hvm/hvm_xs_strings.h +0
-0@@ -62,18 +62,24 @@/* The following xenstore values are used to override some of the default
Quoted 10 lines
Quoted 10 lines
xen/include/public/hvm/hvm_xs_strings.h
Quoted 6 lines
xen/include/public/hvm/hvm_xs_strings.h +0
-4* string values in the SMBIOS table constructed in hvmloader. */ -#define HVM_XS_BIOS_STRINGS "bios-strings" -#define HVM_XS_BIOS_VENDOR "bios-strings/bios-vendor" -#define HVM_XS_BIOS_VERSION "bios-strings/bios-version" -#define HVM_XS_SYSTEM_MANUFACTURER "bios-strings/system-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 69
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_SYSTEM_PRODUCT_NAME "bios-strings/system-product-name"
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_SYSTEM_VERSION "bios-strings/system-version"
Quoted 1 line
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h line 71
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_SYSTEM_SERIAL_NUMBER "bios-strings/system-serial-
Quoted 2 lines
Quoted 2 lines
number"
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_ENCLOSURE_MANUFACTURER "bios-strings/enclosure-
Quoted 2 lines
Quoted 2 lines
manufacturer"
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_ENCLOSURE_SERIAL_NUMBER "bios-strings/enclosure-
Quoted 11 lines
Quoted 11 lines
serial-number"
xen/include/public/hvm/hvm_xs_strings.h line 74
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_ENCLOSURE_ASSET_TAG "bios-strings/enclosure-asset-tag"
xen/include/public/hvm/hvm_xs_strings.h line 75
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_BATTERY_MANUFACTURER "bios-strings/battery-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 76
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +0
-1-#define HVM_XS_BATTERY_DEVICE_NAME "bios-strings/battery-device-name"
xen/include/public/hvm/hvm_xs_strings.h
Quoted 4 lines
xen/include/public/hvm/hvm_xs_strings.h +4
-0+#define HVM_XS_BIOS_STRINGS "bios-strings" +#define HVM_XS_BIOS_VENDOR "bios-strings/bios-vendor" +#define HVM_XS_BIOS_VERSION "bios-strings/bios-version" +#define HVM_XS_SYSTEM_MANUFACTURER "bios-strings/system-
Quoted 2 lines
Quoted 2 lines
manufacturer"
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_SYSTEM_PRODUCT_NAME "bios-strings/system-
Quoted 4 lines
Quoted 4 lines
product-name"
xen/include/public/hvm/hvm_xs_strings.h line 70
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_SYSTEM_VERSION "bios-strings/system-version"
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_SYSTEM_SERIAL_NUMBER "bios-strings/system-
Quoted 6 lines
Quoted 6 lines
serial-number"
xen/include/public/hvm/hvm_xs_strings.h line 72
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_MANUFACTURER "bios-strings/baseboard-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 73
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_PRODUCT_NAME "bios-strings/baseboard-product-name"
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_VERSION "bios-strings/baseboard-
Quoted 4 lines
Quoted 4 lines
version"
xen/include/public/hvm/hvm_xs_strings.h line 75
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_SERIAL_NUMBER "bios-strings/baseboard-serial-number"
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_ASSET_TAG "bios-Quoted 8 lines
Quoted 8 lines
strings/baseboard-asset-tag"
xen/include/public/hvm/hvm_xs_strings.h line 77
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BASEBOARD_LOCATION_IN_CHASSIS "bios-strings/baseboard-location-in-chassis"
xen/include/public/hvm/hvm_xs_strings.h line 78
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_ENCLOSURE_MANUFACTURER "bios-strings/enclosure-manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 79
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_ENCLOSURE_SERIAL_NUMBER "bios-strings/enclosure-serial-number"
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_ENCLOSURE_ASSET_TAG "bios-strings/enclosure-
Quoted 2 lines
Quoted 2 lines
asset-tag"
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BATTERY_MANUFACTURER "bios-strings/battery-
Quoted 4 lines
Quoted 4 lines
manufacturer"
xen/include/public/hvm/hvm_xs_strings.h line 82
Quoted 1 line
xen/include/public/hvm/hvm_xs_strings.h +1
-0+#define HVM_XS_BATTERY_DEVICE_NAME "bios-strings/battery-device-name"
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
To be honest I'd prefer if you avoided the re-formatting, accepting the one definition that then doesn't properly align with the rest. But if others think differently, so be it.
Can I keep this style? This seems fit current code style.
I'm afraid I don't understand the question in the light of me having asked to avoid the re-formatting. Is the question perhaps targeted at others, not me?
OK. Then HVM_XS_BASEBOARD_LOCATION_IN_CHASSIS won't align with the rest.
Quoted 1 line
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel