mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
MSI 2/6: change the pirq to be per-domain
Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com> Signed-off-by: Shan Haitao <haitao.shan@intel.com>
This commit is contained in:
1 parent
154c5516cb
commit
ca0074e519
18 files changed
+529
-25
No files matched your search
@@ -799,6 +799,26 @@ static PyObject *pyxc_evtchn_reset(XcObject *self,
|
||||
return zero;
|
||||
}
|
||||
|
||||
static PyObject *pyxc_physdev_map_pirq(PyObject *self,
|
||||
PyObject *args,
|
||||
PyObject *kwds)
|
||||
{
|
||||
XcObject *xc = (XcObject *)self;
|
||||
uint32_t dom;
|
||||
int index, pirq, ret;
|
||||
|
||||
static char *kwd_list[] = {"domid", "index", "pirq", NULL};
|
||||
|
||||
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list,
|
||||
&dom, &index, &pirq) )
|
||||
return NULL;
|
||||
ret = xc_physdev_map_pirq(xc->xc_handle, dom, MAP_PIRQ_TYPE_GSI,
|
||||
index, &pirq);
|
||||
if ( ret != 0 )
|
||||
return pyxc_error_to_exception();
|
||||
return PyLong_FromUnsignedLong(pirq);
|
||||
}
|
||||
|
||||
static PyObject *pyxc_physdev_pci_access_modify(XcObject *self,
|
||||
PyObject *args,
|
||||
PyObject *kwds)
|
||||
@@ -1589,6 +1609,15 @@ static PyMethodDef pyxc_methods[] = {
|
||||
"Reset all connections.\n"
|
||||
" dom [int]: Domain to reset.\n" },
|
||||
|
||||
{ "physdev_map_pirq",
|
||||
(PyCFunction)pyxc_physdev_map_pirq,
|
||||
METH_VARARGS | METH_KEYWORDS, "\n"
|
||||
"map physical irq to guest pirq.\n"
|
||||
" dom [int]: Identifier of domain to map for.\n"
|
||||
" index [int]: physical irq.\n"
|
||||
" pirq [int]: guest pirq.\n"
|
||||
"Returns: [long] value of the param.\n" },
|
||||
|
||||
{ "physdev_pci_access_modify",
|
||||
(PyCFunction)pyxc_physdev_pci_access_modify,
|
||||
METH_VARARGS | METH_KEYWORDS, "\n"
|
||||
|
||||
@@ -69,5 +69,10 @@ class IRQController(DevController):
|
||||
#todo non-fatal
|
||||
raise VmError(
|
||||
'irq: Failed to configure irq: %d' % (pirq))
|
||||
|
||||
rc = xc.physdev_map_pirq(domid = self.getDomid(),
|
||||
index = pirq,
|
||||
pirq = pirq)
|
||||
if rc < 0:
|
||||
raise VmError(
|
||||
'irq: Failed to map irq %x' % (pirq))
|
||||
return (None, {}, {})
|
||||
@@ -271,6 +271,12 @@ class PciController(DevController):
|
||||
if rc<0:
|
||||
raise VmError(('pci: failed to configure I/O memory on device '+
|
||||
'%s - errno=%d')%(dev.name,rc))
|
||||
rc = xc.physdev_map_pirq(domid = fe_domid,
|
||||
index = dev.irq,
|
||||
pirq = dev.irq)
|
||||
if rc < 0:
|
||||
raise VmError(('pci: failed to map irq on device '+
|
||||
'%s - errno=%d')%(dev.name,rc))
|
||||
|
||||
if dev.irq>0:
|
||||
log.debug('pci: enabling irq %d'%dev.irq)
|
||||
|
||||