virtio-devices: move userspace mapping to vm-device

Move UserspaceMapping to vm-device to avoid redefinition since
UserspaceMapping is used by both `virtio-devices` and `device`
crate.

Signed-off-by: Songqian Li <sionli@tencent.com>
This commit is contained in:
Songqian Li
2025-06-17 16:56:40 +08:00
committed by Bo Chen
parent 55212b0437
commit bd17c84d3c
9 changed files with 25 additions and 19 deletions

View File

@@ -14,4 +14,5 @@ hypervisor = { path = "../hypervisor" }
serde = { workspace = true, features = ["derive", "rc"] }
thiserror = { workspace = true }
vfio-ioctls = { workspace = true, default-features = false }
vm-memory = { workspace = true, features = ["backend-mmap"] }
vmm-sys-util = { workspace = true }

View File

@@ -4,6 +4,7 @@
//
use serde::{Deserialize, Serialize};
use vm_memory::{GuestAddress, GuestUsize};
mod bus;
pub mod dma_mapping;
@@ -58,3 +59,12 @@ pub enum Resource {
/// KVM memslot index.
KvmMemSlot(u32),
}
#[derive(Clone)]
pub struct UserspaceMapping {
pub host_addr: u64,
pub mem_slot: u32,
pub addr: GuestAddress,
pub len: GuestUsize,
pub mergeable: bool,
}