# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1258149284 0
# Node ID 377b7a8e0e0af8367b445cc317203ab1f97f9bdd
# Parent fdcf393e08dbb06512ac07e423cbab9bb1e38d0d
xend: call xc_assign_device for all the devices to hotplug
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>
---
tools/python/xen/xend/XendDomainInfo.py | 5 ++++-
tools/python/xen/xend/server/pciif.py | 21 +++++++--------------
2 files changed, 11 insertions(+), 15 deletions(-)
diff -r fdcf393e08db -r 377b7a8e0e0a tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Fri Nov 13 21:09:33 2009 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py Fri Nov 13 21:54:44 2009 +0000
@@ -766,6 +766,10 @@ class XendDomainInfo:
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 @@ class XendDomainInfo:
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 fdcf393e08db -r 377b7a8e0e0a tools/python/xen/xend/server/pciif.py
--- a/tools/python/xen/xend/server/pciif.py Fri Nov 13 21:09:33 2009 +0000
+++ b/tools/python/xen/xend/server/pciif.py Fri Nov 13 21:54:44 2009 +0000
@@ -444,15 +444,7 @@ class PciController(DevController):
# 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 @@ class PciController(DevController):
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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|