[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xl/libxl: Add OEM string support to smbios
commit 38bdfa44cc0d99acefa5f7a1cc2a8a02311a76c4 Author: Jason Andryuk <jandryuk@xxxxxxxxx> AuthorDate: Mon Mar 6 15:40:24 2023 -0500 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Wed Mar 15 18:41:46 2023 +0000 xl/libxl: Add OEM string support to smbios Add support for OEM strings in the SMBIOS type 11. hvmloader checks them sequentially, so hide the implementation detail. Allow multiple plain oem= items and assign the numeric values internally. Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx> Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> --- docs/man/xl.cfg.5.pod.in | 4 ++++ tools/golang/xenlight/types.gen.go | 1 + tools/libs/light/libxl_dom.c | 16 ++++++++++++++-- tools/libs/light/libxl_types.idl | 1 + tools/xl/xl_parse.c | 13 +++++++++++++ 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index bc4386ee96..10f37990be 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -2122,6 +2122,10 @@ Each B<SMBIOS_SPEC_STRING> is a C<KEY=VALUE> string from the following list: =item B<battery_device_name=STRING> +=item B<oem=STRING> + +oem= can be specified up to 99 times. + =back =item B<ms_vm_genid="OPTION"> diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go index 2d8bc7654a..a7c17699f8 100644 --- a/tools/golang/xenlight/types.gen.go +++ b/tools/golang/xenlight/types.gen.go @@ -411,6 +411,7 @@ SmbiosTypeEnclosureSerialNumber SmbiosType = 14 SmbiosTypeEnclosureAssetTag SmbiosType = 15 SmbiosTypeBatteryManufacturer SmbiosType = 16 SmbiosTypeBatteryDeviceName SmbiosType = 17 +SmbiosTypeOem SmbiosType = 18 ) type Smbios struct { diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c index 5433301f70..25fb716084 100644 --- a/tools/libs/light/libxl_dom.c +++ b/tools/libs/light/libxl_dom.c @@ -755,6 +755,7 @@ static int hvm_build_set_xs_values(libxl__gc *gc, const libxl_domain_build_info *info) { char *path = NULL; + int num_oem = 1; int ret = 0; if (dom->smbios_module.guest_addr_out) { @@ -775,8 +776,19 @@ static int hvm_build_set_xs_values(libxl__gc *gc, for (int i = 0; i < info->u.hvm.num_smbios; i++) { char *p; - path = GCSPRINTF("/local/domain/%d/"HVM_XS_BIOS_STRINGS"/%s", domid, - libxl_smbios_type_to_string(info->u.hvm.smbios[i].key)); + if (info->u.hvm.smbios[i].key == LIBXL_SMBIOS_TYPE_OEM) { + if (num_oem > 99) { + LOGD(ERROR, domid, "More than 99 SMBIOS OEM strings specified"); + ret = ERROR_INVAL; + goto err; + } + path = GCSPRINTF("/local/domain/%d/"HVM_XS_OEM_STRINGS, domid, + num_oem); + num_oem++; + } else { + path = GCSPRINTF("/local/domain/%d/"HVM_XS_BIOS_STRINGS"/%s", domid, + libxl_smbios_type_to_string(info->u.hvm.smbios[i].key)); + } /* Convert libxl_smbios_type string to xenstore path that hvmloader * will use, as defined by HVM_XS_*. That is convert the '_' to '-'. */ diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl index df4dd36697..c10292e0d7 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -441,6 +441,7 @@ libxl_smbios_type = Enumeration("smbios_type", [ (15, "enclosure_asset_tag"), (16, "battery_manufacturer"), (17, "battery_device_name"), + (18, "oem"), ]) libxl_smbios = Struct("smbios", [ diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index ba219024b6..e344d4fda3 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -1864,6 +1864,9 @@ void parse_config_data(const char *config_source, switch (xlu_cfg_get_list(config, "smbios", &smbios, &num_smbios, 0)) { case 0: /* Success */ + { + unsigned int num_oem = 1; + b_info->u.hvm.num_smbios = num_smbios; b_info->u.hvm.smbios = xcalloc(num_smbios, sizeof(libxl_smbios)); for (i = 0; i < num_smbios; i++) { @@ -1903,12 +1906,22 @@ void parse_config_data(const char *config_source, exit(EXIT_FAILURE); } + if (type == LIBXL_SMBIOS_TYPE_OEM) { + if (num_oem > 99) { + fprintf(stderr, + "xl: smbios limited to 99 oem strings\n"); + exit(EXIT_FAILURE); + } + num_oem++; + } + b_info->u.hvm.smbios[i].key = type; b_info->u.hvm.smbios[i].value = xstrdup(value); free(option); } break; + } case ESRCH: /* Option not present */ break; default: -- generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |