mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
build: Bump vm-memory and dependents
vm-memory 0.18 has renamed GuestMemory to GuestMemoryBackend, and made GuestMemory refer to something less specific. For simplicity, we keep using GuestMemoryBackend (formerly GuestMemory) everywhere for now. We can adjust bounds to be less specific later if we find ourselves needing the newly enabled flexibility. Signed-off-by: Alyssa Ross <hi@alyssa.is> Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
committed by
Rob Bradford
parent
1a1c21024a
commit
cd2089eb69
@@ -45,8 +45,8 @@ use vm_device::interrupt::{
|
||||
use vm_device::{BusDevice, Resource};
|
||||
use vm_memory::bitmap::AtomicBitmap;
|
||||
use vm_memory::{
|
||||
Address, GuestAddress, GuestAddressSpace, GuestMemory, GuestMemoryAtomic, GuestMemoryRegion,
|
||||
GuestUsize,
|
||||
Address, GuestAddress, GuestAddressSpace, GuestMemoryAtomic, GuestMemoryBackend,
|
||||
GuestMemoryRegion, GuestUsize,
|
||||
};
|
||||
|
||||
type GuestMemoryMmap = vm_memory::GuestMemoryMmap<AtomicBitmap>;
|
||||
@@ -2612,7 +2612,10 @@ impl<M: GuestAddressSpace> VfioDmaMapping<M> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<M: GuestAddressSpace + Sync + Send> ExternalDmaMapping for VfioDmaMapping<M> {
|
||||
impl<M: GuestAddressSpace + Sync + Send> ExternalDmaMapping for VfioDmaMapping<M>
|
||||
where
|
||||
M::M: GuestMemoryBackend,
|
||||
{
|
||||
fn map(&self, iova: u64, gpa: u64, size: u64) -> result::Result<(), io::Error> {
|
||||
let Ok(usize_size): Result<usize, _> = size.try_into() else {
|
||||
return Err(io::Error::other(format!("size {size} overflows usize")));
|
||||
@@ -2648,7 +2651,7 @@ impl<M: GuestAddressSpace + Sync + Send> ExternalDmaMapping for VfioDmaMapping<M
|
||||
};
|
||||
|
||||
// vfio_dma_map is unsound and ought to be marked as unsafe
|
||||
// SAFETY: find_user_address and GuestMemory::get_slice() guarantee that
|
||||
// SAFETY: find_user_address and GuestMemoryBackend::get_slice() guarantee that
|
||||
// the returned pointer is valid for up to `usize_size` bytes.
|
||||
// `usize_size` is always equal to `size` due to the above `try_into()` call.
|
||||
unsafe { self.vfio_ops.vfio_dma_map(iova, size as usize, user_addr) }.map_err(|e| {
|
||||
|
||||
@@ -21,7 +21,8 @@ use vm_device::interrupt::{InterruptManager, InterruptSourceGroup, MsiIrqGroupCo
|
||||
use vm_device::{BusDevice, Resource};
|
||||
use vm_memory::bitmap::AtomicBitmap;
|
||||
use vm_memory::{
|
||||
Address, GuestAddress, GuestAddressSpace, GuestMemory, GuestMemoryRegion, GuestRegionMmap,
|
||||
Address, GuestAddress, GuestAddressSpace, GuestMemoryBackend, GuestMemoryRegion,
|
||||
GuestRegionMmap,
|
||||
};
|
||||
use vm_migration::{Migratable, MigratableError, Pausable, Snapshot, Snapshottable, Transportable};
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
@@ -540,7 +541,10 @@ impl<M: GuestAddressSpace> VfioUserDmaMapping<M> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<M: GuestAddressSpace + Sync + Send> ExternalDmaMapping for VfioUserDmaMapping<M> {
|
||||
impl<M: GuestAddressSpace + Sync + Send> ExternalDmaMapping for VfioUserDmaMapping<M>
|
||||
where
|
||||
M::M: GuestMemoryBackend,
|
||||
{
|
||||
fn map(&self, iova: u64, gpa: u64, size: u64) -> result::Result<(), io::Error> {
|
||||
let mem = self.memory.memory();
|
||||
let guest_addr = GuestAddress(gpa);
|
||||
|
||||
Reference in New Issue
Block a user