[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xend: allow pv_ops kernel driver pci-stub to hide devices for assignment
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1246877324 -3600 # Node ID d33a665b2c05b0785637330074c285034571faf1 # Parent 8f6dd1671599ff39405a01cdcecb989e62238974 xend: allow pv_ops kernel driver pci-stub to hide devices for assignment pciback is used by VT-d to hide device for assigment. But in pv-ops dom0, pciback is not supported yet. Fortunately, pci-stub module is used to hide device in Linux for KVM VT-d device assignment and it's included in pv-ops dom0. So can use pci-stub to hide devices for assignment. Device must be hidden before assignment. Control panel has checks if devices can be assigned or not, and can list assignable devices via reading devices owned by pciback. This patch changes the checks, and also list assignable devices which are owned by pci-stub. Use pci-stub to hide devices, and use this patch to pass checkes in control panel, device assignemnt with VT-d works on Xen with pv-ops dom0. Signed-off-by: Weidong Han <weidong.han@xxxxxxxxx> --- tools/python/xen/util/pci.py | 18 ++++++++++++++-- tools/python/xen/xend/XendDomainInfo.py | 2 - tools/python/xen/xend/XendNode.py | 2 - tools/python/xen/xend/server/pciif.py | 34 +++++++++++--------------------- 4 files changed, 29 insertions(+), 27 deletions(-) diff -r 8f6dd1671599 -r d33a665b2c05 tools/python/xen/util/pci.py --- a/tools/python/xen/util/pci.py Mon Jul 06 11:47:34 2009 +0100 +++ b/tools/python/xen/util/pci.py Mon Jul 06 11:48:44 2009 +0100 @@ -33,6 +33,7 @@ SYSFS_PCI_DEV_SUBDEVICE_PATH = '/subsyst SYSFS_PCI_DEV_SUBDEVICE_PATH = '/subsystem_device' SYSFS_PCI_DEV_CLASS_PATH = '/class' SYSFS_PCIBACK_PATH = '/bus/pci/drivers/pciback/' +SYSFS_PCISTUB_PATH = '/bus/pci/drivers/pci-stub/' LSPCI_CMD = 'lspci' @@ -450,7 +451,10 @@ def restore_pci_conf_space(pci_cfg_list) os.write(fd, dw) os.close(fd) -def find_all_devices_owned_by_pciback(): +def find_all_assignable_devices(): + ''' devices owned by pcibak or pci-stub can be directly assigned to + guest with IOMMU (VT-d or AMD IOMMU), find all these devices. + ''' sysfs_mnt = find_sysfs_mnt() pciback_path = sysfs_mnt + SYSFS_PCIBACK_PATH pci_names = os.popen('ls ' + pciback_path).read() @@ -459,6 +463,14 @@ def find_all_devices_owned_by_pciback(): for pci in pci_list: dev = PciDevice(parse_pci_name(pci)) dev_list = dev_list + [dev] + + pcistub_path = sysfs_mnt + SYSFS_PCISTUB_PATH + pci_names = os.popen('ls ' + pcistub_path).read() + pci_list = extract_the_exact_pci_names(pci_names) + for pci in pci_list: + dev = PciDevice(parse_pci_name(pci)) + dev_list = dev_list + [dev] + return dev_list def transform_list(target, src): @@ -921,10 +933,10 @@ class PciDevice: return for pci_dev in devs: dev = PciDevice(parse_pci_name(pci_dev)) - if dev.driver == 'pciback': + if dev.driver == 'pciback' or dev.driver == 'pci-stub': continue err_msg = 'pci: %s must be co-assigned to the same guest with %s' + \ - ', but it is not owned by pciback.' + ', but it is not owned by pciback or pci-stub.' raise PciDeviceAssignmentError(err_msg % (pci_dev, self.name)) def do_FLR(self): diff -r 8f6dd1671599 -r d33a665b2c05 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Mon Jul 06 11:47:34 2009 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Mon Jul 06 11:48:44 2009 +0100 @@ -716,7 +716,7 @@ class XendDomainInfo: except Exception, e: raise VmError("pci: failed to locate device and "+ "parse it's resources - "+str(e)) - if pci_device.driver!='pciback': + if pci_device.driver!='pciback' and pci_device.driver!='pci-stub': raise VmError(("pci: PCI Backend does not own device "+ \ "%s\n"+ \ "See the pciback.hide kernel "+ \ diff -r 8f6dd1671599 -r d33a665b2c05 tools/python/xen/xend/XendNode.py --- a/tools/python/xen/xend/XendNode.py Mon Jul 06 11:47:34 2009 +0100 +++ b/tools/python/xen/xend/XendNode.py Mon Jul 06 11:48:44 2009 +0100 @@ -835,7 +835,7 @@ class XendNode: def pciinfo(self): # Each element of dev_list is a PciDevice - dev_list = PciUtil.find_all_devices_owned_by_pciback() + dev_list = PciUtil.find_all_assignable_devices() # Each element of devs_list is a list of PciDevice devs_list = PciUtil.check_FLR_capability(dev_list) diff -r 8f6dd1671599 -r d33a665b2c05 tools/python/xen/xend/server/pciif.py --- a/tools/python/xen/xend/server/pciif.py Mon Jul 06 11:47:34 2009 +0100 +++ b/tools/python/xen/xend/server/pciif.py Mon Jul 06 11:48:44 2009 +0100 @@ -224,7 +224,7 @@ class PciController(DevController): return sxpr def CheckSiblingDevices(self, domid, dev): - """ Check if all sibling devices of dev are owned by pciback + """ Check if all sibling devices of dev are owned by pciback or pci-stub """ if not self.vm.info.is_hvm(): return @@ -245,12 +245,9 @@ class PciController(DevController): #no dom0 drivers bound to sdev continue - if sdev.driver!='pciback': - raise VmError(("pci: PCI Backend does not own\n "+ \ - "sibling device %s of device %s\n"+ \ - "See the pciback.hide kernel "+ \ - "command-line parameter or\n"+ \ - "bind your slot/device to the PCI backend using sysfs" \ + if sdev.driver!='pciback' and sdev.driver!='pci-stub': + raise VmError(("pci: PCI Backend and pci-stub don't\n "+ \ + "own sibling device %s of device %s\n"\ )%(sdev.name, dev.name)) return @@ -265,13 +262,9 @@ class PciController(DevController): raise VmError("pci: failed to locate device and "+ "parse it's resources - "+str(e)) - if dev.driver!='pciback': - raise VmError(("pci: PCI Backend does not own device "+ \ - "%s\n"+ \ - "See the pciback.hide kernel "+ \ - "command-line parameter or\n"+ \ - "bind your slot/device to the PCI backend using sysfs" \ - )%(dev.name)) + if dev.driver!='pciback' and dev.driver!='pci-stub': + raise VmError(("pci: PCI Backend and pci-stub don't own "+ \ + "device %s\n") %(dev.name)) if dev.has_non_page_aligned_bar and arch.type != "ia64": raise VmError("pci: %s: non-page-aligned MMIO BAR found." % dev.name) @@ -285,7 +278,8 @@ class PciController(DevController): # if arch.type != "ia64": # dev.do_FLR() - PCIQuirk(dev) + if dev.driver == 'pciback': + PCIQuirk(dev) if not self.vm.info.is_hvm(): # Setup IOMMU device assignment @@ -437,13 +431,9 @@ class PciController(DevController): raise VmError("pci: failed to locate device and "+ "parse it's resources - "+str(e)) - if dev.driver!='pciback': - raise VmError(("pci: PCI Backend does not own device "+ \ - "%s\n"+ \ - "See the pciback.hide kernel "+ \ - "command-line parameter or\n"+ \ - "bind your slot/device to the PCI backend using sysfs" \ - )%(dev.name)) + if dev.driver!='pciback' and dev.driver!='pci-stub': + raise VmError(("pci: PCI Backend and pci-stub don't own device "+ \ + "%s\n") %(dev.name)) # Need to do FLR here before deassign device in order to terminate # DMA transaction, etc _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |