arch: Use more descriptive name for hypervisor::Vcpu than fd

This variable name is residual from when these functions acted directly
on the vCPU fd rather than the hypervisor wrapper.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2022-05-11 14:31:50 +01:00 committed by Sebastien Boeuf
parent 218be2642e
commit 2caf5e3b2b
2 changed files with 11 additions and 11 deletions

View File

@ -64,16 +64,16 @@ pub struct EntryPoint {
/// Configure the specified VCPU, and return its MPIDR. /// Configure the specified VCPU, and return its MPIDR.
pub fn configure_vcpu( pub fn configure_vcpu(
fd: &Arc<dyn hypervisor::Vcpu>, vcpu: &Arc<dyn hypervisor::Vcpu>,
id: u8, id: u8,
kernel_entry_point: Option<EntryPoint>, kernel_entry_point: Option<EntryPoint>,
) -> super::Result<u64> { ) -> super::Result<u64> {
if let Some(kernel_entry_point) = kernel_entry_point { if let Some(kernel_entry_point) = kernel_entry_point {
regs::setup_regs(fd, id, kernel_entry_point.entry_addr.raw_value()) regs::setup_regs(vcpu, id, kernel_entry_point.entry_addr.raw_value())
.map_err(Error::RegsConfiguration)?; .map_err(Error::RegsConfiguration)?;
} }
let mpidr = fd.read_mpidr().map_err(Error::VcpuRegMpidr)?; let mpidr = vcpu.read_mpidr().map_err(Error::VcpuRegMpidr)?;
Ok(mpidr) Ok(mpidr)
} }

View File

@ -744,7 +744,7 @@ pub fn generate_common_cpuid(
} }
pub fn configure_vcpu( pub fn configure_vcpu(
fd: &Arc<dyn hypervisor::Vcpu>, vcpu: &Arc<dyn hypervisor::Vcpu>,
id: u8, id: u8,
kernel_entry_point: Option<EntryPoint>, kernel_entry_point: Option<EntryPoint>,
vm_memory: &GuestMemoryAtomic<GuestMemoryMmap>, vm_memory: &GuestMemoryAtomic<GuestMemoryMmap>,
@ -756,23 +756,23 @@ pub fn configure_vcpu(
CpuidPatch::set_cpuid_reg(&mut cpuid, 0xb, None, CpuidReg::EDX, u32::from(id)); CpuidPatch::set_cpuid_reg(&mut cpuid, 0xb, None, CpuidReg::EDX, u32::from(id));
CpuidPatch::set_cpuid_reg(&mut cpuid, 0x1f, None, CpuidReg::EDX, u32::from(id)); CpuidPatch::set_cpuid_reg(&mut cpuid, 0x1f, None, CpuidReg::EDX, u32::from(id));
fd.set_cpuid2(&cpuid) vcpu.set_cpuid2(&cpuid)
.map_err(|e| Error::SetSupportedCpusFailed(e.into()))?; .map_err(|e| Error::SetSupportedCpusFailed(e.into()))?;
if kvm_hyperv { if kvm_hyperv {
fd.enable_hyperv_synic().unwrap(); vcpu.enable_hyperv_synic().unwrap();
} }
regs::setup_msrs(fd).map_err(Error::MsrsConfiguration)?; regs::setup_msrs(vcpu).map_err(Error::MsrsConfiguration)?;
if let Some(kernel_entry_point) = kernel_entry_point { if let Some(kernel_entry_point) = kernel_entry_point {
if let Some(entry_addr) = kernel_entry_point.entry_addr { if let Some(entry_addr) = kernel_entry_point.entry_addr {
// Safe to unwrap because this method is called after the VM is configured // Safe to unwrap because this method is called after the VM is configured
regs::setup_regs(fd, entry_addr.raw_value()).map_err(Error::RegsConfiguration)?; regs::setup_regs(vcpu, entry_addr.raw_value()).map_err(Error::RegsConfiguration)?;
regs::setup_fpu(fd).map_err(Error::FpuConfiguration)?; regs::setup_fpu(vcpu).map_err(Error::FpuConfiguration)?;
regs::setup_sregs(&vm_memory.memory(), fd).map_err(Error::SregsConfiguration)?; regs::setup_sregs(&vm_memory.memory(), vcpu).map_err(Error::SregsConfiguration)?;
} }
} }
interrupts::set_lint(fd).map_err(|e| Error::LocalIntConfiguration(e.into()))?; interrupts::set_lint(vcpu).map_err(|e| Error::LocalIntConfiguration(e.into()))?;
Ok(()) Ok(())
} }