ia64/xen-unstable

changeset 10036:4b4d16fe0b05

The PciController class lacks a configuration method to re-generate the
configuration of an existing domain. This is needed for a domain to be
able to reboot and retain its PCI device configuration. This patch adds
such support.

Thanks to Mike Wright for reporting this problem and working with me to
fix it.

Signed-off-by: Ryan Wilson <hap9@epoch.ncsc.mil>
author kaf24@firebug.cl.cam.ac.uk
date Wed May 10 16:07:46 2006 +0100 (2006-05-10)
parents 50989084d4d0
children b61908e30015
files tools/python/xen/xend/server/pciif.py
line diff
     1.1 --- a/tools/python/xen/xend/server/pciif.py	Wed May 10 16:06:55 2006 +0100
     1.2 +++ b/tools/python/xen/xend/server/pciif.py	Wed May 10 16:07:46 2006 +0100
     1.3 @@ -31,6 +31,7 @@ import xen.lowlevel.xc
     1.4  
     1.5  from xen.util.pci import PciDevice
     1.6  import resource
     1.7 +import re
     1.8  
     1.9  xc = xen.lowlevel.xc.xc()
    1.10  
    1.11 @@ -106,6 +107,30 @@ class PciController(DevController):
    1.12  
    1.13          return (0, back, {})
    1.14  
    1.15 +    def configuration(self, devid):
    1.16 +        """@see DevController.configuration"""
    1.17 +
    1.18 +        result = DevController.configuration(self, devid)
    1.19 +
    1.20 +        (num_devs) = self.readBackend(devid, 'num_devs')
    1.21 +
    1.22 +        for i in range(int(num_devs)):
    1.23 +            (dev_config) = self.readBackend(devid, 'dev-%d'%(i))
    1.24 +
    1.25 +            pci_match = re.match(r"((?P<domain>[0-9a-fA-F]{1,4})[:,])?" + \
    1.26 +                    r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + \
    1.27 +                    r"(?P<slot>[0-9a-fA-F]{1,2})[.,]" + \
    1.28 +                    r"(?P<func>[0-9a-fA-F]{1,2})", dev_config)
    1.29 +            if pci_match!=None:
    1.30 +                pci_dev_info = pci_match.groupdict('0')
    1.31 +                result.append( ['dev', \
    1.32 +                        ['domain', '0x'+pci_dev_info['domain']], \
    1.33 +                        ['bus', '0x'+pci_dev_info['bus']], \
    1.34 +                        ['slot', '0x'+pci_dev_info['slot']], \
    1.35 +                        ['func', '0x'+pci_dev_info['func']]])
    1.36 +
    1.37 +        return result
    1.38 +
    1.39      def setupDevice(self, domain, bus, slot, func):
    1.40          """ Attach I/O resources for device to frontend domain
    1.41          """