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: pass-through: Add key to pci device

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: pass-through: Add key to pci device dictionary
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 29 Jun 2009 02:20:19 -0700
Delivery-date: Mon, 29 Jun 2009 02:20:51 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 1246092942 -3600
# Node ID 7bbc4433f2ef5f79861821c0b40542694f5452e7
# Parent  d14fac3900a79288b41e559de361b496bc0e3e04
xend: pass-through: Add key to pci device dictionary

This will be used to identify the functions belonging to
a multi-function device.

Cc: Dexuan Cui <dexuan.cui@xxxxxxxxx>
Cc: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
---
 tools/python/xen/util/pci.py            |    3 ++-
 tools/python/xen/xend/XendConfig.py     |    3 ++-
 tools/python/xen/xend/XendDPCI.py       |    8 +++++++-
 tools/python/xen/xend/XendDomainInfo.py |    1 +
 tools/python/xen/xend/server/pciif.py   |    8 ++++++--
 tools/python/xen/xm/create.dtd          |    3 ++-
 tools/python/xen/xm/create.py           |    9 +++++----
 tools/python/xen/xm/main.py             |   10 +++++++---
 tools/python/xen/xm/xenapi_create.py    |    6 +++++-
 9 files changed, 37 insertions(+), 14 deletions(-)

diff -r d14fac3900a7 -r 7bbc4433f2ef tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py      Sat Jun 27 09:54:54 2009 +0100
+++ b/tools/python/xen/util/pci.py      Sat Jun 27 09:55:42 2009 +0100
@@ -277,7 +277,7 @@ def parse_pci_name_extended(pci_dev_str)
     template['domain'] = "0x%04x" % domain
     template['bus']    = "0x%02x" % int(pci_dev_info['bus'], 16)
     template['slot']   = "0x%02x" % int(pci_dev_info['slot'], 16)
-    template['func']   = "0x%x"   % int(pci_dev_info['func'], 16)
+    template['key']    = pci_dev_str
     if pci_dev_info['opts'] != '':
         template['opts'] = split_pci_opts(pci_dev_info['opts'])
         check_pci_opts(template['opts'])
@@ -290,6 +290,7 @@ def parse_pci_name_extended(pci_dev_str)
                                       pci_dev_info['func'])
     for func in func_list:
         pci_dev = template.copy()
+        pci_dev['func'] = "0x%x" % func
 
         if len(func_list) == 1:
             # For single-function devices vfunc must be 0
diff -r d14fac3900a7 -r 7bbc4433f2ef tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Sat Jun 27 09:54:54 2009 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Sat Jun 27 09:55:42 2009 +0100
@@ -1249,7 +1249,8 @@ class XendConfig(dict):
             dpci_record = {
                 'VM': self['uuid'],
                 'PPCI': ppci_uuid,
-                'hotplug_slot': pci_dev.get('vslot', '0x%02x' % AUTO_PHP_SLOT)
+                'hotplug_slot': pci_dev.get('vslot', '0x%02x' % AUTO_PHP_SLOT),
+                'key': pci_dev['key']
             }
 
             dpci_opts = pci_dev.get('opts')
diff -r d14fac3900a7 -r 7bbc4433f2ef tools/python/xen/xend/XendDPCI.py
--- a/tools/python/xen/xend/XendDPCI.py Sat Jun 27 09:54:54 2009 +0100
+++ b/tools/python/xen/xend/XendDPCI.py Sat Jun 27 09:55:42 2009 +0100
@@ -42,6 +42,7 @@ class XendDPCI(XendBase):
                   'VM',
                   'PPCI',
                   'hotplug_slot',
+                  'key',
                   'options']
         return XendBase.getAttrRO() + attrRO
 
@@ -52,7 +53,8 @@ class XendDPCI(XendBase):
     def getAttrInst(self):
         attrInst = ['VM',
                     'PPCI',
-                    'hotplug_slot']
+                    'hotplug_slot',
+                    'key']
         return XendBase.getAttrInst() + attrInst
 
     def getMethods(self):
@@ -120,6 +122,7 @@ class XendDPCI(XendBase):
         self.VM = record['VM']
         self.PPCI = record['PPCI']
         self.hotplug_slot = int(record['hotplug_slot'], 16)
+        self.key = record['key']
         if 'options' in record.keys():
             self.options = record['options']
 
@@ -155,5 +158,8 @@ class XendDPCI(XendBase):
     def get_hotplug_slot(self):
         return "%d" % self.hotplug_slot
 
