diff options
author | Alyssa Ross <hi@alyssa.is> | 2020-03-26 12:26:18 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2020-03-26 12:26:18 +0000 |
commit | dbd5f925b6b2f4cb1bf87563be4d24c8ed35689a (patch) | |
tree | 5a51c0af87b6a8bb3dfe43d599cabf96523a7f6f /vm_control | |
parent | 88b7821302043b7ad871fcc0c7748573d0f140e2 (diff) | |
parent | 22964eab8874d41cf0eadf03dfeb1ffb653283e5 (diff) | |
download | crosvm-dbd5f925b6b2f4cb1bf87563be4d24c8ed35689a.tar crosvm-dbd5f925b6b2f4cb1bf87563be4d24c8ed35689a.tar.gz crosvm-dbd5f925b6b2f4cb1bf87563be4d24c8ed35689a.tar.bz2 crosvm-dbd5f925b6b2f4cb1bf87563be4d24c8ed35689a.tar.lz crosvm-dbd5f925b6b2f4cb1bf87563be4d24c8ed35689a.tar.xz crosvm-dbd5f925b6b2f4cb1bf87563be4d24c8ed35689a.tar.zst crosvm-dbd5f925b6b2f4cb1bf87563be4d24c8ed35689a.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'vm_control')
-rw-r--r-- | vm_control/src/lib.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/vm_control/src/lib.rs b/vm_control/src/lib.rs index 8a7b9ec..0216a90 100644 --- a/vm_control/src/lib.rs +++ b/vm_control/src/lib.rs @@ -192,7 +192,7 @@ pub enum VmMemoryRequest { RegisterMemory(MaybeOwnedFd, usize), /// Similiar to `VmMemoryRequest::RegisterMemory`, but doesn't allocate new address space. /// Useful for cases where the address space is already allocated (PCI regions). - RegisterMemoryAtAddress(Alloc, MaybeOwnedFd, usize, u64), + RegisterFdAtPciBarOffset(Alloc, MaybeOwnedFd, usize, u64), /// Unregister the given memory slot that was previously registereed with `RegisterMemory`. UnregisterMemory(u32), /// Allocate GPU buffer of a given size/format and register the memory into guest address space. @@ -230,8 +230,8 @@ impl VmMemoryRequest { Err(e) => VmMemoryResponse::Err(e), } } - RegisterMemoryAtAddress(alloc, ref fd, size, guest_addr) => { - match register_memory(vm, sys_allocator, fd, size, Some((alloc, guest_addr))) { + RegisterFdAtPciBarOffset(alloc, ref fd, size, offset) => { + match register_memory(vm, sys_allocator, fd, size, Some((alloc, offset))) { Ok((pfn, slot)) => VmMemoryResponse::RegisterMemory { pfn, slot }, Err(e) => VmMemoryResponse::Err(e), } @@ -433,12 +433,13 @@ fn register_memory( }; let addr = match allocation { - Some((Alloc::PciBar { bus, dev, bar }, address)) => { + Some((Alloc::PciBar { bus, dev, bar }, offset)) => { match allocator .mmio_allocator(MmioType::High) .get(&Alloc::PciBar { bus, dev, bar }) { Some((start_addr, length, _)) => { + let address = *start_addr + offset; let range = *start_addr..*start_addr + *length; let end = address + (size as u64); match (range.contains(&address), range.contains(&end)) { |