Hi all,
this patch fixes a couple of issues with pci passthrough in xend,
previously reported by Cui Dexuan.
The main problem is that xc_assign_device is called only for the first
device hotplugged into the guest and not the followings.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
diff -r 247e02819273 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Mon Nov 09 11:27:06 2009 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py Fri Nov 13 14:34:04 2009 +0000
@@ -766,6 +766,10 @@
bdf_str = "%s@%02x%s" % (pci_dict_to_bdf_str(new_dev),
int(new_dev['vdevfn'], 16), opts)
log.debug("XendDomainInfo.hvm_pci_device_insert_dev: %s" % bdf_str)
+ bdf = xc.assign_device(self.domid, pci_dict_to_xc_str(new_dev))
+ if bdf > 0:
+ raise VmError("Failed to assign device to IOMMU (%s)" %
bdf_str)
+ log.debug("pci: assign device %s" % bdf_str)
self.image.signalDeviceModel('pci-ins', 'pci-inserted', bdf_str)
vdevfn =
xstransact.Read("/local/domain/0/device-model/%i/parameter"
@@ -921,7 +925,6 @@
existing_pci_conf = self.info['devices'][existing_dev_uuid][1]
devid = self._createDevice('pci', existing_pci_conf)
self.info['devices'][existing_dev_uuid][1]['devid'] = devid
- return True
if self.domid is not None:
# use DevController.reconfigureDevice to change device config
diff -r 247e02819273 tools/python/xen/xend/server/pciif.py
--- a/tools/python/xen/xend/server/pciif.py Mon Nov 09 11:27:06 2009 +0000
+++ b/tools/python/xen/xend/server/pciif.py Fri Nov 13 14:34:04 2009 +0000
@@ -444,15 +444,7 @@
# For hvm guest, (from c/s 19679 on) assigning device statically and
# dynamically both go through reconfigureDevice(), so HERE the
# setupOneDevice() is not necessary.
- if self.vm.info.is_hvm():
- for pci_dev in pci_dev_list:
- # Setup IOMMU device assignment
- bdf = xc.assign_device(self.getDomid(),
pci_dict_to_xc_str(pci_dev))
- pci_str = pci_dict_to_bdf_str(pci_dev)
- if bdf > 0:
- raise VmError("Failed to assign device to IOMMU (%s)" %
pci_str)
- log.debug("pci: assign device %s" % pci_str)
- else :
+ if not self.vm.info.is_hvm():
for d in pci_dev_list:
self.setupOneDevice(d)
wPath = '/local/domain/0/backend/pci/%u/0/aerState' % (self.getDomid())
@@ -492,11 +484,12 @@
dev.do_FLR(self.vm.info.is_hvm(),
xoptions.get_pci_dev_assign_strict_check())
- bdf = xc.deassign_device(fe_domid, pci_dict_to_xc_str(pci_dev))
- pci_str = pci_dict_to_bdf_str(pci_dev)
- if bdf > 0:
- raise VmError("Failed to deassign device from IOMMU (%s)" %
pci_str)
- log.debug("pci: Deassign device %s" % pci_str)
+ if not self.vm.info.is_stubdom() :
+ bdf = xc.deassign_device(fe_domid, pci_dict_to_xc_str(pci_dev))
+ pci_str = pci_dict_to_bdf_str(pci_dev)
+ if bdf > 0:
+ raise VmError("Failed to deassign device from IOMMU (%s)" %
pci_str)
+ log.debug("pci: Deassign device %s" % pci_str)
for (start, size) in dev.ioports:
log.debug('pci: disabling ioport 0x%x/0x%x'%(start,size))
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|