dependencies: bump vm-memory from 4237db3 to f3d1c27

This commit updates Cloud-Hypervisor to rely on the latest version of
the vm-memory crate.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2020-02-06 09:00:41 +01:00 committed by Samuel Ortiz
parent ae87455242
commit 3447e226d9
10 changed files with 42 additions and 35 deletions

2
Cargo.lock generated
View File

@ -1157,7 +1157,7 @@ dependencies = [
[[package]] [[package]]
name = "vm-memory" name = "vm-memory"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/rust-vmm/vm-memory#4237db35e821fd67a4b8f52934adcd58f8679421" source = "git+https://github.com/rust-vmm/vm-memory#f3d1c2775ccf619d7a7330ddfc4954a784b45751"
dependencies = [ dependencies = [
"cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -226,7 +226,7 @@ mod tests {
#[test] #[test]
fn test_system_configuration() { fn test_system_configuration() {
let no_vcpus = 4; let no_vcpus = 4;
let gm = GuestMemoryMmap::new(&vec![(GuestAddress(0), 0x10000)]).unwrap(); let gm = GuestMemoryMmap::from_ranges(&vec![(GuestAddress(0), 0x10000)]).unwrap();
let config_err = configure_system(&gm, GuestAddress(0), 0, 1, None, None); let config_err = configure_system(&gm, GuestAddress(0), 0, 1, None, None);
assert!(config_err.is_err()); assert!(config_err.is_err());
@ -238,7 +238,7 @@ mod tests {
.filter(|r| r.2 == RegionType::Ram) .filter(|r| r.2 == RegionType::Ram)
.map(|r| (r.0, r.1)) .map(|r| (r.0, r.1))
.collect(); .collect();
let gm = GuestMemoryMmap::new(&ram_regions).unwrap(); let gm = GuestMemoryMmap::from_ranges(&ram_regions).unwrap();
configure_system(&gm, GuestAddress(0), 0, no_vcpus, None, None).unwrap(); configure_system(&gm, GuestAddress(0), 0, no_vcpus, None, None).unwrap();
// Now assigning some memory that is equal to the start of the 32bit memory hole. // Now assigning some memory that is equal to the start of the 32bit memory hole.
@ -249,7 +249,7 @@ mod tests {
.filter(|r| r.2 == RegionType::Ram) .filter(|r| r.2 == RegionType::Ram)
.map(|r| (r.0, r.1)) .map(|r| (r.0, r.1))
.collect(); .collect();
let gm = GuestMemoryMmap::new(&ram_regions).unwrap(); let gm = GuestMemoryMmap::from_ranges(&ram_regions).unwrap();
configure_system(&gm, GuestAddress(0), 0, no_vcpus, None, None).unwrap(); configure_system(&gm, GuestAddress(0), 0, no_vcpus, None, None).unwrap();
// Now assigning some memory that falls after the 32bit memory hole. // Now assigning some memory that falls after the 32bit memory hole.
@ -260,7 +260,7 @@ mod tests {
.filter(|r| r.2 == RegionType::Ram) .filter(|r| r.2 == RegionType::Ram)
.map(|r| (r.0, r.1)) .map(|r| (r.0, r.1))
.collect(); .collect();
let gm = GuestMemoryMmap::new(&ram_regions).unwrap(); let gm = GuestMemoryMmap::from_ranges(&ram_regions).unwrap();
configure_system(&gm, GuestAddress(0), 0, no_vcpus, None, None).unwrap(); configure_system(&gm, GuestAddress(0), 0, no_vcpus, None, None).unwrap();
} }

View File

@ -296,7 +296,8 @@ mod tests {
#[test] #[test]
fn bounds_check() { fn bounds_check() {
let num_cpus = 4; let num_cpus = 4;
let mem = GuestMemoryMmap::new(&[(MPTABLE_START, compute_mp_size(num_cpus))]).unwrap(); let mem =
GuestMemoryMmap::from_ranges(&[(MPTABLE_START, compute_mp_size(num_cpus))]).unwrap();
setup_mptable(&mem, num_cpus).unwrap(); setup_mptable(&mem, num_cpus).unwrap();
} }
@ -304,7 +305,8 @@ mod tests {
#[test] #[test]
fn bounds_check_fails() { fn bounds_check_fails() {
let num_cpus = 4; let num_cpus = 4;
let mem = GuestMemoryMmap::new(&[(MPTABLE_START, compute_mp_size(num_cpus) - 1)]).unwrap(); let mem = GuestMemoryMmap::from_ranges(&[(MPTABLE_START, compute_mp_size(num_cpus) - 1)])
.unwrap();
assert!(setup_mptable(&mem, num_cpus).is_err()); assert!(setup_mptable(&mem, num_cpus).is_err());
} }
@ -312,7 +314,8 @@ mod tests {
#[test] #[test]
fn mpf_intel_checksum() { fn mpf_intel_checksum() {
let num_cpus = 1; let num_cpus = 1;
let mem = GuestMemoryMmap::new(&[(MPTABLE_START, compute_mp_size(num_cpus))]).unwrap(); let mem =
GuestMemoryMmap::from_ranges(&[(MPTABLE_START, compute_mp_size(num_cpus))]).unwrap();
setup_mptable(&mem, num_cpus).unwrap(); setup_mptable(&mem, num_cpus).unwrap();
@ -327,7 +330,8 @@ mod tests {
#[test] #[test]
fn mpc_table_checksum() { fn mpc_table_checksum() {
let num_cpus = 4; let num_cpus = 4;
let mem = GuestMemoryMmap::new(&[(MPTABLE_START, compute_mp_size(num_cpus))]).unwrap(); let mem =
GuestMemoryMmap::from_ranges(&[(MPTABLE_START, compute_mp_size(num_cpus))]).unwrap();
setup_mptable(&mem, num_cpus).unwrap(); setup_mptable(&mem, num_cpus).unwrap();
@ -356,8 +360,10 @@ mod tests {
#[test] #[test]
fn cpu_entry_count() { fn cpu_entry_count() {
let mem = let mem = GuestMemoryMmap::from_ranges(&[(
GuestMemoryMmap::new(&[(MPTABLE_START, compute_mp_size(MAX_SUPPORTED_CPUS as u8))]) MPTABLE_START,
compute_mp_size(MAX_SUPPORTED_CPUS as u8),
)])
.unwrap(); .unwrap();
for i in 0..MAX_SUPPORTED_CPUS as u8 { for i in 0..MAX_SUPPORTED_CPUS as u8 {
@ -391,7 +397,8 @@ mod tests {
#[test] #[test]
fn cpu_entry_count_max() { fn cpu_entry_count_max() {
let cpus = MAX_SUPPORTED_CPUS + 1; let cpus = MAX_SUPPORTED_CPUS + 1;
let mem = GuestMemoryMmap::new(&[(MPTABLE_START, compute_mp_size(cpus as u8))]).unwrap(); let mem =
GuestMemoryMmap::from_ranges(&[(MPTABLE_START, compute_mp_size(cpus as u8))]).unwrap();
let result = setup_mptable(&mem, cpus as u8); let result = setup_mptable(&mem, cpus as u8);
assert!(result.is_err()); assert!(result.is_err());

View File

@ -269,7 +269,7 @@ mod tests {
use vm_memory::{GuestAddress, GuestMemoryMmap}; use vm_memory::{GuestAddress, GuestMemoryMmap};
fn create_guest_mem() -> GuestMemoryMmap { fn create_guest_mem() -> GuestMemoryMmap {
GuestMemoryMmap::new(&vec![(GuestAddress(0), 0x10000)]).unwrap() GuestMemoryMmap::from_ranges(&vec![(GuestAddress(0), 0x10000)]).unwrap()
} }
fn read_u64(gm: &GuestMemoryMmap, offset: GuestAddress) -> u64 { fn read_u64(gm: &GuestMemoryMmap, offset: GuestAddress) -> u64 {

View File

@ -536,7 +536,7 @@ impl<S: VhostUserBackend> VhostUserSlaveReqHandler for VhostUserHandler<S> {
}); });
} }
let mem = GuestMemoryMmap::with_files(regions).map_err(|e| { let mem = GuestMemoryMmap::from_ranges_with_files(regions).map_err(|e| {
VhostUserError::ReqHandlerError(io::Error::new(io::ErrorKind::Other, e)) VhostUserError::ReqHandlerError(io::Error::new(io::ErrorKind::Other, e))
})?; })?;
self.backend self.backend

View File

@ -546,7 +546,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let chain = create_descriptor_chain( let chain = create_descriptor_chain(
&memory, &memory,
@ -587,7 +587,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let chain = create_descriptor_chain( let chain = create_descriptor_chain(
&memory, &memory,
@ -628,7 +628,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let chain = create_descriptor_chain( let chain = create_descriptor_chain(
&memory, &memory,
@ -653,7 +653,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let chain = create_descriptor_chain( let chain = create_descriptor_chain(
&memory, &memory,
@ -678,7 +678,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let chain = create_descriptor_chain( let chain = create_descriptor_chain(
&memory, &memory,
@ -726,7 +726,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let secret: Le32 = 0x12345678.into(); let secret: Le32 = 0x12345678.into();
@ -765,7 +765,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let chain = create_descriptor_chain( let chain = create_descriptor_chain(
&memory, &memory,
@ -795,7 +795,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let chain = create_descriptor_chain( let chain = create_descriptor_chain(
&memory, &memory,
@ -824,7 +824,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let chain = create_descriptor_chain( let chain = create_descriptor_chain(
&memory, &memory,
@ -853,7 +853,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let chain = create_descriptor_chain( let chain = create_descriptor_chain(
&memory, &memory,
@ -882,7 +882,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let chain = create_descriptor_chain( let chain = create_descriptor_chain(
&memory, &memory,
@ -911,7 +911,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let chain = create_descriptor_chain( let chain = create_descriptor_chain(
&memory, &memory,
@ -940,7 +940,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let chain = create_descriptor_chain( let chain = create_descriptor_chain(
&memory, &memory,
@ -964,7 +964,7 @@ mod tests {
use DescriptorType::*; use DescriptorType::*;
let memory_start_addr = GuestAddress(0x0); let memory_start_addr = GuestAddress(0x0);
let memory = GuestMemoryMmap::new(&vec![(memory_start_addr, 0x10000)]).unwrap(); let memory = GuestMemoryMmap::from_ranges(&vec![(memory_start_addr, 0x10000)]).unwrap();
let chain = create_descriptor_chain( let chain = create_descriptor_chain(
&memory, &memory,

View File

@ -89,7 +89,7 @@ mod tests {
let start_addr1 = GuestAddress(0x0); let start_addr1 = GuestAddress(0x0);
let start_addr2 = GuestAddress(0x1000); let start_addr2 = GuestAddress(0x1000);
let guest_mem = let guest_mem =
GuestMemoryMmap::new(&[(start_addr1, 0x400), (start_addr2, 0x400)]).unwrap(); GuestMemoryMmap::from_ranges(&[(start_addr1, 0x400), (start_addr2, 0x400)]).unwrap();
assert!(get_host_address_range(&guest_mem, GuestAddress(0x600), 0x100).is_none()); assert!(get_host_address_range(&guest_mem, GuestAddress(0x600), 0x100).is_none());

View File

@ -731,7 +731,7 @@ pub(crate) mod tests {
#[test] #[test]
fn test_checked_new_descriptor_chain() { fn test_checked_new_descriptor_chain() {
let m = &GuestMemoryMmap::new(&[(GuestAddress(0), 0x10000)]).unwrap(); let m = &GuestMemoryMmap::from_ranges(&[(GuestAddress(0), 0x10000)]).unwrap();
let vq = VirtQueue::new(GuestAddress(0), m, 16); let vq = VirtQueue::new(GuestAddress(0), m, 16);
assert!(vq.end().0 < 0x1000); assert!(vq.end().0 < 0x1000);
@ -792,7 +792,7 @@ pub(crate) mod tests {
#[test] #[test]
fn test_queue_and_iterator() { fn test_queue_and_iterator() {
let m = &GuestMemoryMmap::new(&[(GuestAddress(0), 0x10000)]).unwrap(); let m = &GuestMemoryMmap::from_ranges(&[(GuestAddress(0), 0x10000)]).unwrap();
let vq = VirtQueue::new(GuestAddress(0), m, 16); let vq = VirtQueue::new(GuestAddress(0), m, 16);
let mut q = vq.create_queue(); let mut q = vq.create_queue();
@ -897,7 +897,7 @@ pub(crate) mod tests {
#[test] #[test]
fn test_add_used() { fn test_add_used() {
let m = &GuestMemoryMmap::new(&[(GuestAddress(0), 0x10000)]).unwrap(); let m = &GuestMemoryMmap::from_ranges(&[(GuestAddress(0), 0x10000)]).unwrap();
let vq = VirtQueue::new(GuestAddress(0), m, 16); let vq = VirtQueue::new(GuestAddress(0), m, 16);
let mut q = vq.create_queue(); let mut q = vq.create_queue();

View File

@ -264,7 +264,7 @@ mod tests {
const MEM_SIZE: usize = 1024 * 1024 * 128; const MEM_SIZE: usize = 1024 * 1024 * 128;
Self { Self {
cid: CID, cid: CID,
mem: GuestMemoryMmap::new(&[(GuestAddress(0), MEM_SIZE)]).unwrap(), mem: GuestMemoryMmap::from_ranges(&[(GuestAddress(0), MEM_SIZE)]).unwrap(),
mem_size: MEM_SIZE, mem_size: MEM_SIZE,
device: Vsock::new(CID, TestBackend::new(), false).unwrap(), device: Vsock::new(CID, TestBackend::new(), false).unwrap(),
} }

View File

@ -749,7 +749,7 @@ pub fn test_vm() {
let mem_size = 0x1000; let mem_size = 0x1000;
let load_addr = GuestAddress(0x1000); let load_addr = GuestAddress(0x1000);
let mem = GuestMemoryMmap::new(&[(load_addr, mem_size)]).unwrap(); let mem = GuestMemoryMmap::from_ranges(&[(load_addr, mem_size)]).unwrap();
let kvm = Kvm::new().expect("new KVM instance creation failed"); let kvm = Kvm::new().expect("new KVM instance creation failed");
let vm_fd = kvm.create_vm().expect("new VM fd creation failed"); let vm_fd = kvm.create_vm().expect("new VM fd creation failed");