mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
vt-d: Test device assignability in xend, but defer actual assignment to qemu-dm.
Signed-off-by: Weidong Han <weidong.han@intel.com>
This commit is contained in:
1 parent
f94a35ea70
commit
239ad70fb2
7 files changed
+66
-17
No files matched your search
@@ -560,9 +560,9 @@ static int next_bdf(char **str, int *seg, int *bus, int *dev, int *func)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static PyObject *pyxc_assign_device(XcObject *self,
|
||||
PyObject *args,
|
||||
PyObject *kwds)
|
||||
static PyObject *pyxc_test_assign_device(XcObject *self,
|
||||
PyObject *args,
|
||||
PyObject *kwds)
|
||||
{
|
||||
uint32_t dom;
|
||||
char *pci_str;
|
||||
@@ -580,7 +580,7 @@ static PyObject *pyxc_assign_device(XcObject *self,
|
||||
bdf |= (dev & 0x1f) << 11;
|
||||
bdf |= (func & 0x7) << 8;
|
||||
|
||||
if ( xc_assign_device(self->xc_handle, dom, bdf) != 0 )
|
||||
if ( xc_test_assign_device(self->xc_handle, dom, bdf) != 0 )
|
||||
break;
|
||||
|
||||
bdf = 0;
|
||||
@@ -1426,10 +1426,10 @@ static PyMethodDef pyxc_methods[] = {
|
||||
" value [long]: Value of param.\n"
|
||||
"Returns: [int] 0 on success.\n" },
|
||||
|
||||
{ "assign_device",
|
||||
(PyCFunction)pyxc_assign_device,
|
||||
{ "test_assign_device",
|
||||
(PyCFunction)pyxc_test_assign_device,
|
||||
METH_VARARGS | METH_KEYWORDS, "\n"
|
||||
"assign device with VT-d.\n"
|
||||
"test device assignment with VT-d.\n"
|
||||
" dom [int]: Identifier of domain to build into.\n"
|
||||
" pci_str [str]: PCI devices.\n"
|
||||
"Returns: [int] 0 on success, or device bdf that can't be assigned.\n" },
|
||||
|
||||
@@ -1653,10 +1653,10 @@ class XendDomainInfo:
|
||||
# Set maximum number of vcpus in domain
|
||||
xc.domain_max_vcpus(self.domid, int(self.info['VCPUs_max']))
|
||||
|
||||
# Assign devices with VT-d
|
||||
# Test whether the devices can be assigned with VT-d
|
||||
pci_str = str(self.info["platform"].get("pci"))
|
||||
if hvm and pci_str:
|
||||
bdf = xc.assign_device(self.domid, pci_str)
|
||||
bdf = xc.test_assign_device(self.domid, pci_str)
|
||||
if bdf != 0:
|
||||
bus = (bdf >> 16) & 0xff
|
||||
devfn = (bdf >> 8) & 0xff
|
||||
|
||||