L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
L4virtio::Device Class Reference

IPC interface for virtio over L4 IPC. More...

#include <l4virtio>

+ Inheritance diagram for L4virtio::Device:
+ Collaboration diagram for L4virtio::Device:

Public Member Functions

long set_status (unsigned status)
 Write the VIRTIO status register.
 
long config_queue (unsigned queue)
 Trigger queue configuration of the given queue.
 
long register_ds (L4::Ipc::Cap< L4Re::Dataspace > ds_cap, l4_uint64_t base, l4_umword_t offset, l4_umword_t size)
 Register a shared data space with VIRTIO host.
 
long device_config (L4::Ipc::Out< L4::Cap< L4Re::Dataspace > > config_ds, l4_addr_t *ds_offset)
 Get the dataspace with the L4virtio configuration page.
 
long device_notification_irq (unsigned index, L4::Ipc::Out< L4::Cap< L4::Triggerable > > irq)
 Get the notification interrupt corresponding to the given index.
 
- Public Member Functions inherited from L4::Icu
l4_msgtag_t bind (unsigned irqnum, L4::Cap< Triggerable > irq, l4_utcb_t *utcb=l4_utcb()) noexcept
 Bind an interrupt line of an interrupt controller to an interrupt object.
 
l4_msgtag_t unbind (unsigned irqnum, L4::Cap< Triggerable > irq, l4_utcb_t *utcb=l4_utcb()) noexcept
 Remove binding of an interrupt line from the interrupt controller object.
 
l4_msgtag_t info (l4_icu_info_t *info, l4_utcb_t *utcb=l4_utcb()) noexcept
 Get information about the ICU features.
 
l4_msgtag_t msi_info (l4_umword_t irqnum, l4_uint64_t source, l4_icu_msi_info_t *msi_info)
 Get MSI info about IRQ.
 
l4_msgtag_t mask (unsigned irqnum, l4_umword_t *label=0, l4_timeout_t to=L4_IPC_NEVER, l4_utcb_t *utcb=l4_utcb()) noexcept
 Mask an IRQ line.
 
l4_msgtag_t set_mode (unsigned irqnum, l4_umword_t mode, l4_utcb_t *utcb=l4_utcb()) noexcept
 Set interrupt mode.
 
- Public Member Functions inherited from L4::Irq_eoi
l4_msgtag_t unmask (unsigned irqnum, l4_umword_t *label=0, l4_timeout_t to=L4_IPC_NEVER, l4_utcb_t *utcb=l4_utcb()) noexcept
 Unmask the given interrupt line.
 

Additional Inherited Members

- Protected Types inherited from L4::Kobject_t< Device, L4::Icu, L4VIRTIO_PROTOCOL, L4::Type_info::Demand_t< 1 > >
typedef Device Class
 The target interface type (inheriting from Kobject_t)
 
typedef Typeid::Iface< PROTO, Device > __Iface
 The interface description for the derived class.
 
typedef Typeid::Merge_list< Typeid::Iface_list< __Iface >, typename Base::__Iface_list > __Iface_list
 The list of all RPC interfaces provided directly or through inheritance.
 
- Protected Types inherited from L4::Kobject_t< Icu, Irq_eoi, L4_PROTO_IRQ, Type_info::Demand_t< 1 > >
typedef Icu Class
 The target interface type (inheriting from Kobject_t)
 
typedef Typeid::Iface< PROTO, Icu__Iface
 The interface description for the derived class.
 
typedef Typeid::Merge_list< Typeid::Iface_list< __Iface >, typename Base::__Iface_list > __Iface_list
 The list of all RPC interfaces provided directly or through inheritance.
 
- Protected Member Functions inherited from L4::Kobject_t< Device, L4::Icu, L4VIRTIO_PROTOCOL, L4::Type_info::Demand_t< 1 > >
L4::Cap< Classc () const noexcept
 Get the capability to ourselves.
 
- Protected Member Functions inherited from L4::Kobject_t< Icu, Irq_eoi, L4_PROTO_IRQ, Type_info::Demand_t< 1 > >
L4::Cap< Classc () const noexcept
 Get the capability to ourselves.
 
- Static Protected Member Functions inherited from L4::Kobject_t< Device, L4::Icu, L4VIRTIO_PROTOCOL, L4::Type_info::Demand_t< 1 > >
static void __check_protocols__ () noexcept
 Helper to check for protocol conflicts.
 
