[XEN] New event-channel reset operation.

Plumbed through libxenctrl to python.

From: Andrei Petrov <andrei.petrov@xensource.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
kfraser@localhost.localdomain committed 2007-01-19 17:20:57 +00:00
1 parent f272b20670
commit 115209d91b
5 files changed
+79 -1

No files matched your search

+8 -1
View File
@@ -37,7 +37,7 @@ int xc_evtchn_alloc_unbound(int xc_handle,
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
@@ -49,3 +49,10 @@ int xc_evtchn_alloc_unbound(int xc_handle,
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));
}
+3
View File
@@ -432,6 +432,9 @@ int xc_evtchn_alloc_unbound(int xc_handle,
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,
+24
View File
@@ -478,6 +478,24 @@ static PyObject *pyxc_evtchn_alloc_unbound(XcObject *self,
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)
@@ -1202,6 +1220,12 @@ static PyMethodDef pyxc_methods[] = {
" 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"
+31
View File
@@ -735,6 +735,29 @@ static long evtchn_unmask(evtchn_unmask_t *unmask)
}
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;
@@ -833,6 +856,14 @@ long do_event_channel_op(int cmd, XEN_GUEST_HANDLE(void) arg)
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;
+13
View File
@@ -216,6 +216,19 @@ struct evtchn_unmask {
};
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.
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.