mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
arch, vmm: Pass cpu topology configuation to FDT
In an Arm system, the hierarchy of CPUs is defined through three entities that are used to describe the layout of physical CPUs in the system: - cluster - core - thread All these three entities have their own FDT node field. Therefore, This commit adds an AArch64-specific helper to pass the config from the Cloud Hypervisor command line to the `configure_system`, where eventually the `create_fdt` is called. Signed-off-by: Henry Wang <Henry.Wang@arm.com>
This commit is contained in:
@@ -978,6 +978,14 @@ impl CpuManager {
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub fn get_vcpu_topology(&self) -> Option<(u8, u8, u8)> {
|
||||
self.config
|
||||
.topology
|
||||
.clone()
|
||||
.map(|t| (t.threads_per_core, t.cores_per_die, t.packages))
|
||||
}
|
||||
|
||||
#[cfg(feature = "acpi")]
|
||||
pub fn create_madt(&self) -> Sdt {
|
||||
use crate::acpi;
|
||||
|
||||
@@ -1072,6 +1072,7 @@ impl Vm {
|
||||
fn configure_system(&mut self) -> Result<()> {
|
||||
let cmdline_cstring = self.get_cmdline()?;
|
||||
let vcpu_mpidrs = self.cpu_manager.lock().unwrap().get_mpidrs();
|
||||
let vcpu_topology = self.cpu_manager.lock().unwrap().get_vcpu_topology();
|
||||
let mem = self.memory_manager.lock().unwrap().boot_guest_memory();
|
||||
let initramfs_config = match self.initramfs {
|
||||
Some(_) => Some(self.load_initramfs(&mem)?),
|
||||
@@ -1129,6 +1130,7 @@ impl Vm {
|
||||
&mem,
|
||||
&cmdline_cstring,
|
||||
vcpu_mpidrs,
|
||||
vcpu_topology,
|
||||
device_info,
|
||||
&initramfs_config,
|
||||
&pci_space,
|
||||
@@ -2653,6 +2655,7 @@ mod tests {
|
||||
&mem,
|
||||
&CString::new("console=tty0").unwrap(),
|
||||
vec![0],
|
||||
Some((0, 0, 0)),
|
||||
&dev_info,
|
||||
&*gic,
|
||||
&None,
|
||||
|
||||
Reference in New Issue
Block a user