diff options
author | Jan Beulich <jbeulich@suse.com> | 2011-09-22 18:26:54 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2011-09-22 18:26:54 +0100 |
commit | 6865e52b78f4c542e7d53155f7f013016ebfa4ec (patch) | |
tree | 45825ddef27bf733162cf4da5adaaec147994198 /tools/python | |
parent | 1b0061ac2b57297e7d7211ce6f4e1b197b8e0ec2 (diff) | |
download | xen-6865e52b78f4c542e7d53155f7f013016ebfa4ec.tar.gz xen-6865e52b78f4c542e7d53155f7f013016ebfa4ec.tar.bz2 xen-6865e52b78f4c542e7d53155f7f013016ebfa4ec.zip |
PCI multi-seg: adjust domctl interface
Again, a couple of directly related functions at once get adjusted to
account for the segment number.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Diffstat (limited to 'tools/python')
-rw-r--r-- | tools/python/xen/lowlevel/xc/xc.c | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 2600b90060..c9e54b957c 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -609,7 +609,7 @@ static PyObject *pyxc_test_assign_device(XcObject *self, { uint32_t dom; char *pci_str; - int32_t bdf = 0; + int32_t sbdf = 0; int seg, bus, dev, func; static char *kwd_list[] = { "domid", "pci", NULL }; @@ -619,20 +619,21 @@ static PyObject *pyxc_test_assign_device(XcObject *self, while ( next_bdf(&pci_str, &seg, &bus, &dev, &func) ) { - bdf |= (bus & 0xff) << 16; - bdf |= (dev & 0x1f) << 11; - bdf |= (func & 0x7) << 8; + sbdf = seg << 16; + sbdf |= (bus & 0xff) << 8; + sbdf |= (dev & 0x1f) << 3; + sbdf |= (func & 0x7); - if ( xc_test_assign_device(self->xc_handle, dom, bdf) != 0 ) + if ( xc_test_assign_device(self->xc_handle, dom, sbdf) != 0 ) { if (errno == ENOSYS) - bdf = -1; + sbdf = -1; break; } - bdf = 0; + sbdf = 0; } - return Py_BuildValue("i", bdf); + return Py_BuildValue("i", sbdf); } static PyObject *pyxc_assign_device(XcObject *self, @@ -641,7 +642,7 @@ static PyObject *pyxc_assign_device(XcObject *self, { uint32_t dom; char *pci_str; - int32_t bdf = 0; + int32_t sbdf = 0; int seg, bus, dev, func; static char *kwd_list[] = { "domid", "pci", NULL }; @@ -651,20 +652,21 @@ static PyObject *pyxc_assign_device(XcObject *self, while ( next_bdf(&pci_str, &seg, &bus, &dev, &func) ) { - bdf |= (bus & 0xff) << 16; - bdf |= (dev & 0x1f) << 11; - bdf |= (func & 0x7) << 8; + sbdf = seg << 16; + sbdf |= (bus & 0xff) << 8; + sbdf |= (dev & 0x1f) << 3; + sbdf |= (func & 0x7); - if ( xc_assign_device(self->xc_handle, dom, bdf) != 0 ) + if ( xc_assign_device(self->xc_handle, dom, sbdf) != 0 ) { if (errno == ENOSYS) - bdf = -1; + sbdf = -1; break; } - bdf = 0; + sbdf = 0; } - return Py_BuildValue("i", bdf); + return Py_BuildValue("i", sbdf); } static PyObject *pyxc_deassign_device(XcObject *self, @@ -673,7 +675,7 @@ static PyObject *pyxc_deassign_device(XcObject *self, { uint32_t dom; char *pci_str; - int32_t bdf = 0; + int32_t sbdf = 0; int seg, bus, dev, func; static char *kwd_list[] = { "domid", "pci", NULL }; @@ -683,26 +685,27 @@ static PyObject *pyxc_deassign_device(XcObject *self, while ( next_bdf(&pci_str, &seg, &bus, &dev, &func) ) { - bdf |= (bus & 0xff) << 16; - bdf |= (dev & 0x1f) << 11; - bdf |= (func & 0x7) << 8; + sbdf = seg << 16; + sbdf |= (bus & 0xff) << 8; + sbdf |= (dev & 0x1f) << 3; + sbdf |= (func & 0x7); - if ( xc_deassign_device(self->xc_handle, dom, bdf) != 0 ) + if ( xc_deassign_device(self->xc_handle, dom, sbdf) != 0 ) { if (errno == ENOSYS) - bdf = -1; + sbdf = -1; break; } - bdf = 0; + sbdf = 0; } - return Py_BuildValue("i", bdf); + return Py_BuildValue("i", sbdf); } static PyObject *pyxc_get_device_group(XcObject *self, PyObject *args) { - uint32_t bdf = 0; + uint32_t sbdf; uint32_t max_sdevs, num_sdevs; int domid, seg, bus, dev, func, rc, i; PyObject *Pystr; @@ -720,12 +723,13 @@ static PyObject *pyxc_get_device_group(XcObject *self, if (sdev_array == NULL) return PyErr_NoMemory(); - bdf |= (bus & 0xff) << 16; - bdf |= (dev & 0x1f) << 11; - bdf |= (func & 0x7) << 8; + sbdf = seg << 16; + sbdf |= (bus & 0xff) << 8; + sbdf |= (dev & 0x1f) << 3; + sbdf |= (func & 0x7); rc = xc_get_device_group(self->xc_handle, - domid, bdf, max_sdevs, &num_sdevs, sdev_array); + domid, sbdf, max_sdevs, &num_sdevs, sdev_array); if ( rc < 0 ) { |