|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v3 3/3] 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>
---
v3:
Add } from patch 2 to parse_config_data
Use EXIT_FAILURE
Print error message in libxl for > 99 OEM strings
v2:
Move oem= description to be indented in docs
Re-work oem= description
Re-word oem string limit xl error message
Replace OEM_{1,99) with just OEM and handle in libxl
This change re-introduces the newline before ms_vm_genid.
---
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 fa78fba361..ddba1c3a05 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -2104,6 +2104,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 e084c3540b..51076249b4 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -405,6 +405,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 4f85623c42..12d027a575 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -753,6 +753,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) {
@@ -773,8 +774,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 d04207748e..76651eea43 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -436,6 +436,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 47521e9924..f9b4db16a6 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1787,6 +1787,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++) {
@@ -1826,12 +1829,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:
--
2.37.3
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |