L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
L4virtio::Svr::Device_t< DATA > Class Template Referenceabstract

Server-side L4-VIRTIO device stub. More...

#include <l4virtio>

+ Inheritance diagram for L4virtio::Svr::Device_t< DATA >:
+ Collaboration diagram for L4virtio::Svr::Device_t< DATA >:

Public Member Functions

virtual void reset ()=0
 reset callback, called for doing a device reset
 
virtual bool check_features ()
 callback for checking the subset of accepted features
 
virtual bool check_queues ()=0
 callback for checking if the queues at DRIVER_OK transition
 
virtual int reconfig_queue (unsigned idx)=0
 callback for client queue-config request
 
virtual void cfg_changed (unsigned)
 callback for client device configuration changes
 
virtual void register_single_driver_irq ()
 callback for registering a single guest IRQ for all queues (old-style)
 
virtual void trigger_driver_config_irq ()=0
 callback for triggering configuration change notification IRQ
 
virtual L4::Cap< L4::Irqdevice_notify_irq () const
 callback to gather the device notification IRQ (old-style)
 
virtual void register_driver_irq (unsigned idx)
 Callback for registering an notification IRQ (multi IRQ).
 
virtual L4::Cap< L4::Irqdevice_notify_irq (unsigned idx)
 Callback to gather the device notification IRQ (multi IRQ).
 
virtual unsigned num_events_supported () const
 Return the highest notification index supported.
 
 Device_t (Dev_config *dev_config)
 Make a device for the given config.
 
Mem_list const * mem_info () const
 Get the memory region list used for this device.
 
void reset_queue_config (unsigned idx, unsigned num_max, bool inc_generation=false)
 Trigger reset for the configuration space for queue idx.
 
void init_mem_info (unsigned num)
 Initialize the memory region list to the given maximum.
 
void device_error ()
 Transition device into DEVICE_NEEDS_RESET state.
 
bool setup_queue (Virtqueue *q, unsigned qn, unsigned num_max)
 Enable/disable the specified queue.
 
bool handle_mem_cmd_write ()
 Check for a value in the cmd register and handle a write.
 
void enable_trusted_ds_validation ()
 Enable trusted dataspace validation.
 
void add_trusted_dataspaces (std::shared_ptr< Ds_vector const > ds)
 Provide a list of trusted dataspaces that can be used for validation.
 

Protected Attributes

Mem_list _mem_info
 Memory region list.
 

Detailed Description

template<typename DATA>
class L4virtio::Svr::Device_t< DATA >

Server-side L4-VIRTIO device stub.

This stub supports new-style multi-event registration (using get_device_config(), bind() and get_device_notification_irq()).

Definition at line 795 of file l4virtio.

Member Function Documentation

◆ add_trusted_dataspaces()

template<typename DATA >
void L4virtio::Svr::Device_t< DATA >::add_trusted_dataspaces ( std::shared_ptr< Ds_vector const >  ds)
inline

Provide a list of trusted dataspaces that can be used for validation.

Parameters
dslist of trusted dataspaces.

Definition at line 1192 of file l4virtio.

◆ device_error()

template<typename DATA >
void L4virtio::Svr::Device_t< DATA >::device_error ( )
inline

Transition device into DEVICE_NEEDS_RESET state.

This function does a full reset, sets the DEVICE_NEEDS_RESET bit in the device status register, triggering a guest config IRQ if necessary. The driver still needs to perform its own reset and initialization sequence.

Definition at line 1018 of file l4virtio.

References L4virtio::Svr::Dev_status::driver_ok(), L4virtio::Svr::Device_t< DATA >::reset(), L4virtio::Svr::Dev_config::set_device_needs_reset(), L4virtio::Svr::Dev_config::status(), and L4virtio::Svr::Device_t< DATA >::trigger_driver_config_irq().

+ Here is the call graph for this function:

◆ device_notify_irq()

template<typename DATA >
virtual L4::Cap< L4::Irq > L4virtio::Svr::Device_t< DATA >::device_notify_irq ( unsigned  idx)
inlinevirtual

