mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-09-28 17:45:44 +00:00
vmm: provide oem_strings option
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
964985bb5c
commit
57e9b80123
@ -820,14 +820,15 @@ pub fn configure_system(
|
|||||||
sgx_epc_region: Option<SgxEpcRegion>,
|
sgx_epc_region: Option<SgxEpcRegion>,
|
||||||
serial_number: Option<&str>,
|
serial_number: Option<&str>,
|
||||||
uuid: Option<&str>,
|
uuid: Option<&str>,
|
||||||
|
oem_strings: Option<&[&str]>,
|
||||||
) -> super::Result<()> {
|
) -> super::Result<()> {
|
||||||
// Write EBDA address to location where ACPICA expects to find it
|
// Write EBDA address to location where ACPICA expects to find it
|
||||||
guest_mem
|
guest_mem
|
||||||
.write_obj((layout::EBDA_START.0 >> 4) as u16, layout::EBDA_POINTER)
|
.write_obj((layout::EBDA_START.0 >> 4) as u16, layout::EBDA_POINTER)
|
||||||
.map_err(Error::EbdaSetup)?;
|
.map_err(Error::EbdaSetup)?;
|
||||||
|
|
||||||
let size =
|
let size = smbios::setup_smbios(guest_mem, serial_number, uuid, oem_strings)
|
||||||
smbios::setup_smbios(guest_mem, serial_number, uuid, None).map_err(Error::SmbiosSetup)?;
|
.map_err(Error::SmbiosSetup)?;
|
||||||
|
|
||||||
// Place the MP table after the SMIOS table aligned to 16 bytes
|
// Place the MP table after the SMIOS table aligned to 16 bytes
|
||||||
let offset = GuestAddress(layout::SMBIOS_START).unchecked_add(size);
|
let offset = GuestAddress(layout::SMBIOS_START).unchecked_add(size);
|
||||||
@ -1181,6 +1182,7 @@ mod tests {
|
|||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
assert!(config_err.is_err());
|
assert!(config_err.is_err());
|
||||||
|
|
||||||
@ -1203,6 +1205,7 @@ mod tests {
|
|||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -1224,6 +1227,7 @@ mod tests {
|
|||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -1236,6 +1240,7 @@ mod tests {
|
|||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -1257,6 +1262,7 @@ mod tests {
|
|||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -1269,6 +1275,7 @@ mod tests {
|
|||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ fn create_app<'a>(
|
|||||||
Arg::new("platform")
|
Arg::new("platform")
|
||||||
.long("platform")
|
.long("platform")
|
||||||
.help(
|
.help(
|
||||||
"num_pci_segments=<num_pci_segments>,iommu_segments=<list_of_segments>,serial_number=<dmi_device_serial_number>,uuid=<dmi_device_uuid>",
|
"num_pci_segments=<num_pci_segments>,iommu_segments=<list_of_segments>,serial_number=<dmi_device_serial_number>,uuid=<dmi_device_uuid>,oem_strings=<list_of_strings>",
|
||||||
)
|
)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.group("vm-config"),
|
.group("vm-config"),
|
||||||
|
@ -636,6 +636,8 @@ pub struct PlatformConfig {
|
|||||||
pub serial_number: Option<String>,
|
pub serial_number: Option<String>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub uuid: Option<String>,
|
pub uuid: Option<String>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub oem_strings: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PlatformConfig {
|
impl PlatformConfig {
|
||||||
@ -645,6 +647,7 @@ impl PlatformConfig {
|
|||||||
parser.add("iommu_segments");
|
parser.add("iommu_segments");
|
||||||
parser.add("serial_number");
|
parser.add("serial_number");
|
||||||
parser.add("uuid");
|
parser.add("uuid");
|
||||||
|
parser.add("oem_strings");
|
||||||
parser.parse(platform).map_err(Error::ParsePlatform)?;
|
parser.parse(platform).map_err(Error::ParsePlatform)?;
|
||||||
|
|
||||||
let num_pci_segments: u16 = parser
|
let num_pci_segments: u16 = parser
|
||||||
@ -659,11 +662,16 @@ impl PlatformConfig {
|
|||||||
.convert("serial_number")
|
.convert("serial_number")
|
||||||
.map_err(Error::ParsePlatform)?;
|
.map_err(Error::ParsePlatform)?;
|
||||||
let uuid = parser.convert("uuid").map_err(Error::ParsePlatform)?;
|
let uuid = parser.convert("uuid").map_err(Error::ParsePlatform)?;
|
||||||
|
let oem_strings = parser
|
||||||
|
.convert::<StringList>("oem_strings")
|
||||||
|
.map_err(Error::ParsePlatform)?
|
||||||
|
.map(|v| v.0);
|
||||||
Ok(PlatformConfig {
|
Ok(PlatformConfig {
|
||||||
num_pci_segments,
|
num_pci_segments,
|
||||||
iommu_segments,
|
iommu_segments,
|
||||||
serial_number,
|
serial_number,
|
||||||
uuid,
|
uuid,
|
||||||
|
oem_strings,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,6 +701,7 @@ impl Default for PlatformConfig {
|
|||||||
iommu_segments: None,
|
iommu_segments: None,
|
||||||
serial_number: None,
|
serial_number: None,
|
||||||
uuid: None,
|
uuid: None,
|
||||||
|
oem_strings: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1127,6 +1127,18 @@ impl Vm {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|p| p.uuid.clone());
|
.and_then(|p| p.uuid.clone());
|
||||||
|
|
||||||
|
let oem_strings = self
|
||||||
|
.config
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.platform
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|p| p.oem_strings.clone());
|
||||||
|
|
||||||
|
let oem_strings = oem_strings
|
||||||
|
.as_deref()
|
||||||
|
.map(|strings| strings.iter().map(|s| s.as_ref()).collect::<Vec<&str>>());
|
||||||
|
|
||||||
arch::configure_system(
|
arch::configure_system(
|
||||||
&mem,
|
&mem,
|
||||||
arch::layout::CMDLINE_START,
|
arch::layout::CMDLINE_START,
|
||||||
@ -1136,6 +1148,7 @@ impl Vm {
|
|||||||
sgx_epc_region,
|
sgx_epc_region,
|
||||||
serial_number.as_deref(),
|
serial_number.as_deref(),
|
||||||
uuid.as_deref(),
|
uuid.as_deref(),
|
||||||
|
oem_strings.as_deref(),
|
||||||
)
|
)
|
||||||
.map_err(Error::ConfigureSystem)?;
|
.map_err(Error::ConfigureSystem)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user