Skip to contentSkip to conversation

xend: allow a device to be assigned to a guest and its stubdom

PATCH New Stefano Stabellini 1 participant 1 message Oct 12, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xend: allow a device to be assigned to a guest and its stubdom

This patch allows a pci device to be passed through an HVM guest and its own stubdom at the same time.

---

tools/python/xen/xend/XendConfig.py +3 -0
diff -r 3fe128b5f387 tools/python/xen/xend/XendConfig.py
@@ -2061,6 +2061,9 @@
     def is_hvm(self):
         return self['HVM_boot_policy'] != ''
 
+    def is_stubdom(self):
+        return (self['PV_kernel'].find('ioemu') >= 0)
+
     def target(self):
         return self['target']
 
tools/python/xen/xend/server/pciif.py +3 -2
diff -r 3fe128b5f387 tools/python/xen/xend/server/pciif.py
@@ -77,7 +77,8 @@
     dom_list = xstransact.List('/local/domain')
     pci_str_list = []
     for d in dom_list:
-        pci_str_list = pci_str_list + get_assigned_pci_devices(int(d))
+        if xstransact.Read('/local/domain/' + d + '/target') is None :
+            pci_str_list = pci_str_list + get_assigned_pci_devices(int(d))
     return pci_str_list
 
 class PciController(DevController):
@@ -303,7 +304,7 @@
         if dev.driver == 'pciback':
             PCIQuirk(dev)
 
-        if not self.vm.info.is_hvm():
+        if not self.vm.info.is_hvm() and not self.vm.info.is_stubdom() :
             # Setup IOMMU device assignment
             bdf = xc.assign_device(fe_domid, pci_dict_to_xc_str(pci_dev))
             pci_str = pci_dict_to_bdf_str(pci_dev)