diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-10-06 17:02:38 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-10-06 17:02:38 +0100 |
commit | 07a233ac7c228b36a4c2a9abc09abbbeb04aab81 (patch) | |
tree | b632f65b28354172cdd71aed4caad902deb06e22 /tools/libxc | |
parent | c804adf4b64a5755c885b681c32591d2e67aa636 (diff) | |
download | xen-07a233ac7c228b36a4c2a9abc09abbbeb04aab81.tar.gz xen-07a233ac7c228b36a4c2a9abc09abbbeb04aab81.tar.bz2 xen-07a233ac7c228b36a4c2a9abc09abbbeb04aab81.zip |
User tools send evtchn notifications via /dev/xen/evtchn
rather than using hypercall directly.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/libxc')
-rw-r--r-- | tools/libxc/xc_evtchn.c | 81 | ||||
-rw-r--r-- | tools/libxc/xenctrl.h | 60 |
2 files changed, 7 insertions, 134 deletions
diff --git a/tools/libxc/xc_evtchn.c b/tools/libxc/xc_evtchn.c index ed6256654b..a318889b85 100644 --- a/tools/libxc/xc_evtchn.c +++ b/tools/libxc/xc_evtchn.c @@ -33,95 +33,22 @@ static int do_evtchn_op(int xc_handle, evtchn_op_t *op) int xc_evtchn_alloc_unbound(int xc_handle, - u32 remote_dom, u32 dom, - int *port) + u32 remote_dom) { int rc; evtchn_op_t op = { .cmd = EVTCHNOP_alloc_unbound, - .u.alloc_unbound.remote_dom = (domid_t)remote_dom, - .u.alloc_unbound.dom = (domid_t)dom, - .u.alloc_unbound.port = (port != NULL) ? *port : 0 }; + .u.alloc_unbound.dom = (domid_t)dom, + .u.alloc_unbound.remote_dom = (domid_t)remote_dom }; if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 ) - { - if ( port != NULL ) - *port = op.u.alloc_unbound.port; - } - - return rc; -} - - -int xc_evtchn_bind_interdomain(int xc_handle, - u32 dom1, - u32 dom2, - int *port1, - int *port2) -{ - int rc; - evtchn_op_t op = { - .cmd = EVTCHNOP_bind_interdomain, - .u.bind_interdomain.dom1 = (domid_t)dom1, - .u.bind_interdomain.dom2 = (domid_t)dom2, - .u.bind_interdomain.port1 = (port1 != NULL) ? *port1 : 0, - .u.bind_interdomain.port2 = (port2 != NULL) ? *port2 : 0 }; - - if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 ) - { - if ( port1 != NULL ) - *port1 = op.u.bind_interdomain.port1; - if ( port2 != NULL ) - *port2 = op.u.bind_interdomain.port2; - } - - return rc; -} - - -int xc_evtchn_bind_virq(int xc_handle, - int virq, - int *port) -{ - int rc; - evtchn_op_t op = { - .cmd = EVTCHNOP_bind_virq, - .u.bind_virq.virq = (u32)virq, - .u.bind_virq.vcpu = 0 }; - - if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 ) - { - if ( port != NULL ) - *port = op.u.bind_virq.port; - } + rc = op.u.alloc_unbound.port; return rc; } -int xc_evtchn_close(int xc_handle, - u32 dom, - int port) -{ - evtchn_op_t op = { - .cmd = EVTCHNOP_close, - .u.close.dom = (domid_t)dom, - .u.close.port = port }; - return do_evtchn_op(xc_handle, &op); -} - - -int xc_evtchn_send(int xc_handle, - int local_port) -{ - evtchn_op_t op = { - .cmd = EVTCHNOP_send, - .u.send.local_port = local_port }; - return do_evtchn_op(xc_handle, &op); -} - - int xc_evtchn_status(int xc_handle, u32 dom, int port, diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 3e74c62fa0..5ba19a891b 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -306,68 +306,14 @@ typedef evtchn_status_t xc_evtchn_status_t; * well-known port within a domain to receive events on. * * @parm xc_handle a handle to an open hypervisor interface - * @parm remote_dom the ID of the domain who will later bind * @parm dom the ID of the local domain (the 'allocatee') - * @parm port a pointer to a port. This is an in/out parameter. If *port is - * 0, then a new port will be assigned, if port is > 0 then that - * port is allocated if the port is unallocated. - * @return 0 on success, -1 on failure + * @parm remote_dom the ID of the domain who will later bind + * @return allocated port (in @dom) on success, -1 on failure */ int xc_evtchn_alloc_unbound(int xc_handle, - u32 remote_dom, u32 dom, - int *port); - -/** - * This function creates a pair of ports between two domains. A port can only - * be bound once within a domain. - * - * @parm xc_handle a handle to an open hypervisor interface - * @parm dom1 one of the two domains to connect. Can be DOMID_SELF. - * @parm dom2 the other domain to connect. Can be DOMID_SELF. - * @parm port1 an in/out parameter. If > 0, then try to connect *port. If - * 0, then allocate a new port and store the port in *port. - * @parm port2 the port connected on port2. This parameter behaves the same - * way as port1. - * @return 0 on success, -1 on error. - */ -int xc_evtchn_bind_interdomain(int xc_handle, - u32 dom1, - u32 dom2, - int *port1, - int *port2); -int xc_evtchn_bind_virq(int xc_handle, - int virq, - int *port); - -/** - * This function will close a single port on an event channel. - * - * @parm xc_handle a handle to an open hypervisor interface - * @parm dom the domain that the port exists on. May be DOMID_SELF. - * @parm port the port to close - * @return 0 on success, -1 on error - */ -int xc_evtchn_close(int xc_handle, - u32 dom, /* may be DOMID_SELF */ - int port); + u32 remote_dom); -/** - * This function generates a notify event on a bound port. - * - * Notifies can be read within Linux by opening /dev/xen/evtchn and reading - * a 16 bit value. The result will be the port the event occurred on. When - * events occur, the port is masked until the 16 bit port value is written back - * to the file. When /dev/xen/evtchn is opened, it has to be bound via an - * ioctl to each port to listen on. The ioctl for binding is _IO('E', 2). The - * parameter is the port to listen on. - * - * @parm xc_handle a handle to an open hypervisor interface - * @parm local_port the port to generate the notify on - * @return 0 on success, -1 on error - */ -int xc_evtchn_send(int xc_handle, - int local_port); int xc_evtchn_status(int xc_handle, u32 dom, /* may be DOMID_SELF */ int port, |