xenvm: evtchn: expand Xen event channel driver functionality
This commit adds new functions, which can be used for Xen event channel management (allocation, interdomain binding etc.). Such functionality is needed for Xen PV driver development in Zephyr. Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
This commit is contained in:
parent
f49d11d310
commit
a76b492f04
3 changed files with 233 additions and 2 deletions
|
@ -29,6 +29,68 @@ static void empty_callback(void *data)
|
|||
events_missed[port] = true;
|
||||
}
|
||||
|
||||
int alloc_unbound_event_channel(domid_t remote_dom)
|
||||
{
|
||||
int rc;
|
||||
struct evtchn_alloc_unbound alloc = {
|
||||
.dom = DOMID_SELF,
|
||||
.remote_dom = remote_dom,
|
||||
};
|
||||
|
||||
rc = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, &alloc);
|
||||
if (rc == 0) {
|
||||
rc = alloc.port;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int bind_interdomain_event_channel(domid_t remote_dom, evtchn_port_t remote_port,
|
||||
evtchn_cb_t cb, void *data)
|
||||
{
|
||||
int rc;
|
||||
struct evtchn_bind_interdomain bind = {
|
||||
.remote_dom = remote_dom,
|
||||
.remote_port = remote_port,
|
||||
};
|
||||
|
||||
rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain, &bind);
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = bind_event_channel(bind.local_port, cb, data);
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
return bind.local_port;
|
||||
}
|
||||
|
||||
int evtchn_status(evtchn_status_t *status)
|
||||
{
|
||||
return HYPERVISOR_event_channel_op(EVTCHNOP_status, status);
|
||||
}
|
||||
|
||||
int evtchn_close(evtchn_port_t port)
|
||||
{
|
||||
struct evtchn_close close = {
|
||||
.port = port,
|
||||
};
|
||||
|
||||
return HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
|
||||
}
|
||||
|
||||
int evtchn_set_priority(evtchn_port_t port, uint32_t priority)
|
||||
{
|
||||
struct evtchn_set_priority set = {
|
||||
.port = port,
|
||||
.priority = priority,
|
||||
};
|
||||
|
||||
return HYPERVISOR_event_channel_op(EVTCHNOP_set_priority, &set);
|
||||
}
|
||||
|
||||
void notify_evtchn(evtchn_port_t port)
|
||||
{
|
||||
struct evtchn_send send;
|
||||
|
@ -50,7 +112,6 @@ int bind_event_channel(evtchn_port_t port, evtchn_cb_t cb, void *data)
|
|||
__ASSERT(cb != NULL, "%s: NULL callback for evtchn #%u\n",
|
||||
__func__, port);
|
||||
|
||||
|
||||
if (event_channels[port].cb != empty_callback)
|
||||
LOG_WRN("%s: re-bind callback for evtchn #%u\n",
|
||||
__func__, port);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue