vmm: cpu: Add support for starting more vCPU threads

Add support for starting vCPU threads after the initial boot ones.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2019-11-26 15:56:16 +00:00
parent 0ef999978c
commit e7d4eae527

View File

@ -473,7 +473,11 @@ impl CpuManager {
Ok(cpu_manager) Ok(cpu_manager)
} }
fn activate_vcpus(&mut self, desired_vcpus: u8, entry_addr: GuestAddress) -> Result<()> { fn activate_vcpus(
&mut self,
desired_vcpus: u8,
entry_addr: Option<GuestAddress>,
) -> Result<()> {
if desired_vcpus > self.max_vcpus { if desired_vcpus > self.max_vcpus {
return Err(Error::DesiredVCPUCountExceedsMax); return Err(Error::DesiredVCPUCountExceedsMax);
} }
@ -498,7 +502,7 @@ impl CpuManager {
ioapic, ioapic,
creation_ts, creation_ts,
)?; )?;
vcpu.configure(Some(entry_addr), &self.vm_memory, self.cpuid.clone())?; vcpu.configure(entry_addr, &self.vm_memory, self.cpuid.clone())?;
let vcpu_thread_barrier = vcpu_thread_barrier.clone(); let vcpu_thread_barrier = vcpu_thread_barrier.clone();
@ -570,7 +574,11 @@ impl CpuManager {
// Starts all the vCPUs that the VM is booting with. Blocks until all vCPUs are running. // Starts all the vCPUs that the VM is booting with. Blocks until all vCPUs are running.
pub fn start_boot_vcpus(&mut self, entry_addr: GuestAddress) -> Result<()> { pub fn start_boot_vcpus(&mut self, entry_addr: GuestAddress) -> Result<()> {
self.activate_vcpus(self.boot_vcpus(), entry_addr) self.activate_vcpus(self.boot_vcpus(), Some(entry_addr))
}
pub fn resize(&mut self, desired_vcpus: u8) -> Result<()> {
self.activate_vcpus(desired_vcpus, None)
} }
pub fn shutdown(&mut self) -> Result<()> { pub fn shutdown(&mut self) -> Result<()> {