+    def get_key(self):
+        return self.key
+
     def get_options(self):
         return self.options
diff -r d14fac3900a7 -r 7bbc4433f2ef tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Sat Jun 27 09:54:54 2009 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Sat Jun 27 09:55:42 2009 +0100
@@ -3733,6 +3733,7 @@ class XendDomainInfo:
                    ['slot', '0x%02x' % ppci.get_slot()],
                    ['func', '0x%1x' % ppci.get_func()],
                    ['vslot', '0x%02x' % xenapi_pci.get('hotplug_slot')],
+                   ['key', xenapi_pci['key']],
                    ['uuid', dpci_uuid]]
         dev_sxp = sxp.merge(dev_sxp, opts_sxp)
 
diff -r d14fac3900a7 -r 7bbc4433f2ef tools/python/xen/xend/server/pciif.py
--- a/tools/python/xen/xend/server/pciif.py     Sat Jun 27 09:54:54 2009 +0100
+++ b/tools/python/xen/xend/server/pciif.py     Sat Jun 27 09:55:42 2009 +0100
@@ -83,6 +83,7 @@ class PciController(DevController):
             back['dev-%i' % pcidevid] = "%04x:%02x:%02x.%01x" % \
                                         (domain, bus, slot, func)
             back['uuid-%i' % pcidevid] = pci_config.get('uuid', '')
+            back['key-%i' % pcidevid] = pci_config.get('key', '')
             back['vslot-%i' % pcidevid] = "%02x" % vslot
             pcidevid += 1
 
@@ -113,6 +114,7 @@ class PciController(DevController):
                 dev = back['dev-%i' % i]
                 state = states[i]
                 uuid = back['uuid-%i' %i]
+                key = back['key-%i' %i]
                 opts = ''
                 if 'opts-%i' % i in back:
                     opts = back['opts-%i' % i]
@@ -135,6 +137,7 @@ class PciController(DevController):
                 self.writeBackend(devid, 'state-%i' % devno,
                                   str(xenbusState['Initialising']))
                 self.writeBackend(devid, 'uuid-%i' % devno, uuid)
+                self.writeBackend(devid, 'key-%i' % devno, key)
                 if len(opts) > 0:
                     self.writeBackend(devid, 'opts-%i' % devno, opts)
                 if back.has_key('vslot-%i' % i):
@@ -173,6 +176,7 @@ class PciController(DevController):
 
             # Per device uuid info
             pci_dev['uuid'] = self.readBackend(devid, 'uuid-%d' % i)
+            pci_dev['key'] = self.readBackend(devid, 'key-%d' % i)
             pci_dev['vslot'] = '0x%s' % self.readBackend(devid, 'vslot-%d' % i)
 
             #append opts info
@@ -500,7 +504,7 @@ class PciController(DevController):
                 # In HVM case, I/O resources are disabled in ioemu.
                 self.cleanupOneDevice(pci_dev)
                 # Remove xenstore nodes.
-                list = ['dev', 'vdev', 'state', 'uuid', 'vslot']
+                list = ['dev', 'vdev', 'state', 'uuid', 'vslot', 'key']
                 if self.readBackend(devid, 'opts-%i' % i) is not None:
                     list.append('opts')
                 for key in list:
@@ -510,7 +514,7 @@ class PciController(DevController):
                 if new_num_devs == i + 1:
                     continue
 
-                list = ['dev', 'vdev', 'state', 'uuid', 'opts', 'vslot']
+                list = ['dev', 'vdev', 'state', 'uuid', 'opts', 'vslot', 'key']
                 for key in list:
                     tmp = self.readBackend(devid, '%s-%i' % (key, i))
                     if tmp is None:
diff -r d14fac3900a7 -r 7bbc4433f2ef tools/python/xen/xm/create.dtd
--- a/tools/python/xen/xm/create.dtd    Sat Jun 27 09:54:54 2009 +0100
+++ b/tools/python/xen/xm/create.dtd    Sat Jun 27 09:55:42 2009 +0100
@@ -90,7 +90,8 @@
                  slot            CDATA #REQUIRED
                  func            CDATA #REQUIRED
                  opts_str        CDATA #IMPLIED
-                 vslot           CDATA #IMPLIED>
+                 vslot           CDATA #IMPLIED
+                 key             CDATA #IMPLIED>
 
 <!ELEMENT vscsi  EMPTY>
 <!ATTLIST vscsi  p-dev           CDATA #REQUIRED
