mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +00:00
vmm: cpu: Introduce concept of maximum vs boot vCPUs in CpuManager
For now the max vCPUs is the same as the boot vCPUs. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
669d9a8ae8
commit
df0907845a
@ -336,6 +336,7 @@ impl Vcpu {
|
||||
|
||||
pub struct CpuManager {
|
||||
boot_vcpus: u8,
|
||||
max_vcpus: u8,
|
||||
io_bus: Weak<devices::Bus>,
|
||||
mmio_bus: Arc<devices::Bus>,
|
||||
ioapic: Option<Arc<Mutex<ioapic::Ioapic>>>,
|
||||
@ -388,6 +389,7 @@ impl BusDevice for CpuManager {
|
||||
impl CpuManager {
|
||||
pub fn new(
|
||||
boot_vcpus: u8,
|
||||
max_vcpus: u8,
|
||||
device_manager: &DeviceManager,
|
||||
guest_memory: Arc<RwLock<GuestMemoryMmap>>,
|
||||
fd: Arc<VmFd>,
|
||||
@ -396,6 +398,7 @@ impl CpuManager {
|
||||
) -> Result<Arc<Mutex<CpuManager>>> {
|
||||
let cpu_manager = Arc::new(Mutex::new(CpuManager {
|
||||
boot_vcpus,
|
||||
max_vcpus,
|
||||
io_bus: Arc::downgrade(&device_manager.io_bus().clone()),
|
||||
mmio_bus: device_manager.mmio_bus().clone(),
|
||||
ioapic: device_manager.ioapic().clone(),
|
||||
@ -568,4 +571,12 @@ impl CpuManager {
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn boot_vcpus(&self) -> u8 {
|
||||
self.boot_vcpus
|
||||
}
|
||||
|
||||
pub fn max_vcpus(&self) -> u8 {
|
||||
self.max_vcpus
|
||||
}
|
||||
}
|
||||
|
@ -451,8 +451,10 @@ impl Vm {
|
||||
let on_tty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0;
|
||||
|
||||
let boot_vcpus = config.cpus.cpu_count;
|
||||
let max_vcpus = config.cpus.cpu_count;
|
||||
let cpu_manager = cpu::CpuManager::new(
|
||||
boot_vcpus,
|
||||
max_vcpus,
|
||||
&device_manager,
|
||||
guest_memory.clone(),
|
||||
fd,
|
||||
|
Loading…
x
Reference in New Issue
Block a user