Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Allocate, bind, and service Xen event channels from Zephyr. More...

Files

file  events.h
 Xen event channel services.

Typedefs

typedef void(* evtchn_cb_t) (void *priv)
 Event-channel callback signature.

Functions

int evtchn_status (evtchn_status_t *status)
 Query the status of an event channel.
int evtchn_close (evtchn_port_t port)
 Close a local event channel.
int evtchn_set_priority (evtchn_port_t port, uint32_t priority)
 Set the Xen priority assigned to an event channel.
int notify_evtchn (evtchn_port_t port)
 Send a notification over an event channel.
int alloc_unbound_event_channel (domid_t remote_dom)
 Allocate an unbound event channel for the calling domain.
int alloc_unbound_event_channel_dom0 (domid_t dom, domid_t remote_dom)
 Allocate an unbound event channel between two domains.
int bind_interdomain_event_channel (domid_t remote_dom, evtchn_port_t remote_port, evtchn_cb_t cb, void *data)
 Bind to a remote event channel and register a callback.
int bind_event_channel (evtchn_port_t port, evtchn_cb_t cb, void *data)
 Attach a callback to an already allocated local event channel.
int unbind_event_channel (evtchn_port_t port)
 Remove the callback bound to an event channel.
int get_missed_events (evtchn_port_t port)
 Get and clear the missed-event state for an unbound channel.
int mask_event_channel (evtchn_port_t port)
 Mask local delivery for an event channel.
int unmask_event_channel (evtchn_port_t port)
 Unmask local delivery for an event channel.
void clear_event_channel (evtchn_port_t port)
 Clear the pending bit for an event channel.
int xen_events_init (void)
 Initialize Xen event handling for the current guest.

Detailed Description

Allocate, bind, and service Xen event channels from Zephyr.

Typedef Documentation

◆ evtchn_cb_t

typedef void(* evtchn_cb_t) (void *priv)

#include <zephyr/xen/events.h>

Event-channel callback signature.

The callback runs from the Xen event interrupt handler.

Parameters
privUser data pointer that was registered with the event channel.

Function Documentation

◆ alloc_unbound_event_channel()

int alloc_unbound_event_channel ( domid_t remote_dom)

#include <zephyr/xen/events.h>

Allocate an unbound event channel for the calling domain.

Attention
Available only when the following Kconfig option is enabled: CONFIG_XEN_EVENTS.
Parameters
remote_domDomain that may bind to the allocated channel.
Returns
Local event-channel port on success, negative errno value on failure.

◆ alloc_unbound_event_channel_dom0()

int alloc_unbound_event_channel_dom0 ( domid_t dom,
domid_t remote_dom )

#include <zephyr/xen/events.h>

Allocate an unbound event channel between two domains.

Attention
Available only when the following Kconfig options are enabled: CONFIG_XEN_EVENTS, CONFIG_XEN_DOM0.
Parameters
domDomain that receives the new local port. May be DOMID_SELF.
remote_domPeer domain that may bind to the port.
Returns
Local event-channel port on success, negative errno value on failure.

◆ bind_event_channel()

int bind_event_channel ( evtchn_port_t port,
evtchn_cb_t cb,
void * data )

#include <zephyr/xen/events.h>

Attach a callback to an already allocated local event channel.

Attention
Available only when the following Kconfig option is enabled: CONFIG_XEN_EVENTS.
Parameters
portLocal event-channel port number.
cbCallback to invoke when the port is signaled.
dataUser data pointer passed to cb.
Return values
0on success.

◆ bind_interdomain_event_channel()

int bind_interdomain_event_channel ( domid_t remote_dom,
evtchn_port_t remote_port,
evtchn_cb_t cb,
void * data )

#include <zephyr/xen/events.h>

Bind to a remote event channel and register a callback.

Attention
Available only when the following Kconfig option is enabled: CONFIG_XEN_EVENTS.
Parameters
remote_domPeer domain that already owns remote_port.
remote_portEvent-channel port in remote_dom.
cbCallback invoked when the local channel fires.
dataUser data pointer passed to cb.
Returns
Local event-channel port on success, negative errno value on failure.

