Struct IoManager

Source
pub struct IoManager { /* private fields */ }
Expand description

System IO manager serving for all devices management and VM exit handling.

Implementations§

Source§

impl IoManager

Source

pub fn new() -> Self

Create an default IoManager with empty IO member.

Source

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 registered
  • resources: resources that this device owns, might include port I/O and memory-mapped I/O ranges, irq number, etc.
Source

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 registered
  • resources: resources that this device owns, might include port I/O and memory-mapped I/O ranges, irq number, etc.
Source

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 registered
  • resources: resources that this device owns, might include port I/O and memory-mapped I/O ranges, irq number, etc.
Source

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

Source§

type D = Arc<dyn DeviceMmio + Send + Sync>

Type of the objects held by the bus.
Source§

fn bus(&self) -> &MmioBus<Arc<dyn DeviceMmio + Send + Sync>>

Return a reference to the bus.
Source§

fn bus_mut(&mut self) -> &mut MmioBus<Arc<dyn DeviceMmio + Send + Sync>>

Return a mutable reference to the bus.
Source§

impl BusManager<PioAddress> for IoManager

Source§

type D = Arc<dyn DevicePio + Send + Sync>

Type of the objects held by the bus.
Source§

fn bus(&self) -> &PioBus<Arc<dyn DevicePio + Send + Sync>>

Return a reference to the bus.
Source§

fn bus_mut(&mut self) -> &mut PioBus<Arc<dyn DevicePio + Send + Sync>>

Return a mutable reference to the bus.
Source§

impl Default for IoManager

Source§

fn default() -> IoManager

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MmioManager for T

Source§

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)>

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>

Dispatch a read operation to the device registered at addr.
Source§

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>

Register the provided device with the specified range.
Source§

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

Source§

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)>

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>

Dispatch a read operation to the device registered at addr.
Source§

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>

Register the provided device with the specified range.
Source§

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.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.