diff -r d14fac3900a7 -r 7bbc4433f2ef tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Sat Jun 27 09:54:54 2009 +0100
+++ b/tools/python/xen/xm/create.py     Sat Jun 27 09:55:42 2009 +0100
@@ -1074,14 +1074,15 @@ def preprocess_cpuid(vals, attr_name):
 
 def pci_dict_to_tuple(dev):
     return (dev['domain'], dev['bus'], dev['slot'], dev['func'],
-            dev['vslot'], dev.get('opts', []))
-
-def pci_tuple_to_dict((domain, bus, slot, func, vslot, opts)):
+            dev['vslot'], dev.get('opts', []), dev['key'])
+
+def pci_tuple_to_dict((domain, bus, slot, func, vslot, opts, key)):
     pci_dev = { 'domain': domain,
                 'bus':    bus,
                 'slot':   slot,
                 'func':   func,
-                'vslot':  vslot}
+                'vslot':  vslot,
+                'key':    key}
     if len(opts) > 0:
         pci_dev['opts'] = opts
     return pci_dev
diff -r d14fac3900a7 -r 7bbc4433f2ef tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Sat Jun 27 09:54:54 2009 +0100
+++ b/tools/python/xen/xm/main.py       Sat Jun 27 09:55:42 2009 +0100
@@ -2186,7 +2186,8 @@ def attached_pci_dict_bin(dom):
                 'bus':    int(ppci_record['bus']),
                 'slot':   int(ppci_record['slot']),
                 'func':   int(ppci_record['func']),
-                'vslot':  int(server.xenapi.DPCI.get_hotplug_slot(dpci_ref))
+                'vslot':  int(server.xenapi.DPCI.get_hotplug_slot(dpci_ref)),
+                'key':    server.xenapi.DPCI.get_key(dpci_ref)
             }
             devs.append(dev)
 
@@ -2197,7 +2198,8 @@ def attached_pci_dict_bin(dom):
                 'bus':    int(x['bus'], 16),
                 'slot':   int(x['slot'], 16),
                 'func':   int(x['func'], 16),
-                'vslot':  int(x['vslot'], 16)
+                'vslot':  int(x['vslot'], 16),
+                'key':    x['key']
             }
             devs.append(dev)
 
@@ -2543,6 +2545,7 @@ def xm_pci_attach(args):
         slot = int(sxp.child_value(pci_dev, 'slot'), 16)
         func = int(sxp.child_value(pci_dev, 'func'), 16)
         vslot = int(sxp.child_value(pci_dev, 'vslot'), 16)
+        key = sxp.child_value(pci_dev, 'key')
         name = "%04x:%02x:%02x.%01x" % (domain, bus, slot, func)
 
         target_ref = None
@@ -2557,7 +2560,8 @@ def xm_pci_attach(args):
             "VM":           get_single_vm(dom),
             "PPCI":         target_ref,
             "hotplug_slot": vslot,
-            "options":      dict(config_pci_opts)
+            "options":      dict(config_pci_opts),
+            "key":          key
         }
         server.xenapi.DPCI.create(dpci_record)
 
diff -r d14fac3900a7 -r 7bbc4433f2ef tools/python/xen/xm/xenapi_create.py
--- a/tools/python/xen/xm/xenapi_create.py      Sat Jun 27 09:54:54 2009 +0100
+++ b/tools/python/xen/xm/xenapi_create.py      Sat Jun 27 09:55:42 2009 +0100
@@ -543,7 +543,9 @@ class xenapi_create:
                 int(pci.attributes["vslot"].value, 16),
             "options":
                 get_child_nodes_as_dict(pci,
-                  "pci_opt", "key", "value")
+                  "pci_opt", "key", "value"),
+            "key":
+                pci.attributes["key"].value
         }
 
         return server.xenapi.DPCI.create(dpci_record)
@@ -946,6 +948,8 @@ class sxp2xml:
                     = get_child_by_name(dev_sxp, "func", "0")
                 pci.attributes["vslot"] \
                     = get_child_by_name(dev_sxp, "vslot", "0")
+                pci.attributes["key"] \
+                    = get_child_by_name(dev_sxp, "key", "0")
                 for opt in pci_opts_list_from_sxp(dev_sxp):
                     pci_opt = document.createElement("pci_opt")
                     pci_opt.attributes["key"] = opt[0]

_______________________________________________
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: pass-through: Add key to pci device dictionary, Xen patchbot-unstable <=