Callback to gather the device notification IRQ (multi IRQ).

The default implementation maps to the implementation for single IRQ notification points.

Definition at line 868 of file l4virtio.

References L4Re::chksys(), L4virtio::Svr::Device_t< DATA >::device_notify_irq(), and L4_ENOSYS.

+ Here is the call graph for this function:

◆ handle_mem_cmd_write()

template<typename DATA >
bool L4virtio::Svr::Device_t< DATA >::handle_mem_cmd_write ( )
inline

Check for a value in the cmd register and handle a write.

This function checks for a value in the cmd register and executes the command if there is any, or returns false if there was no command.

Execution of the command is signaled by a zero in the cmd register.

Definition at line 1148 of file l4virtio.

References L4virtio::Svr::Device_t< DATA >::cfg_changed(), L4virtio::Svr::Dev_config::get_cmd(), L4_LIKELY, L4VIRTIO_CMD_CFG_CHANGED, L4VIRTIO_CMD_CFG_QUEUE, L4VIRTIO_CMD_MASK, L4VIRTIO_CMD_SET_STATUS, L4virtio::Svr::Device_t< DATA >::reconfig_queue(), and L4virtio::Svr::Dev_config::reset_cmd().

+ Here is the call graph for this function:

◆ init_mem_info()

template<typename DATA >
void L4virtio::Svr::Device_t< DATA >::init_mem_info ( unsigned  num)
inline

Initialize the memory region list to the given maximum.

Parameters
numMaximum number of memory regions that can be managed.

Definition at line 1006 of file l4virtio.

References L4virtio::Svr::Device_t< DATA >::_mem_info.

◆ register_driver_irq()

template<typename DATA >
virtual void L4virtio::Svr::Device_t< DATA >::register_driver_irq ( unsigned  idx)
inlinevirtual

Callback for registering an notification IRQ (multi IRQ).

The default implementation maps to the implementation for single IRQ notification points.

Definition at line 854 of file l4virtio.

References L4Re::chksys(), L4_ENOSYS, and L4virtio::Svr::Device_t< DATA >::register_single_driver_irq().

+ Here is the call graph for this function:

◆ reset_queue_config()

template<typename DATA >
void L4virtio::Svr::Device_t< DATA >::reset_queue_config ( unsigned  idx,
unsigned  num_max,
bool  inc_generation = false 
)
inline

Trigger reset for the configuration space for queue idx.

Parameters
idxThe queue index to reset.
num_maxMaximum number of entries in this queue.
inc_generationThe config generation will be incremented when this is true.

This function resets the driver-readable configuration space for the queue with the given index. The queue configuration is reset to all 0, and the maximum number of entries in the queue is set to num_max.

Definition at line 996 of file l4virtio.

References L4virtio::Svr::Dev_config::reset_queue().

+ Here is the call graph for this function:

◆ setup_queue()

template<typename DATA >
bool L4virtio::Svr::Device_t< DATA >::setup_queue ( Virtqueue q,
unsigned  qn,
unsigned  num_max 
)
inline

Enable/disable the specified queue.

Parameters
qPointer to the ring that represents the virtqueue internally.
qnIndex of the queue.
num_maxMaximum number of supported entries in this queue.
Returns
true for success.
  • This function calculates the parameters of the virtqueue from the clients configuration space values, checks the accessibility of the queue data structures and initializes q to ready state when all checks succeeded.

Definition at line 1041 of file l4virtio.

References L4virtio::Svr::Device_t< DATA >::_mem_info, l4virtio_config_queue_t::avail_addr, L4virtio::Virtqueue::avail_size(), l4virtio_config_queue_t::desc_addr, L4virtio::Virtqueue::desc_size(), L4virtio::Virtqueue::disable(), L4_UNLIKELY, l4virtio_config_queue_t::num, L4virtio::Svr::Dev_config::qconfig(), l4virtio_config_queue_t::ready, L4virtio::Virtqueue::setup(), l4virtio_config_queue_t::used_addr, and L4virtio::Virtqueue::used_size().

Referenced by L4virtio::Svr::Console::Virtio_con::reconfig_queue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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