Plumbed through libxenctrl to python.
From: Andrei Petrov <andrei.petrov@xensource.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
uint32_t dom,
uint32_t remote_dom)
{
- int rc;
+ int rc;
struct evtchn_alloc_unbound arg = {
.dom = (domid_t)dom,
.remote_dom = (domid_t)remote_dom
return rc;
}
+
+int xc_evtchn_reset(int xc_handle,
+ uint32_t dom)
+{
+ struct evtchn_reset arg = { .dom = (domid_t)dom };
+ return do_evtchn_op(xc_handle, EVTCHNOP_reset, &arg, sizeof(arg));
+}
uint32_t dom,
uint32_t remote_dom);
+int xc_evtchn_reset(int xc_handle,
+ uint32_t dom);
+
int xc_physdev_pci_access_modify(int xc_handle,
uint32_t domid,
int bus,
return PyInt_FromLong(port);
}
+static PyObject *pyxc_evtchn_reset(XcObject *self,
+ PyObject *args,
+ PyObject *kwds)
+{
+ uint32_t dom;
+
+ static char *kwd_list[] = { "dom", NULL };
+
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
+ return NULL;
+
+ if ( xc_evtchn_reset(self->xc_handle, dom) < 0 )
+ return pyxc_error_to_exception();
+
+ Py_INCREF(zero);
+ return zero;
+}
+
static PyObject *pyxc_physdev_pci_access_modify(XcObject *self,
PyObject *args,
PyObject *kwds)
" remote_dom [int]: Remote domain to accept connections from.\n\n"
"Returns: [int] Unbound event-channel port.\n" },
+ { "evtchn_reset",
+ (PyCFunction)pyxc_evtchn_reset,
+ METH_VARARGS | METH_KEYWORDS, "\n"
+ "Reset all connections.\n"
+ " dom [int]: Domain to reset.\n" },
+
{ "physdev_pci_access_modify",
(PyCFunction)pyxc_physdev_pci_access_modify,
METH_VARARGS | METH_KEYWORDS, "\n"
}
+static long evtchn_reset(evtchn_reset_t *r)
+{
+ domid_t dom = r->dom;
+ struct domain *d;
+ int i;
+
+ if ( dom == DOMID_SELF )
+ dom = current->domain->domain_id;
+ else if ( !IS_PRIV(current->domain) )
+ return -EPERM;
+
+ if ( (d = find_domain_by_id(dom)) == NULL )
+ return -ESRCH;
+
+ for ( i = 0; port_is_valid(d, i); i++ )
+ (void)__evtchn_close(d, i);
+
+ put_domain(d);
+
+ return 0;
+}
+
+
long do_event_channel_op(int cmd, XEN_GUEST_HANDLE(void) arg)
{
long rc;
break;
}
+ case EVTCHNOP_reset: {
+ struct evtchn_reset reset;
+ if ( copy_from_guest(&reset, arg, 1) != 0 )
+ return -EFAULT;
+ rc = evtchn_reset(&reset);
+ break;
+ }
+
default:
rc = -ENOSYS;
break;
};
typedef struct evtchn_unmask evtchn_unmask_t;
+/*
+ * EVTCHNOP_reset: Close all event channels associated with specified domain.
+ * NOTES:
+ * 1. <dom> may be specified as DOMID_SELF.
+ * 2. Only a sufficiently-privileged domain may specify other than DOMID_SELF.
+ */
+#define EVTCHNOP_reset 10
+struct evtchn_reset {
+ /* IN parameters. */
+ domid_t dom;
+};
+typedef struct evtchn_reset evtchn_reset_t;
+
/*
* Argument to event_channel_op_compat() hypercall. Superceded by new
* event_channel_op() hypercall since 0x00030202.