◆ clear_event_channel()

void clear_event_channel ( evtchn_port_t port)

#include <zephyr/xen/events.h>

Clear the pending bit for an event channel.

Attention
Available only when the following Kconfig option is enabled: CONFIG_XEN_EVENTS.
Parameters
portLocal event-channel port number.

◆ evtchn_close()

int evtchn_close ( evtchn_port_t port)

#include <zephyr/xen/events.h>

Close a local event channel.

Attention
Available only when the following Kconfig option is enabled: CONFIG_XEN_EVENTS.
Parameters
portLocal event-channel port to close.
Returns
0 on success, negative errno value on failure.

◆ evtchn_set_priority()

int evtchn_set_priority ( evtchn_port_t port,
uint32_t priority )

#include <zephyr/xen/events.h>

Set the Xen priority assigned to an event channel.

Attention
Available only when the following Kconfig option is enabled: CONFIG_XEN_EVENTS.
Parameters
portLocal event-channel port to update.
priorityXen event priority value.
Returns
0 on success, negative errno value on failure.

◆ evtchn_status()

int evtchn_status ( evtchn_status_t * status)

#include <zephyr/xen/events.h>

Query the status of an event channel.

Attention
Available only when the following Kconfig option is enabled: CONFIG_XEN_EVENTS.

The caller provides the input domain and port in status, and Xen fills the remaining fields with the current channel state.

Parameters
[in,out]statusEvent-channel status request and response buffer.
Returns
0 on success, negative errno value on failure.

◆ get_missed_events()

int get_missed_events ( evtchn_port_t port)

#include <zephyr/xen/events.h>

Get and clear the missed-event state for an unbound channel.

Attention
Available only when the following Kconfig option is enabled: CONFIG_XEN_EVENTS.
Parameters
portLocal event-channel port number.
Return values
1At least one event was recorded while no callback was bound.
0Otherwise.

◆ mask_event_channel()

int mask_event_channel ( evtchn_port_t port)

#include <zephyr/xen/events.h>

Mask local delivery for an event channel.

Attention
Available only when the following Kconfig option is enabled: CONFIG_XEN_EVENTS.
Parameters
portLocal event-channel port number.
Return values
0Always returned after updating the shared-info mask bit.

◆ notify_evtchn()

int notify_evtchn ( evtchn_port_t port)

#include <zephyr/xen/events.h>

Send a notification over an event channel.

Attention
Available only when the following Kconfig option is enabled: CONFIG_XEN_EVENTS.
Parameters
portLocal event-channel port to notify.
Returns
0 on success, negative errno value on failure.

◆ unbind_event_channel()

int unbind_event_channel ( evtchn_port_t port)

#include <zephyr/xen/events.h>

Remove the callback bound to an event channel.

Attention
Available only when the following Kconfig option is enabled: CONFIG_XEN_EVENTS.

The channel remains allocated, but subsequent notifications are recorded as missed events until another callback is registered.

Parameters
portLocal event-channel port number.
Return values
0on success.

◆ unmask_event_channel()

int unmask_event_channel ( evtchn_port_t port)

#include <zephyr/xen/events.h>

Unmask local delivery for an event channel.

Attention
Available only when the following Kconfig option is enabled: CONFIG_XEN_EVENTS.
Parameters
portLocal event-channel port number.
Return values
0Always returned after updating the shared-info mask bit.

◆ xen_events_init()

int xen_events_init ( void )

#include <zephyr/xen/events.h>

Initialize Xen event handling for the current guest.

Attention
Available only when the following Kconfig option is enabled: CONFIG_XEN_EVENTS.

This function prepares the per-port callback table and connects the Zephyr ISR to the Xen event interrupt described by devicetree.

Returns
0 on success, negative errno value on failure.
Return values
-EINVALXen shared-info page is not mapped.