mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: plumb legacy SMBIOS config
Add a small SMBIOS config that carries serial_number, uuid, and OEM strings, and pass it from platform config into x86_64 setup. On-behalf-of: SAP leander.kohler@sap.com Signed-off-by: Leander Kohler <leander.kohler@cyberus-technology.de>
This commit is contained in:
committed by
Rob Bradford
parent
0141635a5c
commit
e097d7d495
@@ -1855,29 +1855,13 @@ impl Vm {
|
||||
|
||||
let boot_vcpus = self.cpu_manager.lock().unwrap().boot_vcpus();
|
||||
|
||||
let serial_number = self
|
||||
let smbios = self
|
||||
.config
|
||||
.lock()
|
||||
.unwrap()
|
||||
.platform
|
||||
.as_ref()
|
||||
.and_then(|p| p.serial_number.clone());
|
||||
|
||||
let uuid = self
|
||||
.config
|
||||
.lock()
|
||||
.unwrap()
|
||||
.platform
|
||||
.as_ref()
|
||||
.and_then(|p| p.uuid.clone());
|
||||
|
||||
let oem_strings = self
|
||||
.config
|
||||
.lock()
|
||||
.unwrap()
|
||||
.platform
|
||||
.as_ref()
|
||||
.and_then(|p| p.oem_strings.clone());
|
||||
.and_then(|p| p.smbios_config());
|
||||
|
||||
let topology = self.cpu_manager.lock().unwrap().get_vcpu_topology();
|
||||
|
||||
@@ -1889,9 +1873,7 @@ impl Vm {
|
||||
boot_vcpus,
|
||||
entry_addr.setup_header,
|
||||
rsdp_addr,
|
||||
serial_number.as_deref(),
|
||||
uuid.as_deref(),
|
||||
oem_strings.as_deref(),
|
||||
smbios.as_ref(),
|
||||
topology,
|
||||
)
|
||||
.map_err(Error::ConfigureSystem)?;
|
||||
|
||||
@@ -149,6 +149,21 @@ pub struct PlatformConfig {
|
||||
pub vfio_p2p_dma: bool,
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
impl PlatformConfig {
|
||||
/// Returns `None` if no SMBIOS-relevant platform fields are set, otherwise
|
||||
/// `Some` with a [`SmbiosConfig`] built from the populated fields.
|
||||
pub fn smbios_config(&self) -> Option<arch::x86_64::SmbiosConfig> {
|
||||
let smbios = arch::x86_64::SmbiosConfig {
|
||||
serial_number: self.serial_number.clone(),
|
||||
uuid: self.uuid.clone(),
|
||||
oem_strings: self.oem_strings.clone().unwrap_or_default(),
|
||||
};
|
||||
|
||||
(!smbios.is_empty()).then_some(smbios)
|
||||
}
|
||||
}
|
||||
|
||||
pub const DEFAULT_PCI_SEGMENT_APERTURE_WEIGHT: u32 = 1;
|
||||
|
||||
fn default_pci_segment_aperture_weight() -> u32 {
|
||||
|
||||
Reference in New Issue
Block a user