pub struct PassthroughDevice {
pub device_type: PassthroughDeviceType,
pub pci_config: PciConfigPassthrough,
pub mmio_regions: Vec<MmioRegion>,
pub msix_remaps: Vec<MsixRemap>,
pub assigned: bool,
pub owner_vm_id: u64,
}Expand description
A passthrough device assigned to a guest VM
Fields§
§device_type: PassthroughDeviceTypeDevice type
pci_config: PciConfigPassthroughPCI configuration space
mmio_regions: Vec<MmioRegion>MMIO regions mapped into guest
msix_remaps: Vec<MsixRemap>MSI-X vector remappings
assigned: boolWhether the device is currently assigned to a guest
owner_vm_id: u64VM ID that owns this device
Implementations§
Source§impl PassthroughDevice
impl PassthroughDevice
pub fn new( device_type: PassthroughDeviceType, vendor_id: u16, device_id: u16, bdf: u32, ) -> Self
Sourcepub fn assign_to_vm(&mut self, vm_id: u64) -> Result<(), VmError>
pub fn assign_to_vm(&mut self, vm_id: u64) -> Result<(), VmError>
Assign device to a VM
Sourcepub fn add_mmio_region(&mut self, host_phys: u64, guest_phys: u64, size: u64)
pub fn add_mmio_region(&mut self, host_phys: u64, guest_phys: u64, size: u64)
Add an MMIO region mapping
Sourcepub fn add_msix_remap(
&mut self,
host_vector: u16,
guest_vector: u16,
target_vcpu: u8,
)
pub fn add_msix_remap( &mut self, host_vector: u16, guest_vector: u16, target_vcpu: u8, )
Add an MSI-X remap entry
Sourcepub fn remap_interrupt(&self, host_vector: u16) -> Option<(u16, u8)>
pub fn remap_interrupt(&self, host_vector: u16) -> Option<(u16, u8)>
Look up guest vector for a host interrupt