WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xend: Fix PCI Device Configuration

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: Fix PCI Device Configuration
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 Dec 2007 12:40:13 -0800
Delivery-date: Wed, 19 Dec 2007 12:41:33 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1198075837 0
# Node ID ca461349620a59bbc94b788481dfbdcf07610fb7
# Parent  28921e83000b9846662759a5ee07caf34f4853a6
xend: Fix PCI Device Configuration

Xend doesn't correctly work after restart, when there is a domU which
owns a pci device (driver domain). This patch fixes the problem.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendConfig.py   |   87 ++++++++++++++++------------------
 tools/python/xen/xend/server/pciif.py |    4 -
 2 files changed, 44 insertions(+), 47 deletions(-)

diff -r 28921e83000b -r ca461349620a tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Wed Dec 19 14:45:45 2007 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Wed Dec 19 14:50:37 2007 +0000
@@ -533,55 +533,13 @@ class XendConfig(dict):
             cfg['HVM_boot_policy'] = 'BIOS order'
             cfg['HVM_boot_params'] = { 'order' : boot_order }
 
-        # Parsing the device SXP's. In most cases, the SXP looks
-        # like this:
-        #
-        # [device, [vif, [mac, xx:xx:xx:xx:xx:xx], [ip 1.3.4.5]]]
-        #
-        # However, for PCI devices it looks like this:
-        #
-        # [device, [pci, [dev, [domain, 0], [bus, 0], [slot, 1]]]]
-        #
-        # It seems the reasoning for this difference is because
-        # pciif.py needs all the PCI device configurations at
-        # the same time when creating the devices.
-        #
-        # To further complicate matters, Xen 2.0 configuration format
-        # uses the following for pci device configuration:
-        #
-        # [device, [pci, [domain, 0], [bus, 0], [dev, 1], [func, 2]]]
-        #
-        # Hence we deal with pci device configurations outside of
-        # the regular device parsing.
-        
+       
+        # Parsing the device SXP's.
         cfg['devices'] = {}
         for dev in sxp.children(sxp_cfg, 'device'):
             config = sxp.child0(dev)
             dev_type = sxp.name(config)
-            dev_info = {}
-            
-            if dev_type == 'pci':
-                pci_devs_uuid = sxp.child_value(config, 'uuid',
-                                                uuid.createString())
-                pci_devs = []
-                for pci_dev in sxp.children(config, 'dev'):
-                    pci_dev_info = {}
-                    for opt_val in pci_dev[1:]:
-                        try:
-                            opt, val = opt_val
-                            pci_dev_info[opt] = val
-                        except TypeError:
-                            pass
-                    pci_devs.append(pci_dev_info)
-                
-                cfg['devices'][pci_devs_uuid] = (dev_type,
-                                                 {'devs': pci_devs,
-                                                  'uuid': pci_devs_uuid})
-                
-                log.debug("XendConfig: reading device: %s" % pci_devs)
-            else:
-                self.device_add(dev_type, cfg_sxp = config, target = cfg)
-                log.debug("XendConfig: reading device: %s" % 
scrub_password(dev_info))
+            self.device_add(dev_type, cfg_sxp = config, target = cfg)
 
         # Extract missing data from configuration entries
         image_sxp = sxp.child_value(sxp_cfg, 'image', [])
@@ -1096,6 +1054,44 @@ class XendConfig(dict):
             dev_type = sxp.name(config)
             dev_info = {}
 
+            # Parsing the device SXP's. In most cases, the SXP looks
+            # like this:
+            #
+            # [device, [vif, [mac, xx:xx:xx:xx:xx:xx], [ip 1.3.4.5]]]
+            #
+            # However, for PCI devices it looks like this:
+            #
+            # [device, [pci, [dev, [domain, 0], [bus, 0], [slot, 1]]]]
+            #
+            # It seems the reasoning for this difference is because
+            # pciif.py needs all the PCI device configurations at
+            # the same time when creating the devices.
+            #
+            # To further complicate matters, Xen 2.0 configuration format
+            # uses the following for pci device configuration:
+            #
+            # [device, [pci, [domain, 0], [bus, 0], [dev, 1], [func, 2]]]
+
+            if dev_type == 'pci':
+                pci_devs_uuid = sxp.child_value(config, 'uuid',
+                                                uuid.createString())
+                pci_devs = []
+                for pci_dev in sxp.children(config, 'dev'):
+                    pci_dev_info = {}
+                    for opt_val in pci_dev[1:]:
+                        try:
+                            opt, val = opt_val
+                            pci_dev_info[opt] = val
+                        except TypeError:
+                            pass
+                    pci_devs.append(pci_dev_info)
+                target['devices'][pci_devs_uuid] = (dev_type,
+                                                    {'devs': pci_devs,
+                                                     'uuid': pci_devs_uuid})
+
+                log.debug("XendConfig: reading device: %s" % pci_devs)
+                return pci_devs_uuid
+
             for opt_val in config[1:]:
                 try:
                     opt, val = opt_val
@@ -1177,6 +1173,7 @@ class XendConfig(dict):
                 if dev_uuid not in target['console_refs']:
                     target['console_refs'].append(dev_uuid)
                     
+            log.debug("XendConfig: reading device: %s" % 
scrub_password(dev_info))
             return dev_uuid
 
         if cfg_xenapi:
diff -r 28921e83000b -r ca461349620a tools/python/xen/xend/server/pciif.py
--- a/tools/python/xen/xend/server/pciif.py     Wed Dec 19 14:45:45 2007 +0000
+++ b/tools/python/xen/xend/server/pciif.py     Wed Dec 19 14:50:37 2007 +0000
@@ -102,13 +102,13 @@ class PciController(DevController):
         result['uuid'] = self.readBackend(devid, 'uuid')
         return result
 
-    def configuration(self, devid):
+    def configuration(self, devid, transaction = None):
         """Returns SXPR for devices on domain.
 
         @note: we treat this dict especially to convert to
         SXP because it is not a straight dict of strings."""
         
-        configDict = self.getDeviceConfiguration(devid)
+        configDict = self.getDeviceConfiguration(devid, transaction)
         sxpr = [self.deviceClass]
 
         # remove devs

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xend: Fix PCI Device Configuration, Xen patchbot-unstable <=