arch, pci: rename vm_fd to vm

The type is now hypervisor::Vm. Switch from KVM specific name vm_fd to a
generic name just like 8186a8eee6 ("vmm: interrupt: Rename vm_fd").

No functional change.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2020-07-13 13:04:58 +00:00 committed by Rob Bradford
parent 8be80aca80
commit e5552a53d8
2 changed files with 10 additions and 11 deletions

View File

@ -65,15 +65,14 @@ pub struct EntryPoint {
pub fn configure_vcpu(
fd: &Arc<dyn hypervisor::Vcpu>,
id: u8,
vm_fd: &Arc<dyn hypervisor::Vm>,
vm: &Arc<dyn hypervisor::Vm>,
kernel_entry_point: Option<EntryPoint>,
vm_memory: &GuestMemoryAtomic<GuestMemoryMmap>,
) -> super::Result<u64> {
let mut kvi: kvm_bindings::kvm_vcpu_init = kvm_bindings::kvm_vcpu_init::default();
// This reads back the kernel's preferred target type.
vm_fd
.get_preferred_target(&mut kvi)
vm.get_preferred_target(&mut kvi)
.map_err(Error::VcpuArmPreferredTarget)?;
// We already checked that the capability is supported.
kvi.features[0] |= 1 << kvm_bindings::KVM_ARM_VCPU_PSCI_0_2;
@ -138,7 +137,7 @@ pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, Region
#[allow(clippy::too_many_arguments)]
#[allow(unused_variables)]
pub fn configure_system<T: DeviceInfoForFDT + Clone + Debug>(
vm_fd: &Arc<dyn hypervisor::Vm>,
vm: &Arc<dyn hypervisor::Vm>,
guest_mem: &GuestMemoryMmap,
cmdline_cstring: &CStr,
vcpu_count: u64,
@ -146,7 +145,7 @@ pub fn configure_system<T: DeviceInfoForFDT + Clone + Debug>(
device_info: &HashMap<(DeviceType, String), T>,
initrd: &Option<super::InitramfsConfig>,
) -> super::Result<()> {
let gic_device = gic::create_gic(vm_fd, vcpu_count).map_err(Error::SetupGIC)?;
let gic_device = gic::create_gic(vm, vcpu_count).map_err(Error::SetupGIC)?;
let dtb = fdt::create_fdt(
guest_mem,

View File

@ -280,7 +280,7 @@ impl VfioPciConfig {
/// The VMM creates a VfioDevice, then assigns it to a VfioPciDevice,
/// which then gets added to the PCI bus.
pub struct VfioPciDevice {
vm_fd: Arc<dyn hypervisor::Vm>,
vm: Arc<dyn hypervisor::Vm>,
device: Arc<VfioDevice>,
vfio_pci_configuration: VfioPciConfig,
configuration: PciConfiguration,
@ -292,7 +292,7 @@ pub struct VfioPciDevice {
impl VfioPciDevice {
/// Constructs a new Vfio Pci device for the given Vfio device
pub fn new(
vm_fd: &Arc<dyn hypervisor::Vm>,
vm: &Arc<dyn hypervisor::Vm>,
device: VfioDevice,
interrupt_manager: &Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
mem: GuestMemoryAtomic<GuestMemoryMmap>,
@ -316,7 +316,7 @@ impl VfioPciDevice {
let vfio_pci_configuration = VfioPciConfig::new(Arc::clone(&device));
let mut vfio_pci_device = VfioPciDevice {
vm_fd: vm_fd.clone(),
vm: vm.clone(),
device,
configuration,
vfio_pci_configuration,
@ -597,7 +597,7 @@ impl VfioPciDevice {
flags: 0,
};
if let Err(e) = self.vm_fd.set_user_memory_region(kvm_region) {
if let Err(e) = self.vm.set_user_memory_region(kvm_region) {
error!(
"Could not remove the userspace memory region from KVM: {}",
e
@ -1025,7 +1025,7 @@ impl PciDevice for VfioPciDevice {
flags: 0,
};
self.vm_fd
self.vm
.set_user_memory_region(old_mem_region)
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
@ -1038,7 +1038,7 @@ impl PciDevice for VfioPciDevice {
flags: 0,
};
self.vm_fd
self.vm
.set_user_memory_region(new_mem_region)
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
}