pub fn new(
        vm: &Arc<dyn hypervisor::Vm>,
        device: VfioDevice,
        container: Arc<VfioContainer>,
        msi_interrupt_manager: &Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
        legacy_interrupt_group: Option<Arc<dyn InterruptSourceGroup>>,
        iommu_attached: bool,
        bdf: PciBdf,
    ) -> Result<Self, VfioPciError> {
        let device = Arc::new(device);
        device.reset();

        let configuration = PciConfiguration::new(
            0,
            0,
            0,
            PciClassCode::Other,
            &PciVfioSubclass::VfioSubclass,
            None,
            PciHeaderType::Device,
            0,
            0,
            None,
        );

        let vfio_wrapper = VfioDeviceWrapper::new(Arc::clone(&device));

        let mut common = VfioCommon {
            mmio_regions: Vec::new(),
            configuration,
            interrupt: Interrupt {
                intx: None,
                msi: None,
                msix: None,
            },
        };

        common.parse_capabilities(msi_interrupt_manager, &vfio_wrapper, bdf);
        common.initialize_legacy_interrupt(legacy_interrupt_group, &vfio_wrapper)?;

        let vfio_pci_device = VfioPciDevice {
            vm: vm.clone(),
            device,
            container,
            vfio_wrapper,
            common,
            iommu_attached,
        };

        Ok(vfio_pci_device)
    }
/// Constructs a new Vfio Pci device for the given Vfio device
Constructs a new Vfio Pci device for the given Vfio device
Constructs a new Vfio Pci device for the given Vfio device
pub fn new(
        vm: &Arc<dyn hypervisor::Vm>,
        device: VfioDevice,
        container: Arc<VfioContainer>,
        msi_interrupt_manager: &Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
        legacy_interrupt_group: Option<Arc<dyn InterruptSourceGroup>>,
        iommu_attached: bool,
        bdf: PciBdf,
    ) -> Result<Self, VfioPciError> {
        let device = Arc::new(device);
        device.reset();
        let configuration = PciConfiguration::new(
            0,
            0,
            0,
            PciClassCode::Other,
            &PciVfioSubclass::VfioSubclass,
            None,
            PciHeaderType::Device,
            0,
            0,
            None,
        );
        let vfio_wrapper = VfioDeviceWrapper::new(Arc::clone(&device));
        let mut common = VfioCommon {
            mmio_regions: Vec::new(),
            configuration,
            interrupt: Interrupt {
                intx: None,
                msi: None,
                msix: None,
            },
        };
        common.parse_capabilities(msi_interrupt_manager, &vfio_wrapper, bdf);
        common.initialize_legacy_interrupt(legacy_interrupt_group, &vfio_wrapper)?;
        let vfio_pci_device = VfioPciDevice {
            vm: vm.clone(),
            device,
            container,
            vfio_wrapper,
            common,
            iommu_attached,
        };
        Ok(vfio_pci_device)
    }
pub fn new ( vm : & Arc < dyn hypervisor :: Vm > , device : VfioDevice , container : Arc < VfioContainer > , msi_interrupt_manager : & Arc < dyn InterruptManager < GroupConfig = MsiIrqGroupConfig > > , legacy_interrupt_group : Option < Arc < dyn InterruptSourceGroup > > , iommu_attached : bool , bdf : PciBdf , ) -> Result < Self , VfioPciError > { let device = Arc :: new ( device ) ; device . reset ( ) ; let configuration = PciConfiguration :: new ( 0 , 0 , 0 , PciClassCode :: Other , & PciVfioSubclass :: VfioSubclass , None , PciHeaderType :: Device , 0 , 0 , None , ) ; let vfio_wrapper = VfioDeviceWrapper :: new ( Arc :: clone ( & device ) ) ; let mut common = VfioCommon { mmio_regions : Vec :: new ( ) , configuration , interrupt : Interrupt { intx : None , msi : None , msix : None , } , } ; common . parse_capabilities ( msi_interrupt_manager , & vfio_wrapper , bdf ) ; common . initialize_legacy_interrupt ( legacy_interrupt_group , & vfio_wrapper ) ? ; let vfio_pci_device = VfioPciDevice { vm : vm . clone ( ) , device , container , vfio_wrapper , common , iommu_attached , } ; Ok ( vfio_pci_device ) }
Constructs a new Vfio Pci device for the given Vfio device
Constructs a new Vfio Pci device for the given Vfio device
vm
&Arc<dyn hypervisor::Vm>
device
VfioDevice
container
Arc<VfioContainer>
msi_interrupt_manager
&Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>
legacy_interrupt_group
Option<Arc<dyn InterruptSourceGroup>>
iommu_attached
bool
bdf
PciBdf
vm
&Arc<dyn hypervisor::Vm>
device
VfioDevice
container
Arc<VfioContainer>
msi_interrupt_manager
&Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>
legacy_interrupt_group
Option<Arc<dyn InterruptSourceGroup>>
iommu_attached
bool
bdf
PciBdf