pci: vfio_user: Allow a BAR to have multiple user memory regions

Similar to what's being supported for vfio devices, vfio-user devices
may also have BARs that need multiple kvm user memory regions,
e.g. device regions with `VFIO_REGION_INFO_CAP_SPARSE_MMAP`.

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen
2022-04-28 14:12:12 -07:00
committed by Sebastien Boeuf
parent 1dfe4eda5c
commit bf39146caa
2 changed files with 66 additions and 54 deletions
+4 -6
View File
@@ -211,10 +211,10 @@ impl Interrupt {
#[derive(Copy, Clone)]
pub struct UserMemoryRegion {
slot: u32,
start: u64,
size: u64,
host_addr: u64,
pub slot: u32,
pub start: u64,
pub size: u64,
pub host_addr: u64,
}
#[derive(Clone)]
@@ -223,7 +223,6 @@ pub struct MmioRegion {
pub length: GuestUsize,
pub(crate) type_: PciBarRegionType,
pub(crate) index: u32,
pub(crate) mem_slot: Option<u32>,
pub(crate) host_addr: Option<u64>,
pub(crate) mmap_size: Option<usize>,
pub(crate) user_memory_regions: Vec<UserMemoryRegion>,
@@ -546,7 +545,6 @@ impl VfioCommon {
length: region_size,
type_: region_type,
index: bar_id as u32,
mem_slot: None,
host_addr: None,
mmap_size: None,
user_memory_regions: Vec::new(),