TianoCore EDK2 master
Loading...
Searching...
No Matches
event_channel.h
1/******************************************************************************
2 * event_channel.h
3 *
4 * Event channels between domains.
5 *
6 * SPDX-License-Identifier: MIT
7 *
8 * Copyright (c) 2003-2004, K A Fraser.
9 */
10
11#ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
12#define __XEN_PUBLIC_EVENT_CHANNEL_H__
13
14#include "xen.h"
15
16/*
17 * `incontents 150 evtchn Event Channels
18 *
19 * Event channels are the basic primitive provided by Xen for event
20 * notifications. An event is the Xen equivalent of a hardware
21 * interrupt. They essentially store one bit of information, the event
22 * of interest is signalled by transitioning this bit from 0 to 1.
23 *
24 * Notifications are received by a guest via an upcall from Xen,
25 * indicating when an event arrives (setting the bit). Further
26 * notifications are masked until the bit is cleared again (therefore,
27 * guests must check the value of the bit after re-enabling event
28 * delivery to ensure no missed notifications).
29 *
30 * Event notifications can be masked by setting a flag; this is
31 * equivalent to disabling interrupts and can be used to ensure
32 * atomicity of certain operations in the guest kernel.
33 *
34 * Event channels are represented by the evtchn_* fields in
35 * struct shared_info and struct vcpu_info.
36 */
37
38/*
39 * ` enum neg_errnoval
40 * ` HYPERVISOR_event_channel_op(enum event_channel_op cmd, VOID *args)
41 * `
42 * @cmd == EVTCHNOP_* (event-channel operation).
43 * @args == struct evtchn_* Operation-specific extra arguments (NULL if none).
44 */
45
46/* ` enum event_channel_op { // EVTCHNOP_* => struct evtchn_* */
47#define EVTCHNOP_close 3
48#define EVTCHNOP_send 4
49#define EVTCHNOP_alloc_unbound 6
50/* ` } */
51
52typedef UINT32 evtchn_port_t;
53DEFINE_XEN_GUEST_HANDLE (evtchn_port_t);
54
55/*
56 * EVTCHNOP_alloc_unbound: Allocate a port in domain <dom> and mark as
57 * accepting interdomain bindings from domain <remote_dom>. A fresh port
58 * is allocated in <dom> and returned as <port>.
59 * NOTES:
60 * 1. If the caller is unprivileged then <dom> must be DOMID_SELF.
61 * 2. <rdom> may be DOMID_SELF, allowing loopback connections.
62 */
64 /* IN parameters */
65 domid_t dom, remote_dom;
66 /* OUT parameters */
67 evtchn_port_t port;
68};
69
71
72/*
73 * EVTCHNOP_close: Close a local event channel <port>. If the channel is
74 * interdomain then the remote end is placed in the unbound state
75 * (EVTCHNSTAT_unbound), awaiting a new connection.
76 */
78 /* IN parameters. */
79 evtchn_port_t port;
80};
81
82typedef struct evtchn_close evtchn_close_t;
83
84/*
85 * EVTCHNOP_send: Send an event to the remote end of the channel whose local
86 * endpoint is <port>.
87 */
89 /* IN parameters. */
90 evtchn_port_t port;
91};
92
93typedef struct evtchn_send evtchn_send_t;
94
95#endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */
96
97/*
98 * Local variables:
99 * mode: C
100 * c-file-style: "BSD"
101 * c-basic-offset: 4
102 * tab-width: 4
103 * indent-tabs-mode: nil
104 * End:
105 */