- Static Protected Member Functions inherited from L4::Kobject_t< Icu, Irq_eoi, L4_PROTO_IRQ, Type_info::Demand_t< 1 > >
static void __check_protocols__ () noexcept
 Helper to check for protocol conflicts.
 

Detailed Description

IPC interface for virtio over L4 IPC.

The L4virtio protocol is an adaption of the mmio virtio transport 1.0(4). This interface allows to exchange the necessary resources: device configuration page, notification interrupts and dataspaces for payload.

Notification interrupts can be configured independently for changes to the configuration space and each queue through special L4virtio-specific notify_index fields in the config page and queue configuration. The interface distinguishes between device-to-driver and driver-to-device notification interrupts.

Device-to-driver interrupts are configured via the ICU interface. The device announces the maximum number of supported interrupts via Icu::info(). The driver can then bind interrupts using Icu::bind().

Driver-to-device interrupts must be requested from the device through device_notification_irq().

Definition at line 39 of file l4virtio.

Member Function Documentation

◆ config_queue()

long L4virtio::Device::config_queue ( unsigned  queue)

Trigger queue configuration of the given queue.

Usually all queues are configured when the status is written to running. However, in some cases queues shall be disabled or enabled dynamically, in this case this function triggers a reconfiguration from the shared memory register of the queue config.

Parameters
queueQueue index for the queue to be configured.
Return values
0on success.
-L4_EIOThe queue's status is invalid.
-L4_ERANGEThe queue index exceeds the number of queues.
-L4_EINVALOtherwise.

Referenced by L4virtio::Driver::Device::config_queue().

+ Here is the caller graph for this function:

◆ device_config()

long L4virtio::Device::device_config ( L4::Ipc::Out< L4::Cap< L4Re::Dataspace > >  config_ds,
l4_addr_t ds_offset 
)

Get the dataspace with the L4virtio configuration page.

Parameters
config_dsCapability for receiving the dataspace capability for the shared L4-VIRTIO config data space.
ds_offsetOffset into the dataspace where the device configuration structure starts.

Referenced by L4virtio::Driver::Device::driver_connect().

+ Here is the caller graph for this function:

◆ device_notification_irq()

long L4virtio::Device::device_notification_irq ( unsigned  index,
L4::Ipc::Out< L4::Cap< L4::Triggerable > >  irq 
)

Get the notification interrupt corresponding to the given index.

Parameters
indexIndex of the interrupt.
[out]irqTriggerable for the given index.
Return values
L4_EOKSuccess.
L4_ENOSYSIRQ notification not supported by device.
<0Other error.

An index is only guaranteed to return an IRQ object when the index is set in one of the device notify index fields. The device must return the same interrupt for a given index as long as the index is in use. If an index disappears as a result of a configuration change and then is reused later, the interrupt is not guaranteed to be the same.

Interrupts must always be rerequested after a device reset.

Referenced by L4virtio::Driver::Device::driver_connect().

+ Here is the caller graph for this function:

◆ register_ds()

long L4virtio::Device::register_ds ( L4::Ipc::Cap< L4Re::Dataspace ds_cap,
l4_uint64_t  base,
l4_umword_t  offset,
l4_umword_t  size 
)

Register a shared data space with VIRTIO host.

Parameters
ds_capDataspace capability to register. The lower 8 bits determine the rights mask with which the guest's rights are masked during the registration of the dataspace at the VIRTIO host.
baseVIRTIO guest physical start address of shared memory region
offsetOffset within the data space that is attached to the given base in the guest physical memory.
sizeSize of the memory region in the guest
Return values
L4_EOKOperation successful.
-L4_EINVALThe ds_cap capability is invalid, does not refer to a valid dataspace, is not a trusted dataspace if trusted dataspace validation is enabled, or size and offset specify an invalid region.
-L4_ENOMEMThe limit of dataspaces that can be registered has been reached or no capability slot could be allocated.
-L4_ERANGEoffset is lager than the size of the dataspace.
<0Any error returned by the dataspace when queried for information during setup or any error returned by the region manager from attaching the dataspace.

Referenced by L4virtio::Driver::Device::register_ds().

+ Here is the caller graph for this function:

◆ set_status()

long L4virtio::Device::set_status ( unsigned  status)

Write the VIRTIO status register.

Parameters
statusStatus word to write to the VIRTIO status.
Return values
0on success.
Note
All other registers are accessed via shared memory.

Referenced by L4virtio::Driver::Device::driver_acknowledge(), and L4virtio::Driver::Device::driver_connect().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: