mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
pci, vmm: Switch to use more generic VfioOps trait
Replace the concrete `VfioContainer` type with the `VfioOps` trait object for device passthrough. This decouples the VFIO DMA mapping interface from the legacy VFIO container/group implementation, allowing it to be extended to support VFIO cdev and iommufd in the future. Signed-off-by: Bo Chen <bchen@crusoe.ai>
This commit is contained in:
@@ -1032,7 +1032,7 @@ pub struct DeviceManager {
|
||||
// VFIO container
|
||||
// Only one container can be created, therefore it is stored as part of the
|
||||
// DeviceManager to be reused.
|
||||
vfio_container: Option<Arc<VfioContainer>>,
|
||||
vfio_container: Option<Arc<dyn VfioOps>>,
|
||||
|
||||
// Paravirtualized IOMMU
|
||||
iommu_device: Option<Arc<Mutex<virtio_devices::Iommu>>>,
|
||||
@@ -3798,7 +3798,7 @@ impl DeviceManager {
|
||||
self.add_vfio_device(device_cfg)
|
||||
}
|
||||
|
||||
fn create_vfio_container(&self) -> DeviceManagerResult<Arc<VfioContainer>> {
|
||||
fn create_vfio_container(&self) -> DeviceManagerResult<Arc<dyn VfioOps>> {
|
||||
let passthrough_device = self
|
||||
.passthrough_device
|
||||
.as_ref()
|
||||
|
||||
Reference in New Issue
Block a user