^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * event_channel.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Event channels between domains.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (c) 2003-2004, K A Fraser.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define __XEN_PUBLIC_EVENT_CHANNEL_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <xen/interface/xen.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) typedef uint32_t evtchn_port_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) DEFINE_GUEST_HANDLE(evtchn_port_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * EVTCHNOP_alloc_unbound: Allocate a port in domain <dom> and mark as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * accepting interdomain bindings from domain <remote_dom>. A fresh port
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * is allocated in <dom> and returned as <port>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * NOTES:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * 1. If the caller is unprivileged then <dom> must be DOMID_SELF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * 2. <rdom> may be DOMID_SELF, allowing loopback connections.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define EVTCHNOP_alloc_unbound 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct evtchn_alloc_unbound {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /* IN parameters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) domid_t dom, remote_dom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) /* OUT parameters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) evtchn_port_t port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * EVTCHNOP_bind_interdomain: Construct an interdomain event channel between
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * the calling domain and <remote_dom>. <remote_dom,remote_port> must identify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * a port that is unbound and marked as accepting bindings from the calling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * domain. A fresh port is allocated in the calling domain and returned as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * <local_port>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * NOTES:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * 2. <remote_dom> may be DOMID_SELF, allowing loopback connections.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define EVTCHNOP_bind_interdomain 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct evtchn_bind_interdomain {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) /* IN parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) domid_t remote_dom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) evtchn_port_t remote_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) /* OUT parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) evtchn_port_t local_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * EVTCHNOP_bind_virq: Bind a local event channel to VIRQ <irq> on specified
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * vcpu.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * NOTES:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * 1. A virtual IRQ may be bound to at most one event channel per vcpu.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * 2. The allocated event channel is bound to the specified vcpu. The binding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * may not be changed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #define EVTCHNOP_bind_virq 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) struct evtchn_bind_virq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) /* IN parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) uint32_t virq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) uint32_t vcpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) /* OUT parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) evtchn_port_t port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * EVTCHNOP_bind_pirq: Bind a local event channel to PIRQ <irq>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * NOTES:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) * 1. A physical IRQ may be bound to at most one event channel per domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * 2. Only a sufficiently-privileged domain may bind to a physical IRQ.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #define EVTCHNOP_bind_pirq 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct evtchn_bind_pirq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) /* IN parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) uint32_t pirq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #define BIND_PIRQ__WILL_SHARE 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) uint32_t flags; /* BIND_PIRQ__* */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) /* OUT parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) evtchn_port_t port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * EVTCHNOP_bind_ipi: Bind a local event channel to receive events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * NOTES:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * 1. The allocated event channel is bound to the specified vcpu. The binding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * may not be changed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #define EVTCHNOP_bind_ipi 7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) struct evtchn_bind_ipi {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) uint32_t vcpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) /* OUT parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) evtchn_port_t port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * EVTCHNOP_close: Close a local event channel <port>. If the channel is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * interdomain then the remote end is placed in the unbound state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) * (EVTCHNSTAT_unbound), awaiting a new connection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define EVTCHNOP_close 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct evtchn_close {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /* IN parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) evtchn_port_t port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) * EVTCHNOP_send: Send an event to the remote end of the channel whose local
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * endpoint is <port>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #define EVTCHNOP_send 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) struct evtchn_send {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /* IN parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) evtchn_port_t port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * EVTCHNOP_status: Get the current status of the communication channel which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) * has an endpoint at <dom, port>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) * NOTES:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) * 1. <dom> may be specified as DOMID_SELF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * 2. Only a sufficiently-privileged domain may obtain the status of an event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * channel for which <dom> is not DOMID_SELF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #define EVTCHNOP_status 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) struct evtchn_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) /* IN parameters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) domid_t dom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) evtchn_port_t port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) /* OUT parameters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #define EVTCHNSTAT_closed 0 /* Channel is not in use. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) #define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) #define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) #define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) #define EVTCHNSTAT_ipi 5 /* Channel is bound to a virtual IPI line */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) uint32_t status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) uint32_t vcpu; /* VCPU to which this channel is bound. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) domid_t dom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) } unbound; /* EVTCHNSTAT_unbound */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) domid_t dom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) evtchn_port_t port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) } interdomain; /* EVTCHNSTAT_interdomain */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) uint32_t pirq; /* EVTCHNSTAT_pirq */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) uint32_t virq; /* EVTCHNSTAT_virq */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) } u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) * EVTCHNOP_bind_vcpu: Specify which vcpu a channel should notify when an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) * event is pending.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) * NOTES:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) * 1. IPI- and VIRQ-bound channels always notify the vcpu that initialised
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) * the binding. This binding cannot be changed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) * 2. All other channels notify vcpu0 by default. This default is set when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * the channel is allocated (a port that is freed and subsequently reused
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) * has its binding reset to vcpu0).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) #define EVTCHNOP_bind_vcpu 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct evtchn_bind_vcpu {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) /* IN parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) evtchn_port_t port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) uint32_t vcpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) * EVTCHNOP_unmask: Unmask the specified local event-channel port and deliver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) * a notification to the appropriate VCPU if an event is pending.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) #define EVTCHNOP_unmask 9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) struct evtchn_unmask {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /* IN parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) evtchn_port_t port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) * EVTCHNOP_reset: Close all event channels associated with specified domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) * NOTES:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * 1. <dom> may be specified as DOMID_SELF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) * 2. Only a sufficiently-privileged domain may specify other than DOMID_SELF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) #define EVTCHNOP_reset 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) struct evtchn_reset {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) /* IN parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) domid_t dom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) typedef struct evtchn_reset evtchn_reset_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * EVTCHNOP_init_control: initialize the control block for the FIFO ABI.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) #define EVTCHNOP_init_control 11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) struct evtchn_init_control {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) /* IN parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) uint64_t control_gfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) uint32_t offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) uint32_t vcpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) /* OUT parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) uint8_t link_bits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) uint8_t _pad[7];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) * EVTCHNOP_expand_array: add an additional page to the event array.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) #define EVTCHNOP_expand_array 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) struct evtchn_expand_array {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) /* IN parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) uint64_t array_gfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) * EVTCHNOP_set_priority: set the priority for an event channel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) #define EVTCHNOP_set_priority 13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) struct evtchn_set_priority {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) /* IN parameters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) evtchn_port_t port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) uint32_t priority;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) struct evtchn_op {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) uint32_t cmd; /* EVTCHNOP_* */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) struct evtchn_alloc_unbound alloc_unbound;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) struct evtchn_bind_interdomain bind_interdomain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) struct evtchn_bind_virq bind_virq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) struct evtchn_bind_pirq bind_pirq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) struct evtchn_bind_ipi bind_ipi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) struct evtchn_close close;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) struct evtchn_send send;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) struct evtchn_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) struct evtchn_bind_vcpu bind_vcpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) struct evtchn_unmask unmask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) } u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) DEFINE_GUEST_HANDLE_STRUCT(evtchn_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) * 2-level ABI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) #define EVTCHN_2L_NR_CHANNELS (sizeof(xen_ulong_t) * sizeof(xen_ulong_t) * 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) * FIFO ABI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) /* Events may have priorities from 0 (highest) to 15 (lowest). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) #define EVTCHN_FIFO_PRIORITY_MAX 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) #define EVTCHN_FIFO_PRIORITY_DEFAULT 7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) #define EVTCHN_FIFO_PRIORITY_MIN 15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) #define EVTCHN_FIFO_MAX_QUEUES (EVTCHN_FIFO_PRIORITY_MIN + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) typedef uint32_t event_word_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) #define EVTCHN_FIFO_PENDING 31
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) #define EVTCHN_FIFO_MASKED 30
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) #define EVTCHN_FIFO_LINKED 29
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) #define EVTCHN_FIFO_BUSY 28
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) #define EVTCHN_FIFO_LINK_BITS 17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) #define EVTCHN_FIFO_LINK_MASK ((1 << EVTCHN_FIFO_LINK_BITS) - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) #define EVTCHN_FIFO_NR_CHANNELS (1 << EVTCHN_FIFO_LINK_BITS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) struct evtchn_fifo_control_block {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) uint32_t ready;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) uint32_t _rsvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) event_word_t head[EVTCHN_FIFO_MAX_QUEUES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) #endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */