Path: blob/master/include/xen/interface/event_channel.h
10817 views
/******************************************************************************1* event_channel.h2*3* Event channels between domains.4*5* Copyright (c) 2003-2004, K A Fraser.6*/78#ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__9#define __XEN_PUBLIC_EVENT_CHANNEL_H__1011#include <xen/interface/xen.h>1213typedef uint32_t evtchn_port_t;14DEFINE_GUEST_HANDLE(evtchn_port_t);1516/*17* EVTCHNOP_alloc_unbound: Allocate a port in domain <dom> and mark as18* accepting interdomain bindings from domain <remote_dom>. A fresh port19* is allocated in <dom> and returned as <port>.20* NOTES:21* 1. If the caller is unprivileged then <dom> must be DOMID_SELF.22* 2. <rdom> may be DOMID_SELF, allowing loopback connections.23*/24#define EVTCHNOP_alloc_unbound 625struct evtchn_alloc_unbound {26/* IN parameters */27domid_t dom, remote_dom;28/* OUT parameters */29evtchn_port_t port;30};3132/*33* EVTCHNOP_bind_interdomain: Construct an interdomain event channel between34* the calling domain and <remote_dom>. <remote_dom,remote_port> must identify35* a port that is unbound and marked as accepting bindings from the calling36* domain. A fresh port is allocated in the calling domain and returned as37* <local_port>.38* NOTES:39* 2. <remote_dom> may be DOMID_SELF, allowing loopback connections.40*/41#define EVTCHNOP_bind_interdomain 042struct evtchn_bind_interdomain {43/* IN parameters. */44domid_t remote_dom;45evtchn_port_t remote_port;46/* OUT parameters. */47evtchn_port_t local_port;48};4950/*51* EVTCHNOP_bind_virq: Bind a local event channel to VIRQ <irq> on specified52* vcpu.53* NOTES:54* 1. A virtual IRQ may be bound to at most one event channel per vcpu.55* 2. The allocated event channel is bound to the specified vcpu. The binding56* may not be changed.57*/58#define EVTCHNOP_bind_virq 159struct evtchn_bind_virq {60/* IN parameters. */61uint32_t virq;62uint32_t vcpu;63/* OUT parameters. */64evtchn_port_t port;65};6667/*68* EVTCHNOP_bind_pirq: Bind a local event channel to PIRQ <irq>.69* NOTES:70* 1. A physical IRQ may be bound to at most one event channel per domain.71* 2. Only a sufficiently-privileged domain may bind to a physical IRQ.72*/73#define EVTCHNOP_bind_pirq 274struct evtchn_bind_pirq {75/* IN parameters. */76uint32_t pirq;77#define BIND_PIRQ__WILL_SHARE 178uint32_t flags; /* BIND_PIRQ__* */79/* OUT parameters. */80evtchn_port_t port;81};8283/*84* EVTCHNOP_bind_ipi: Bind a local event channel to receive events.85* NOTES:86* 1. The allocated event channel is bound to the specified vcpu. The binding87* may not be changed.88*/89#define EVTCHNOP_bind_ipi 790struct evtchn_bind_ipi {91uint32_t vcpu;92/* OUT parameters. */93evtchn_port_t port;94};9596/*97* EVTCHNOP_close: Close a local event channel <port>. If the channel is98* interdomain then the remote end is placed in the unbound state99* (EVTCHNSTAT_unbound), awaiting a new connection.100*/101#define EVTCHNOP_close 3102struct evtchn_close {103/* IN parameters. */104evtchn_port_t port;105};106107/*108* EVTCHNOP_send: Send an event to the remote end of the channel whose local109* endpoint is <port>.110*/111#define EVTCHNOP_send 4112struct evtchn_send {113/* IN parameters. */114evtchn_port_t port;115};116117/*118* EVTCHNOP_status: Get the current status of the communication channel which119* has an endpoint at <dom, port>.120* NOTES:121* 1. <dom> may be specified as DOMID_SELF.122* 2. Only a sufficiently-privileged domain may obtain the status of an event123* channel for which <dom> is not DOMID_SELF.124*/125#define EVTCHNOP_status 5126struct evtchn_status {127/* IN parameters */128domid_t dom;129evtchn_port_t port;130/* OUT parameters */131#define EVTCHNSTAT_closed 0 /* Channel is not in use. */132#define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/133#define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */134#define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */135#define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */136#define EVTCHNSTAT_ipi 5 /* Channel is bound to a virtual IPI line */137uint32_t status;138uint32_t vcpu; /* VCPU to which this channel is bound. */139union {140struct {141domid_t dom;142} unbound; /* EVTCHNSTAT_unbound */143struct {144domid_t dom;145evtchn_port_t port;146} interdomain; /* EVTCHNSTAT_interdomain */147uint32_t pirq; /* EVTCHNSTAT_pirq */148uint32_t virq; /* EVTCHNSTAT_virq */149} u;150};151152/*153* EVTCHNOP_bind_vcpu: Specify which vcpu a channel should notify when an154* event is pending.155* NOTES:156* 1. IPI- and VIRQ-bound channels always notify the vcpu that initialised157* the binding. This binding cannot be changed.158* 2. All other channels notify vcpu0 by default. This default is set when159* the channel is allocated (a port that is freed and subsequently reused160* has its binding reset to vcpu0).161*/162#define EVTCHNOP_bind_vcpu 8163struct evtchn_bind_vcpu {164/* IN parameters. */165evtchn_port_t port;166uint32_t vcpu;167};168169/*170* EVTCHNOP_unmask: Unmask the specified local event-channel port and deliver171* a notification to the appropriate VCPU if an event is pending.172*/173#define EVTCHNOP_unmask 9174struct evtchn_unmask {175/* IN parameters. */176evtchn_port_t port;177};178179struct evtchn_op {180uint32_t cmd; /* EVTCHNOP_* */181union {182struct evtchn_alloc_unbound alloc_unbound;183struct evtchn_bind_interdomain bind_interdomain;184struct evtchn_bind_virq bind_virq;185struct evtchn_bind_pirq bind_pirq;186struct evtchn_bind_ipi bind_ipi;187struct evtchn_close close;188struct evtchn_send send;189struct evtchn_status status;190struct evtchn_bind_vcpu bind_vcpu;191struct evtchn_unmask unmask;192} u;193};194DEFINE_GUEST_HANDLE_STRUCT(evtchn_op);195196#endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */197198199