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-devel

[Xen-devel] [rfc 2/2] xend: Use AUTO_PHP_SLOT_STR=0xff rather than 0x0 f

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [rfc 2/2] xend: Use AUTO_PHP_SLOT_STR=0xff rather than 0x0 for auto slot allocation
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Fri, 13 Mar 2009 18:07:36 +1100
Delivery-date: Fri, 13 Mar 2009 00:21:02 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20090313070734.348651099@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: quilt/0.46-1
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@xxxxxxxxxxxx>


Index: xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xend/XendDomainInfo.py        
2009-03-13 16:55:50.000000000 +1100
+++ xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py     2009-03-13 
17:00:08.000000000 +1100
@@ -793,7 +793,7 @@ class XendDomainInfo:
                 existing_dev_uuid = sxp.child_value(existing_dev_info, 'uuid')
                 existing_pci_conf = self.info['devices'][existing_dev_uuid][1]
                 existing_pci_devs = existing_pci_conf['devs']
-                vslt = '0x0'
+                vslt = xsconstants.AUTO_PHP_SLOT_STR
                 for x in existing_pci_devs:
                     if ( int(x['domain'], 16) == int(dev['domain'], 16) and
                          int(x['bus'], 16) == int(dev['bus'], 16) and
@@ -801,7 +801,7 @@ class XendDomainInfo:
                          int(x['func'], 16) == int(dev['func'], 16) ):
                         vslt = x['vslt']
                         break
-                if vslt == '0x0':
+                if vslt == xsconstants.AUTO_PHP_SLOT_STR:
                     raise VmError("Device %04x:%02x:%02x.%01x is not connected"
                                   % (int(dev['domain'],16), int(dev['bus'],16),
                                      int(dev['slot'],16), int(dev['func'],16)))
Index: xen-unstable.hg/tools/python/xen/xend/server/pciif.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xend/server/pciif.py  2009-03-13 
16:55:50.000000000 +1100
+++ xen-unstable.hg/tools/python/xen/xend/server/pciif.py       2009-03-13 
16:57:57.000000000 +1100
@@ -37,6 +37,7 @@ import re
 from xen.xend.server.pciquirk import *
 from xen.xend.xenstore.xstransact import xstransact
 from xen.xend.xenstore.xswatch import xswatch
+from xen.util import xsconstants
 
 xc = xen.lowlevel.xc.xc()
 
@@ -216,7 +217,7 @@ class PciController(DevController):
                     try:
                         dev_dict['vslt'] = slot_list[i]
                     except IndexError:
-                        dev_dict['vslt'] = '0x0'
+                        dev_dict['vslt'] = xsconstatns.AUTO_PHP_SLOT_STR
 
                 pci_devs.append(dev_dict)
 
Index: xen-unstable.hg/tools/python/xen/xm/main.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xm/main.py    2009-03-13 
16:55:50.000000000 +1100
+++ xen-unstable.hg/tools/python/xen/xm/main.py 2009-03-13 16:57:57.000000000 
+1100
@@ -55,6 +55,7 @@ from xen.util.xmlrpcclient import Server
 import xen.util.xsm.xsm as security
 from xen.util.xsm.xsm import XSMError
 from xen.util.acmpolicy import ACM_LABEL_UNLABELED_DISPLAY
+from xen.util import xsconstants
 
 import XenAPI
 
@@ -2440,7 +2441,7 @@ def parse_pci_configuration(args, state,
     if len(args) == 3:
         vslt = args[2]
     else:
-        vslt = '0x0' #chose a free virtual PCI slot
+        vslt = xsconstants.AUTO_PHP_SLOT_STR
     pci=['pci']
     pci_match = re.match(r"((?P<domain>[0-9a-fA-F]{1,4})[:,])?" + \
             r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + \
Index: xen-unstable.hg/tools/python/xen/util/xsconstants.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/util/xsconstants.py   2009-03-13 
16:55:50.000000000 +1100
+++ xen-unstable.hg/tools/python/xen/util/xsconstants.py        2009-03-13 
16:57:57.000000000 +1100
@@ -112,3 +112,7 @@ INVALID_POLICY_PREFIX = 'INV_'
 INVALID_SSIDREF = 0xFFFFFFFFL
 
 XS_INACCESSIBLE_LABEL = '__INACCESSIBLE__'
+
+NR_PCI_DEV = 32
+AUTO_PHP_SLOT = NR_PCI_DEV
+AUTO_PHP_SLOT_STR = "%02x" % NR_PCI_DEV

-- 

-- 
Simon Horman
  VA Linux Systems Japan K.K., Sydney, Australia Satellite Office
  H: www.vergenet.net/~horms/             W: www.valinux.co.jp/en


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