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] xend: Allow the virtual device and function to be spec

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [rfc] xend: Allow the virtual device and function to be specified for PCI pass-through
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Tue, 17 Feb 2009 20:23:19 +1100
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Delivery-date: Tue, 17 Feb 2009 01:28:49 -0800
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.18 (2008-05-17)
There is also an ioemu portion of this patch

Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

Index: xen-unstable.hg/tools/python/xen/xm/create.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xm/create.py  2009-02-17 
16:13:09.000000000 +0900
+++ xen-unstable.hg/tools/python/xen/xm/create.py       2009-02-17 
18:00:50.000000000 +0900
@@ -322,7 +322,7 @@ gopts.var('disk', val='phy:DEV,VDEV,MODE
           backend driver domain to use for the disk.
           The option may be repeated to add more than one disk.""")
 
-gopts.var('pci', val='BUS:DEV.FUNC[,msitranslate=0|1]',
+gopts.var('pci', val='PBUS:PDEV.PFUNC[@VDEV[.VFUNC]][,msitranslate=0|1]',
           fn=append_value, default=[],
           use="""Add a PCI device to a domain, using given params (in hex).
           For example 'pci=c0:02.1'.
@@ -681,7 +681,7 @@ def configure_pci(config_devs, vals):
     """Create the config for pci devices.
     """
     config_pci = []
-    for (domain, bus, slot, func, opts) in vals.pci:
+    for (domain, bus, slot, func, opts, vslot, vfunc) in vals.pci:
         config_pci_opts = []
         d = comma_sep_kv_to_dict(opts)
 
@@ -693,6 +693,10 @@ def configure_pci(config_devs, vals):
 
         config_pci_bdf = ['dev', ['domain', domain], ['bus', bus], \
                           ['slot', slot], ['func', func]]
+        if vslot != '0x':
+            config_pci_bdf.append(['vslot', vslot])
+        if vfunc != '0x':
+            config_pci_bdf.append(['vfunc', vfunc])
         map(f, d.keys())
         if len(config_pci_opts)>0:
             config_pci_bdf.append(['opts', config_pci_opts])
@@ -1021,7 +1025,9 @@ def preprocess_pci(vals):
                 r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + \
                 r"(?P<slot>[0-9a-fA-F]{1,2})[.,]" + \
                 r"(?P<func>[0-7])" + \
-                r"(,(?P<opts>.*))?$", pci_dev_str)
+                r"(,(?P<opts>.*))?" + \
+                r"(@((?P<vslot>[0-9a-fA-F])(\.(?P<vfunc>[0-7]))?))?$", \
+                pci_dev_str)
         if pci_match!=None:
             pci_dev_info = pci_match.groupdict('')
             if pci_dev_info['domain']=='':
@@ -1031,7 +1037,9 @@ def preprocess_pci(vals):
                         '0x'+pci_dev_info['bus'], \
                         '0x'+pci_dev_info['slot'], \
                         '0x'+pci_dev_info['func'], \
-                        pci_dev_info['opts']))
+                        pci_dev_info['opts'], \
+                        '0x'+pci_dev_info['vslot'], \
+                        '0x'+pci_dev_info['vfunc']))
             except IndexError:
                 err('Error in PCI slot syntax "%s"'%(pci_dev_str))
     vals.pci = pci
Index: xen-unstable.hg/tools/python/xen/xend/server/pciif.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xend/server/pciif.py  2009-01-30 
12:55:45.000000000 +0900
+++ xen-unstable.hg/tools/python/xen/xend/server/pciif.py       2009-02-17 
18:00:50.000000000 +0900
@@ -74,6 +74,8 @@ class PciController(DevController):
             bus = parse_hex(pci_config.get('bus', 0))
             slot = parse_hex(pci_config.get('slot', 0))
             func = parse_hex(pci_config.get('func', 0))            
+            vslot = parse_hex(pci_config.get('vslot', 0))
+            vfunc = parse_hex(pci_config.get('vfunc', 0))
 
             opts = pci_config.get('opts', '')
             if len(opts) > 0:
@@ -88,6 +90,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['vdevfn-%i' % pcidevid] = "%02x.%01x" % (vslot, vfunc)
             pcidevid += 1
 
         if vslots != "":

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [rfc] xend: Allow the virtual device and function to be specified for PCI pass-through, Simon Horman <=