ia64/xen-unstable

changeset 19366:6e3e841f0259

xend: Use AUTO_PHP_SLOT_STR=0xff rather than 0x0 for auto pci allocation

Rather than use "0x0" to signify that the hotplug slot should
be automatically selected by qemu-dm, define AUTO_PHP_SLOT_STR.

At the same time, change the magic value form 0x0 to 0xff,
in line with changes made to qemu-dm to allow any unused PCI
device to be used for hotplug.

Signed-off-by: Simon Horman <horms@verge.net.au>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 17 10:42:32 2009 +0000 (2009-03-17)
parents f81467ad1356
children 986d0ed147ff
files tools/python/xen/xend/XendConstants.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/pciif.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xend/XendConstants.py	Tue Mar 17 10:40:47 2009 +0000
     1.2 +++ b/tools/python/xen/xend/XendConstants.py	Tue Mar 17 10:42:32 2009 +0000
     1.3 @@ -135,3 +135,6 @@ VTPM_DELETE_SCRIPT = '/etc/xen/scripts/v
     1.4  
     1.5  XS_VMROOT = "/vm/"
     1.6  
     1.7 +NR_PCI_DEV = 32
     1.8 +AUTO_PHP_SLOT = NR_PCI_DEV
     1.9 +AUTO_PHP_SLOT_STR = "%02x" % NR_PCI_DEV
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 17 10:40:47 2009 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 17 10:42:32 2009 +0000
     2.3 @@ -793,7 +793,7 @@ class XendDomainInfo:
     2.4                  existing_dev_uuid = sxp.child_value(existing_dev_info, 'uuid')
     2.5                  existing_pci_conf = self.info['devices'][existing_dev_uuid][1]
     2.6                  existing_pci_devs = existing_pci_conf['devs']
     2.7 -                vslt = '0x0'
     2.8 +                vslt = AUTO_PHP_SLOT_STR
     2.9                  for x in existing_pci_devs:
    2.10                      if ( int(x['domain'], 16) == int(dev['domain'], 16) and
    2.11                           int(x['bus'], 16) == int(dev['bus'], 16) and
    2.12 @@ -801,7 +801,7 @@ class XendDomainInfo:
    2.13                           int(x['func'], 16) == int(dev['func'], 16) ):
    2.14                          vslt = x['vslt']
    2.15                          break
    2.16 -                if vslt == '0x0':
    2.17 +                if vslt == AUTO_PHP_SLOT_STR:
    2.18                      raise VmError("Device %04x:%02x:%02x.%01x is not connected"
    2.19                                    % (int(dev['domain'],16), int(dev['bus'],16),
    2.20                                       int(dev['slot'],16), int(dev['func'],16)))
     3.1 --- a/tools/python/xen/xend/server/pciif.py	Tue Mar 17 10:40:47 2009 +0000
     3.2 +++ b/tools/python/xen/xend/server/pciif.py	Tue Mar 17 10:42:32 2009 +0000
     3.3 @@ -24,6 +24,7 @@ from xen.xend import sxp
     3.4  from xen.xend import arch
     3.5  from xen.xend.XendError import VmError
     3.6  from xen.xend.XendLogging import log
     3.7 +from xen.xend.XendConstants import *
     3.8  
     3.9  from xen.xend.server.DevController import DevController
    3.10  from xen.xend.server.DevConstants import xenbusState
    3.11 @@ -218,7 +219,7 @@ class PciController(DevController):
    3.12                      try:
    3.13                          dev_dict['vslt'] = slot_list[i]
    3.14                      except IndexError:
    3.15 -                        dev_dict['vslt'] = '0x0'
    3.16 +                        dev_dict['vslt'] = AUTO_PHP_SLOT_STR
    3.17  
    3.18                  pci_devs.append(dev_dict)
    3.19  
     4.1 --- a/tools/python/xen/xm/main.py	Tue Mar 17 10:40:47 2009 +0000
     4.2 +++ b/tools/python/xen/xm/main.py	Tue Mar 17 10:42:32 2009 +0000
     4.3 @@ -2456,7 +2456,7 @@ def parse_pci_configuration(args, state,
     4.4      if len(args) == 3:
     4.5          vslt = args[2]
     4.6      else:
     4.7 -        vslt = '0x0' #chose a free virtual PCI slot
     4.8 +        vslt = AUTO_PHP_SLOT_STR
     4.9      pci=['pci']
    4.10      pci_match = re.match(r"((?P<domain>[0-9a-fA-F]{1,4})[:,])?" + \
    4.11              r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + \