mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
Allow non-privileged domains restricted access to
I/O memory and physical interrupts, under control of domain0. Capabilities are maintained as rangesets in Xen. Signed-off-by: Ryan Wilson <hap9@epoch.ncsc.mil> Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
a8f5fb8508
commit
7e127cd35f
23 files changed
+276
-59
No files matched your search
@@ -774,6 +774,52 @@ static PyObject *pyxc_domain_ioport_permission(XcObject *self,
|
||||
return zero;
|
||||
}
|
||||
|
||||
static PyObject *pyxc_domain_irq_permission(PyObject *self,
|
||||
PyObject *args,
|
||||
PyObject *kwds)
|
||||
{
|
||||
XcObject *xc = (XcObject *)self;
|
||||
uint32_t dom;
|
||||
int pirq, allow_access, ret;
|
||||
|
||||
static char *kwd_list[] = { "dom", "pirq", "allow_access", NULL };
|
||||
|
||||
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list,
|
||||
&dom, &pirq, &allow_access) )
|
||||
return NULL;
|
||||
|
||||
ret = xc_domain_irq_permission(
|
||||
xc->xc_handle, dom, pirq, allow_access);
|
||||
if ( ret != 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
Py_INCREF(zero);
|
||||
return zero;
|
||||
}
|
||||
|
||||
static PyObject *pyxc_domain_iomem_permission(PyObject *self,
|
||||
PyObject *args,
|
||||
PyObject *kwds)
|
||||
{
|
||||
XcObject *xc = (XcObject *)self;
|
||||
uint32_t dom;
|
||||
unsigned long first_pfn, nr_pfns, allow_access, ret;
|
||||
|
||||
static char *kwd_list[] = { "dom", "first_pfn", "nr_pfns", "allow_access", NULL };
|
||||
|
||||
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "illi", kwd_list,
|
||||
&dom, &first_pfn, &nr_pfns, &allow_access) )
|
||||
return NULL;
|
||||
|
||||
ret = xc_domain_iomem_permission(
|
||||
xc->xc_handle, dom, first_pfn, nr_pfns, allow_access);
|
||||
if ( ret != 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
Py_INCREF(zero);
|
||||
return zero;
|
||||
}
|
||||
|
||||
|
||||
static PyObject *dom_op(XcObject *self, PyObject *args,
|
||||
int (*fn)(int, uint32_t))
|
||||
@@ -1070,6 +1116,25 @@ static PyMethodDef pyxc_methods[] = {
|
||||
" allow_access [int]: Non-zero means enable access; else disable access\n\n"
|
||||
"Returns: [int] 0 on success; -1 on error.\n" },
|
||||
|
||||
{ "domain_irq_permission",
|
||||
(PyCFunction)pyxc_domain_irq_permission,
|
||||
METH_VARARGS | METH_KEYWORDS, "\n"
|
||||
"Allow a domain access to a physical IRQ\n"
|
||||
" dom [int]: Identifier of domain to be allowed access.\n"
|
||||
" pirq [int]: The Physical IRQ\n"
|
||||
" allow_access [int]: Non-zero means enable access; else disable access\n\n"
|
||||
"Returns: [int] 0 on success; -1 on error.\n" },
|
||||
|
||||
{ "domain_iomem_permission",
|
||||
(PyCFunction)pyxc_domain_iomem_permission,
|
||||
METH_VARARGS | METH_KEYWORDS, "\n"
|
||||
"Allow a domain access to a range of IO memory pages\n"
|
||||
" dom [int]: Identifier of domain to be allowed access.\n"
|
||||
" first_pfn [long]: First page of I/O Memory\n"
|
||||
" nr_pfns [long]: Number of pages of I/O Memory (>0)\n"
|
||||
" allow_access [int]: Non-zero means enable access; else disable access\n\n"
|
||||
"Returns: [int] 0 on success; -1 on error.\n" },
|
||||
|
||||
{ "pages_to_kib",
|
||||
(PyCFunction)pyxc_pages_to_kib,
|
||||
METH_VARARGS, "\n"
|
||||
|
||||