xl, fix for short BDF (without domain specified)
PATCH 1/1 xl, fix for short BDF (without domain specified)
Hi,
this patch fixes cases where an user sets pci device not mentioning its domain, ex. pci = ['01:00.0']
At now, xl recognizes this string as
domain = 1,
bus = 0,
device = 0
func = 0
commit a5ed8a3a59d5abeb9dabfdf2d31fa524cf304dee
Author: Sergey Tovpeko <[email protected]> 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.
tools/libxl/xl_cmdimpl.c +1 -1
@@ -827,7 +827,7 @@ skip_vfb: p =strtok (buf2,"," );if (!p) goto skip_pci; -if (!sscanf (p,PCI_BDF_VDEVFN , &domain, &bus, &dev, &func, &vdevfn)) { +if (sscanf (p,PCI_BDF_VDEVFN , &domain, &bus, &dev, &func, &vdevfn) <4 ) {sscanf (p,"%02x:%02x.%01x@%02x" , &bus, &dev, &func, &vdevfn); domain =0 ; }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 6 lines · Sergey Tovpeko
Hi,
this patch fixes cases where an user sets pci device not mentioning its domain, ex.
pci = ['01:00.0']
Quoted 7 lines
At now, xl recognizes this string as
domain = 1,
bus = 0,
device = 0
func = 0
the test on the return value should be "< 5", otherwise it wouldn't work if you use
pci = ['01:00.0@0']
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.
Quoted 7 lines · Stefano Stabellini
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 <[email protected]> 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.
tools/libxl/xl_cmdimpl.c +5 -2
@@ -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
[email protected]
http://lists.xensource.com/xen-devel
Stefano Stabellini
Acked-byQuoted 10 lines · Sergey Tovpeko
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.
this one looks good, thanks.