pub struct IoManager { /* private fields */ }
Expand description
System IO manager serving for all devices management and VM exit handling.
Implementations§
Source§impl IoManager
impl IoManager
Sourcepub fn register_mmio_resources(
&mut self,
device: Arc<dyn DeviceMmio + Send + Sync>,
resources: &[Resource],
) -> Result<(), Error>
pub fn register_mmio_resources( &mut self, device: Arc<dyn DeviceMmio + Send + Sync>, resources: &[Resource], ) -> Result<(), Error>
Register a new MMIO device with its allocated resources. VMM is responsible for providing the allocated resources to virtual device.
§Arguments
device
: device instance object to be registeredresources
: resources that this device owns, might include port I/O and memory-mapped I/O ranges, irq number, etc.
Sourcepub fn register_pio_resources(
&mut self,
device: Arc<dyn DevicePio + Send + Sync>,
resources: &[Resource],
) -> Result<(), Error>
pub fn register_pio_resources( &mut self, device: Arc<dyn DevicePio + Send + Sync>, resources: &[Resource], ) -> Result<(), Error>
Register a new PIO device with its allocated resources. VMM is responsible for providing the allocated resources to virtual device.
§Arguments
device
: device instance object to be registeredresources
: resources that this device owns, might include port I/O and memory-mapped I/O ranges, irq number, etc.
Sourcepub fn register_resources<T: DeviceMmio + DevicePio + 'static + Send + Sync>(
&mut self,
device: Arc<T>,
resources: &[Resource],
) -> Result<(), Error>
pub fn register_resources<T: DeviceMmio + DevicePio + 'static + Send + Sync>( &mut self, device: Arc<T>, resources: &[Resource], ) -> Result<(), Error>
Register a new MMIO + PIO device with its allocated resources. VMM is responsible for providing the allocated resources to virtual device.
§Arguments
device
: device instance object to be registeredresources
: resources that this device owns, might include port I/O and memory-mapped I/O ranges, irq number, etc.
Sourcepub fn deregister_resources(&mut self, resources: &[Resource]) -> usize
pub fn deregister_resources(&mut self, resources: &[Resource]) -> usize
Deregister a device from IoManager
, e.g. users specified removing.
VMM pre-fetches the resources e.g. dev.get_assigned_resources()
VMM is responsible for freeing the resources. Returns the number
of deregistered devices.
§Arguments
resources
: resources that this device owns, might include port I/O and memory-mapped I/O ranges, irq number, etc.
Trait Implementations§
Source§impl BusManager<MmioAddress> for IoManager
impl BusManager<MmioAddress> for IoManager
Source§impl BusManager<PioAddress> for IoManager
impl BusManager<PioAddress> for IoManager
Auto Trait Implementations§
impl Freeze for IoManager
impl !RefUnwindSafe for IoManager
impl Send for IoManager
impl Sync for IoManager
impl Unpin for IoManager
impl !UnwindSafe for IoManager
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
Mutably borrows from an owned value. Read more
Source§impl<T> MmioManager for T
impl<T> MmioManager for T
Source§type D = <T as BusManager<MmioAddress>>::D
type D = <T as BusManager<MmioAddress>>::D
Type of the objects that can be registered with this
MmioManager
.Source§fn mmio_device(
&self,
addr: MmioAddress,
) -> Option<(&BusRange<MmioAddress>, &<T as MmioManager>::D)>
fn mmio_device( &self, addr: MmioAddress, ) -> Option<(&BusRange<MmioAddress>, &<T as MmioManager>::D)>
Return a reference to the device registered at
addr
, together with the associated
range, if available.Source§fn mmio_read(&self, addr: MmioAddress, data: &mut [u8]) -> Result<(), Error>
fn mmio_read(&self, addr: MmioAddress, data: &mut [u8]) -> Result<(), Error>
Dispatch a read operation to the device registered at
addr
.Source§fn mmio_write(&self, addr: MmioAddress, data: &[u8]) -> Result<(), Error>
fn mmio_write(&self, addr: MmioAddress, data: &[u8]) -> Result<(), Error>
Dispatch a write operation to the device registered at
addr
.Source§fn register_mmio(
&mut self,
range: BusRange<MmioAddress>,
device: <T as MmioManager>::D,
) -> Result<(), Error>
fn register_mmio( &mut self, range: BusRange<MmioAddress>, device: <T as MmioManager>::D, ) -> Result<(), Error>
Register the provided device with the specified range.
Source§fn deregister_mmio(
&mut self,
addr: MmioAddress,
) -> Option<(BusRange<MmioAddress>, <T as MmioManager>::D)>
fn deregister_mmio( &mut self, addr: MmioAddress, ) -> Option<(BusRange<MmioAddress>, <T as MmioManager>::D)>
Deregister the device currently registered at
addr
together with the
associated range.Source§impl<T> PioManager for T
impl<T> PioManager for T
Source§type D = <T as BusManager<PioAddress>>::D
type D = <T as BusManager<PioAddress>>::D
Type of the objects that can be registered with this
PioManager
.Source§fn pio_device(
&self,
addr: PioAddress,
) -> Option<(&BusRange<PioAddress>, &<T as PioManager>::D)>
fn pio_device( &self, addr: PioAddress, ) -> Option<(&BusRange<PioAddress>, &<T as PioManager>::D)>
Return a reference to the device registered at
addr
, together with the associated
range, if available.Source§fn pio_read(&self, addr: PioAddress, data: &mut [u8]) -> Result<(), Error>
fn pio_read(&self, addr: PioAddress, data: &mut [u8]) -> Result<(), Error>
Dispatch a read operation to the device registered at
addr
.Source§fn pio_write(&self, addr: PioAddress, data: &[u8]) -> Result<(), Error>
fn pio_write(&self, addr: PioAddress, data: &[u8]) -> Result<(), Error>
Dispatch a write operation to the device registered at
addr
.Source§fn register_pio(
&mut self,
range: BusRange<PioAddress>,
device: <T as PioManager>::D,
) -> Result<(), Error>
fn register_pio( &mut self, range: BusRange<PioAddress>, device: <T as PioManager>::D, ) -> Result<(), Error>
Register the provided device with the specified range.
Source§fn deregister_pio(
&mut self,
addr: PioAddress,
) -> Option<(BusRange<PioAddress>, <T as PioManager>::D)>
fn deregister_pio( &mut self, addr: PioAddress, ) -> Option<(BusRange<PioAddress>, <T as PioManager>::D)>
Deregister the device currently registered at
addr
together with the
associated range.