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

Re: [Xen-devel] [PATCH] xl, fix for short BDF (without domain specified)

To: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xl, fix for short BDF (without domain specified)
From: Sergey Tovpeko <tsv.devel@xxxxxxxxx>
Date: Wed, 07 Jul 2010 16:43:41 +0400
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 07 Jul 2010 05:47:26 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type; bh=PBN6cQMY0NGxfehJJOnL5DgHpRGcVe0jfAUO2OmX78w=; b=Q1S8ARYuxRvL8k+V/XQ5UjWGch0wwfWBmkyWuQovxxdLlNgxBVJonhwHBP+PbKpHOc 21IYK4ryB34rXY/C0viq4sgEjxbV0EW3CXDq3sCItox0cWR9lvh2wY4xGNEJKsgRMTvp kWbmfxiHuYVQKVP1Xq3YyQETRy9HwsYUji5zg=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; b=eEnn7Dddle5yO+cN9FAnWvdS5OZ/dXJXGSuMdAUlmhE77fOJAe6gCtvtHfdal1e8xt CHbDUZRp6UnqW21LHevgIKFwfUXa7IIkNJIIVhEh/upqHWaC9j88mmBcGT5Yl1279/Dj 6rDl1yED3FZURZX9na/x4StC7MRvDtnj8H+nQ=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.DEB.2.00.1007071205080.17029@kaball-desktop>
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: <4C343A7C.8000800@xxxxxxxxx> <alpine.DEB.2.00.1007071205080.17029@kaball-desktop>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)
Oh, too many input cases.

Below patch tries to recognize the following input:
pci = ['0001:02:03.4@5']
pci = ['0001:02:03.4']
pci = ['02:03.4@5']
pci = ['02:03.4']

Hope so.

Stefano Stabellini wrote:

the test on the return value should be "< 5", otherwise it wouldn't work
if you use

pci = ['01:00.0@0']


commit db423431f8b8b2a773df105e407372118cc12a27
Author: Sergey Tovpeko <tovpeko@xxxxxxxxx>
Date:   Tue Jul 6 23:31:50 2010 +0400

    Check that BDF have been parsed correctly.
    
    Before that fix, BDF could be parsed incorrectly if user omitted domain in 
it.

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 208ecd6..fe2408c 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -827,9 +827,12 @@ skip_vfb:
             p = strtok(buf2, ",");
             if (!p)
                 goto skip_pci;
-            if (!sscanf(p, PCI_BDF_VDEVFN, &domain, &bus, &dev, &func, 
&vdevfn)) {
-                sscanf(p, "%02x:%02x.%01x@%02x", &bus, &dev, &func, &vdevfn);
+            if (sscanf(p, PCI_BDF_VDEVFN, &domain, &bus, &dev, &func, &vdevfn) 
< 4) {
                 domain = 0;
+                if (sscanf(p, "%02x:%02x.%01x@%02x", &bus, &dev, &func, 
&vdevfn) < 3) {
+                    fprintf(stderr,"xl: Unable to parse pci bdf (%s)\n", p);
+                    goto skip_pci;
+                }
             }
             libxl_device_pci_init(*pcidevs + *num_pcidevs, domain, bus, dev, 
func, vdevfn);
             (*pcidevs)[*num_pcidevs].msitranslate = pci_msitranslate;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>