123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
#ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
#define __XEN_PUBLIC_EVENT_CHANNEL_H__
#include <xen/interface/xen.h>
typedef uint32_t evtchn_port_t;
DEFINE_GUEST_HANDLE(evtchn_port_t);
#define EVTCHNOP_alloc_unbound 6
struct evtchn_alloc_unbound {
domid_t dom, remote_dom;
evtchn_port_t port;
};
#define EVTCHNOP_bind_interdomain 0
struct evtchn_bind_interdomain {
domid_t remote_dom;
evtchn_port_t remote_port;
evtchn_port_t local_port;
};
#define EVTCHNOP_bind_virq 1
struct evtchn_bind_virq {
uint32_t virq;
uint32_t vcpu;
evtchn_port_t port;
};
#define EVTCHNOP_bind_pirq 2
struct evtchn_bind_pirq {
uint32_t pirq;
#define BIND_PIRQ__WILL_SHARE 1
uint32_t flags;
evtchn_port_t port;
};
#define EVTCHNOP_bind_ipi 7
struct evtchn_bind_ipi {
uint32_t vcpu;
evtchn_port_t port;
};
#define EVTCHNOP_close 3
struct evtchn_close {
evtchn_port_t port;
};
#define EVTCHNOP_send 4
struct evtchn_send {
evtchn_port_t port;
};
#define EVTCHNOP_status 5
struct evtchn_status {
domid_t dom;
evtchn_port_t port;
#define EVTCHNSTAT_closed 0 /* Channel is not in use. */
#define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/
#define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
#define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
#define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
#define EVTCHNSTAT_ipi 5 /* Channel is bound to a virtual IPI line */
uint32_t status;
uint32_t vcpu;
union {
struct {
domid_t dom;
} unbound;
struct {
domid_t dom;
evtchn_port_t port;
} interdomain;
uint32_t pirq;
uint32_t virq;
} u;
};
#define EVTCHNOP_bind_vcpu 8
struct evtchn_bind_vcpu {
evtchn_port_t port;
uint32_t vcpu;
};
#define EVTCHNOP_unmask 9
struct evtchn_unmask {
evtchn_port_t port;
};
#define EVTCHNOP_reset 10
struct evtchn_reset {
domid_t dom;
};
typedef struct evtchn_reset evtchn_reset_t;
#define EVTCHNOP_init_control 11
struct evtchn_init_control {
uint64_t control_gfn;
uint32_t offset;
uint32_t vcpu;
uint8_t link_bits;
uint8_t _pad[7];
};
#define EVTCHNOP_expand_array 12
struct evtchn_expand_array {
uint64_t array_gfn;
};
#define EVTCHNOP_set_priority 13
struct evtchn_set_priority {
evtchn_port_t port;
uint32_t priority;
};
struct evtchn_op {
uint32_t cmd;
union {
struct evtchn_alloc_unbound alloc_unbound;
struct evtchn_bind_interdomain bind_interdomain;
struct evtchn_bind_virq bind_virq;
struct evtchn_bind_pirq bind_pirq;
struct evtchn_bind_ipi bind_ipi;
struct evtchn_close close;
struct evtchn_send send;
struct evtchn_status status;
struct evtchn_bind_vcpu bind_vcpu;
struct evtchn_unmask unmask;
} u;
};
DEFINE_GUEST_HANDLE_STRUCT(evtchn_op);
#define EVTCHN_2L_NR_CHANNELS (sizeof(xen_ulong_t) * sizeof(xen_ulong_t) * 64)
#define EVTCHN_FIFO_PRIORITY_MAX 0
#define EVTCHN_FIFO_PRIORITY_DEFAULT 7
#define EVTCHN_FIFO_PRIORITY_MIN 15
#define EVTCHN_FIFO_MAX_QUEUES (EVTCHN_FIFO_PRIORITY_MIN + 1)
typedef uint32_t event_word_t;
#define EVTCHN_FIFO_PENDING 31
#define EVTCHN_FIFO_MASKED 30
#define EVTCHN_FIFO_LINKED 29
#define EVTCHN_FIFO_BUSY 28
#define EVTCHN_FIFO_LINK_BITS 17
#define EVTCHN_FIFO_LINK_MASK ((1 << EVTCHN_FIFO_LINK_BITS) - 1)
#define EVTCHN_FIFO_NR_CHANNELS (1 << EVTCHN_FIFO_LINK_BITS)
struct evtchn_fifo_control_block {
uint32_t ready;
uint32_t _rsvd;
event_word_t head[EVTCHN_FIFO_MAX_QUEUES];
};
#endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */