vmm: use MemoryRegion where applicable

That removes one more KVM-ism in VMM crate.

Note that there are more KVM specific code in those files to be split
out, but we're not at that stage yet.

No functional change.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu
2020-06-24 12:02:26 +00:00
committed by Sebastien Boeuf
parent 48a05c4727
commit b00171e17d
3 changed files with 9 additions and 7 deletions

View File

@@ -13,8 +13,6 @@ use arch::{get_host_cpu_phys_bits, layout, RegionType};
use devices::ioapic;
use devices::BusDevice;
use hypervisor::kvm::{kvm_userspace_memory_region, KVM_MEM_READONLY};
use std::convert::TryInto;
use std::ffi;
use std::fs::{File, OpenOptions};
@@ -678,12 +676,16 @@ impl MemoryManager {
readonly: bool,
) -> Result<u32, Error> {
let slot = self.allocate_kvm_memory_slot();
let mem_region = kvm_userspace_memory_region {
let mem_region = hypervisor::MemoryRegion {
slot,
guest_phys_addr,
memory_size,
userspace_addr,
flags: if readonly { KVM_MEM_READONLY } else { 0 },
flags: if readonly {
hypervisor::kvm::KVM_MEM_READONLY
} else {
0
},
};
self.fd
@@ -731,7 +733,7 @@ impl MemoryManager {
mergeable: bool,
slot: u32,
) -> Result<(), Error> {
let mem_region = kvm_userspace_memory_region {
let mem_region = hypervisor::MemoryRegion {
slot,
guest_phys_addr,
memory_size: 0,