Skip to content

Commit 5852dd2

Browse files
firscityfabiobaltieri
authored andcommitted
xen: events: add event channel allocation for domain-0
This commit adds interface for evtchn allocation that can be used by privilaged domain. Domain 0 can specify both dom and remote_dom parameters for hypercall, where in others domains dom should be always DOMID_SELF. It is needed for creating pre-defined channels during domain setup in Zephyr Dom0. Signed-off-by: Dmytro Firsov <[email protected]>
1 parent c9d2fb7 commit 5852dd2

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

drivers/xen/events.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ int alloc_unbound_event_channel(domid_t remote_dom)
4747
return rc;
4848
}
4949

50+
#ifdef CONFIG_XEN_DOM0
51+
int alloc_unbound_event_channel_dom0(domid_t dom, domid_t remote_dom)
52+
{
53+
int rc;
54+
struct evtchn_alloc_unbound alloc = {
55+
.dom = dom,
56+
.remote_dom = remote_dom,
57+
};
58+
59+
rc = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, &alloc);
60+
if (rc == 0) {
61+
rc = alloc.port;
62+
}
63+
64+
return rc;
65+
}
66+
#endif /* CONFIG_XEN_DOM0 */
67+
5068
int bind_interdomain_event_channel(domid_t remote_dom, evtchn_port_t remote_port,
5169
evtchn_cb_t cb, void *data)
5270
{

include/zephyr/xen/events.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ void notify_evtchn(evtchn_port_t port);
3636
*/
3737
int alloc_unbound_event_channel(domid_t remote_dom);
3838

39+
#ifdef CONFIG_XEN_DOM0
40+
/*
41+
* Allocate event-channel between remote domains. Can be used only from Dom0.
42+
*
43+
* @param dom - first remote domain domid (may be DOMID_SELF)
44+
* @param remote_dom - second remote domain domid
45+
* @return - local event channel port on success, negative on error
46+
*/
47+
int alloc_unbound_event_channel_dom0(domid_t dom, domid_t remote_dom);
48+
#endif /* CONFIG_XEN_DOM0 */
49+
3950
/*
4051
* Allocate local event channel, binded to remote port and attach specified callback
4152
* to it

0 commit comments

Comments
 (0)