mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
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@eu.citrix.com>
This commit is contained in:
1 parent
04d6becec1
commit
42b2352e01
2 files changed
+11
-15
No files matched your search
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||