Skip to contentSkip to conversation

tools: More Accurate Parsing of PCI Config

PATCH New Yosuke Iwamatsu 1 participant 1 message Mar 19, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: More Accurate Parsing of PCI Config

Hi,

The attached patch is to fix pci device name parsing in xm/xend. This disallows illegal pci notations specified in domain config files, such as 0:2.0.0 which is supposed to be 0:2:0.0.
(A similar problem on pci-attach/detach was pointed out in the following mail and already fixed.
http://lists.xensource.com/archives/html/xen-devel/2008-03/msg00271.html)

Regards,
------------------
Yosuke Iwamatsu
NEC Corporation

# HG changeset patch
# User [email protected]
# Date 1205903225 -32400
# Node ID cdeafb36df14650ed327e0d7c6b444157787c770 # Parent f33328217eee1a66bf2a874ff1a42b62c21e42bc
tools: More accurate parsing of pci config.

tools/python/xen/xend/server/pciif.py +1 -1
diff -r f33328217eee -r cdeafb36df14 tools/python/xen/xend/server/pciif.py
@@ -125,7 +125,7 @@ class PciController(DevController):
             pci_match = re.match(r"((?P<domain>[0-9a-fA-F]{1,4})[:,])?" +
                                  r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + 
                                  r"(?P<slot>[0-9a-fA-F]{1,2})[.,]" + 
-                                 r"(?P<func>[0-9a-fA-F]{1,2})", dev_config)
+                                 r"(?P<func>[0-7]{1,2})$", dev_config)
             
             if pci_match!=None:
                 pci_dev_info = pci_match.groupdict()
tools/python/xen/xm/create.py +2 -2
diff -r f33328217eee -r cdeafb36df14 tools/python/xen/xm/create.py
@@ -304,7 +304,7 @@ gopts.var('pci', val='BUS:DEV.FUNC',
 gopts.var('pci', val='BUS:DEV.FUNC',
           fn=append_value, default=[],
           use="""Add a PCI device to a domain, using given params (in hex).
-         For example 'pci=c0:02.1a'.
+         For example 'pci=c0:02.1'.
          The option may be repeated to add more than one pci device.""")
 
 gopts.var('ioports', val='FROM[-TO]',
@@ -840,7 +840,7 @@ def preprocess_pci(vals):
         pci_match = re.match(r"((?P<domain>[0-9a-fA-F]{1,4})[:,])?" + \
                 r"(?P<bus>[0-9a-fA-F]{1,2})[:,]" + \
                 r"(?P<slot>[0-9a-fA-F]{1,2})[.,]" + \
-                r"(?P<func>[0-9a-fA-F])", pci_dev_str)
+                r"(?P<func>[0-7])$", pci_dev_str)
         if pci_match!=None:
             pci_dev_info = pci_match.groupdict('0')
             try:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel