debuggers.hg
changeset 19611:026957d523f9
xend: modify the order of resetting/deassigning device.
When guest OS shutdowns or a device is hotremoved.
1. Xend resets devices.
2. Xend deassigns devices.
Because if devices are deassigned before the reset, dom0 memory may be
overwritten by DMA.
Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
When guest OS shutdowns or a device is hotremoved.
1. Xend resets devices.
2. Xend deassigns devices.
Because if devices are deassigned before the reset, dom0 memory may be
overwritten by DMA.
Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Fri Apr 24 13:19:37 2009 +0100 (2009-04-24) |
parents | 8b152638adaa |
children | 40156cbaf244 |
files | tools/python/xen/xend/server/pciif.py |
line diff
1.1 --- a/tools/python/xen/xend/server/pciif.py Thu Apr 23 16:22:48 2009 +0100 1.2 +++ b/tools/python/xen/xend/server/pciif.py Fri Apr 24 13:19:37 2009 +0100 1.3 @@ -489,13 +489,16 @@ class PciController(DevController): 1.4 "bind your slot/device to the PCI backend using sysfs" \ 1.5 )%(dev.name)) 1.6 1.7 - if not self.vm.info.is_hvm(): 1.8 - pci_str = "0x%x, 0x%x, 0x%x, 0x%x" % (domain, bus, slot, func) 1.9 - bdf = xc.deassign_device(fe_domid, pci_str) 1.10 - if bdf > 0: 1.11 - raise VmError("Failed to deassign device from IOMMU (%x:%x.%x)" 1.12 - % (bus, slot, func)) 1.13 - log.debug("pci: deassign device %x:%x.%x" % (bus, slot, func)) 1.14 + # Need to do FLR here before deassign device in order to terminate 1.15 + # DMA transaction, etc 1.16 + dev.do_FLR() 1.17 + 1.18 + pci_str = "0x%x, 0x%x, 0x%x, 0x%x" % (domain, bus, slot, func) 1.19 + bdf = xc.deassign_device(fe_domid, pci_str) 1.20 + if bdf > 0: 1.21 + raise VmError("Failed to deassign device from IOMMU (%x:%x.%x)" 1.22 + % (bus, slot, func)) 1.23 + log.debug("pci: Deassign device %x:%x.%x" % (bus, slot, func)) 1.24 1.25 for (start, size) in dev.ioports: 1.26 log.debug('pci: disabling ioport 0x%x/0x%x'%(start,size)) 1.27 @@ -528,7 +531,6 @@ class PciController(DevController): 1.28 if rc<0: 1.29 raise VmError(('pci: failed to configure irq on device '+ 1.30 '%s - errno=%d')%(dev.name,rc)) 1.31 - dev.do_FLR() 1.32 1.33 def cleanupDevice(self, devid): 1.34 """ Detach I/O resources for device and cleanup xenstore nodes