Struct devices::PciVirtualConfigMmio 
source · pub struct PciVirtualConfigMmio {
    pci_root: Arc<Mutex<PciRoot>>,
    register_bit_num: usize,
}Expand description
Inspired by PCI configuration space, CrosVM provides 2048 dword virtual registers (8KiB in total) for each PCI device. The guest can use these registers to exchange device-specific information with crosvm. The first 4kB is trapped by crosvm and crosvm supplies these register’s emulation. The second 4KB is mapped into guest directly as shared memory, so when guest access this 4KB, vm exit doesn’t happen. All these virtual registers from all PCI devices locate in a contiguous memory region. The base address of this memory region is provided by an IntObj named VCFG in the ACPI DSDT. Bit 12 is used to select the first trapped page or the second directly mapped page The offset of each register is calculated in the same way as PCIe ECAM; i.e. offset = (bus << 21) | (device << 16) | (function << 13) | (page_select << 12) | (register_index << 2)
Fields§
§pci_root: Arc<Mutex<PciRoot>>PCI root bridge.
register_bit_num: usizeRegister bit number in config address.
Implementations§
Trait Implementations§
source§impl BusDevice for PciVirtualConfigMmio
 
impl BusDevice for PciVirtualConfigMmio
source§fn debug_label(&self) -> String
 
fn debug_label(&self) -> String
source§fn device_id(&self) -> DeviceId
 
fn device_id(&self) -> DeviceId
source§fn read(&mut self, info: BusAccessInfo, data: &mut [u8])
 
fn read(&mut self, info: BusAccessInfo, data: &mut [u8])
offset from this devicesource§fn write(&mut self, info: BusAccessInfo, data: &[u8])
 
fn write(&mut self, info: BusAccessInfo, data: &[u8])
offset into this devicesource§fn config_register_write(
    &mut self,
    reg_idx: usize,
    offset: u64,
    data: &[u8],
) -> ConfigWriteResult
 
fn config_register_write( &mut self, reg_idx: usize, offset: u64, data: &[u8], ) -> ConfigWriteResult
source§fn config_register_read(&self, reg_idx: usize) -> u32
 
fn config_register_read(&self, reg_idx: usize) -> u32
source§fn init_pci_config_mapping(
    &mut self,
    shmem: &SharedMemory,
    base: usize,
    len: usize,
) -> bool
 
fn init_pci_config_mapping( &mut self, shmem: &SharedMemory, base: usize, len: usize, ) -> bool
source§fn virtual_config_register_write(&mut self, reg_idx: usize, value: u32)
 
fn virtual_config_register_write(&mut self, reg_idx: usize, value: u32)
source§fn virtual_config_register_read(&self, reg_idx: usize) -> u32
 
fn virtual_config_register_read(&self, reg_idx: usize) -> u32
source§fn on_sandboxed(&mut self)
 
fn on_sandboxed(&mut self)
source§fn get_ranges(&self) -> Vec<(BusRange, BusType)>
 
fn get_ranges(&self) -> Vec<(BusRange, BusType)>
source§fn destroy_device(&mut self)
 
fn destroy_device(&mut self)
source§impl Suspendable for PciVirtualConfigMmio
 
impl Suspendable for PciVirtualConfigMmio
source§fn sleep(&mut self) -> Result<()>
 
fn sleep(&mut self) -> Result<()>
source§fn wake(&mut self) -> Result<()>
 
fn wake(&mut self) -> Result<()>
source§fn snapshot(&mut self) -> Result<AnySnapshot>
 
fn snapshot(&mut self) -> Result<AnySnapshot>
Auto Trait Implementations§
impl Freeze for PciVirtualConfigMmio
impl RefUnwindSafe for PciVirtualConfigMmio
impl Send for PciVirtualConfigMmio
impl Sync for PciVirtualConfigMmio
impl Unpin for PciVirtualConfigMmio
impl UnwindSafe for PciVirtualConfigMmio
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
    T: Any,
 
impl<T> Downcast for Twhere
    T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
 
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
 
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
 
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
 
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.