* [PATCH] Enumerate all undiscovered PCIe busses @ 2015-10-02 18:23 Ruud 2015-10-03 14:30 ` Bjorn Helgaas 0 siblings, 1 reply; 6+ messages in thread From: Ruud @ 2015-10-02 18:23 UTC (permalink / raw) To: linux-pci; +Cc: Ruud Multiple root complexes have a different start busnumber. Poll all undiscovered busses for a root complex Signed-off-by: Ruud <netwerkforens@gmail.com> --- lib/generic.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/lib/generic.c b/lib/generic.c index c219592..21b8022 100644 --- a/lib/generic.c +++ b/lib/generic.c @@ -69,9 +69,13 @@ void pci_generic_scan(struct pci_access *a) { byte busmap[256]; + int basebus; memset(busmap, 0, sizeof(busmap)); - pci_generic_scan_bus(a, busmap, 0); + for(basebus=0;basebus<256;basebus++) { + if (busmap[basebus]==0) + pci_generic_scan_bus(a, busmap, basebus); + } } int -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Enumerate all undiscovered PCIe busses 2015-10-02 18:23 [PATCH] Enumerate all undiscovered PCIe busses Ruud @ 2015-10-03 14:30 ` Bjorn Helgaas 2015-10-05 10:21 ` Martin Mares 0 siblings, 1 reply; 6+ messages in thread From: Bjorn Helgaas @ 2015-10-03 14:30 UTC (permalink / raw) To: Ruud; +Cc: linux-pci, Martin Mares This appears to be a patch for pciutils, so I cc'd Martin, who maintains that. On Fri, Oct 02, 2015 at 06:23:36PM +0000, Ruud wrote: > Multiple root complexes have a different start busnumber. > Poll all undiscovered busses for a root complex > > Signed-off-by: Ruud <netwerkforens@gmail.com> > --- > lib/generic.c | 6 +++++- > 1 files changed, 5 insertions(+), 1 deletions(-) > > diff --git a/lib/generic.c b/lib/generic.c > index c219592..21b8022 100644 > --- a/lib/generic.c > +++ b/lib/generic.c > @@ -69,9 +69,13 @@ void > pci_generic_scan(struct pci_access *a) > { > byte busmap[256]; > + int basebus; > > memset(busmap, 0, sizeof(busmap)); > - pci_generic_scan_bus(a, busmap, 0); > + for(basebus=0;basebus<256;basebus++) { > + if (busmap[basebus]==0) > + pci_generic_scan_bus(a, busmap, basebus); > + } > } > > int > -- > 1.7.0.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-pci" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Enumerate all undiscovered PCIe busses 2015-10-03 14:30 ` Bjorn Helgaas @ 2015-10-05 10:21 ` Martin Mares 2015-10-05 14:23 ` Ruud 0 siblings, 1 reply; 6+ messages in thread From: Martin Mares @ 2015-10-05 10:21 UTC (permalink / raw) To: Bjorn Helgaas; +Cc: Ruud, linux-pci Hi! > This appears to be a patch for pciutils, so I cc'd Martin, who > maintains that. Thanks, I manage to follow linux-pci only very loosely these days... > On Fri, Oct 02, 2015 at 06:23:36PM +0000, Ruud wrote: > > Multiple root complexes have a different start busnumber. > > Poll all undiscovered busses for a root complex Unfortunately, this is not correct to do. Many systems report junk on unused bus number (for example, they decode bus numbers only partially, so the buses repeat). In which situation do you need this? Is it on Linux? Only lspci, or your own code using libpci? Does `lspci -M' help? Have a nice fortnight -- Martin `MJ' Mares <mj@ucw.cz> http://mj.ucw.cz/ Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth "Please try to fit your code to 80 columns. That's decimal 80." -- A. Morton ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Enumerate all undiscovered PCIe busses 2015-10-05 10:21 ` Martin Mares @ 2015-10-05 14:23 ` Ruud 2015-10-07 7:30 ` Ruud 0 siblings, 1 reply; 6+ messages in thread From: Ruud @ 2015-10-05 14:23 UTC (permalink / raw) To: Martin Mares, linux-pci, Yinghai Lu Hi Martin, I can't check the effect of "-M" at the moment so that will have to wait. Some context: I got some buggy BIOS and lots of GPU's. The effect is that I need to reenumerate busses and to let linux do that it is suggested to use setpci to clear busnumber etc. To make sure I do not clobber the linux drivers, I prefer to remove the switches at the root level (echo 1>remove) and set the registers using -H1 as hardware access. Unfortunately on the multiprocessor intel system, three root complexes exist: one at bus 0x00, One at bux 0x80 (and one at 0x7f IIRC). lspci -H1 will only report bus 0x00. It is not a problem for me to use a patched version of pciutils locally, but hoped to share. Perhaps as an idea: make the base bus-number configurable at the command line instead of hard coded? Best regards, Ruud 2015-10-05 12:21 GMT+02:00 Martin Mares <mj@ucw.cz>: > Hi! > >> This appears to be a patch for pciutils, so I cc'd Martin, who >> maintains that. > > Thanks, I manage to follow linux-pci only very loosely these days... > >> On Fri, Oct 02, 2015 at 06:23:36PM +0000, Ruud wrote: >> > Multiple root complexes have a different start busnumber. >> > Poll all undiscovered busses for a root complex > > Unfortunately, this is not correct to do. Many systems report > junk on unused bus number (for example, they decode bus numbers > only partially, so the buses repeat). > > In which situation do you need this? Is it on Linux? Only lspci, > or your own code using libpci? > > Does `lspci -M' help? > > Have a nice fortnight > -- > Martin `MJ' Mares <mj@ucw.cz> http://mj.ucw.cz/ > Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth > "Please try to fit your code to 80 columns. That's decimal 80." -- A. Morton ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Enumerate all undiscovered PCIe busses 2015-10-05 14:23 ` Ruud @ 2015-10-07 7:30 ` Ruud 2015-10-07 9:16 ` Ruud 0 siblings, 1 reply; 6+ messages in thread From: Ruud @ 2015-10-07 7:30 UTC (permalink / raw) To: Martin Mares, linux-pci Hi Martin, I did some more digging > > Does `lspci -M' help? The -M option shows all busses (but not a tree view), but more important setpci doesn't have the option and thus does not allow to do settings on the alternative busses. With respect to the "incorrectness" of the patch, one could argue that scanning all busses is allowed as they should read 0xFF for unassigned busses IIRC. >From that respect it may make more sense to have a command line option that forces a single bus, but scans by default instead of the other way around. What do you think? Best regards, Ruud 2015-10-05 16:23 GMT+02:00 Ruud <netwerkforens@gmail.com>: > Hi Martin, > > I can't check the effect of "-M" at the moment so that will have to wait. > Some context: > > I got some buggy BIOS and lots of GPU's. The effect is that I need to > reenumerate busses and to let linux do that it is suggested to use > setpci to clear busnumber etc. > To make sure I do not clobber the linux drivers, I prefer to remove > the switches at the root level (echo 1>remove) and set the registers > using -H1 as hardware access. > > Unfortunately on the multiprocessor intel system, three root complexes > exist: one at bus 0x00, One at bux 0x80 (and one at 0x7f IIRC). lspci > -H1 will only report bus 0x00. > > It is not a problem for me to use a patched version of pciutils > locally, but hoped to share. Perhaps as an idea: make the base > bus-number configurable at the command line instead of hard coded? > > Best regards, > > Ruud > > > 2015-10-05 12:21 GMT+02:00 Martin Mares <mj@ucw.cz>: >> Hi! >> >>> This appears to be a patch for pciutils, so I cc'd Martin, who >>> maintains that. >> >> Thanks, I manage to follow linux-pci only very loosely these days... >> >>> On Fri, Oct 02, 2015 at 06:23:36PM +0000, Ruud wrote: >>> > Multiple root complexes have a different start busnumber. >>> > Poll all undiscovered busses for a root complex >> >> Unfortunately, this is not correct to do. Many systems report >> junk on unused bus number (for example, they decode bus numbers >> only partially, so the buses repeat). >> >> In which situation do you need this? Is it on Linux? Only lspci, >> or your own code using libpci? >> >> Does `lspci -M' help? >> >> Have a nice fortnight >> -- >> Martin `MJ' Mares <mj@ucw.cz> http://mj.ucw.cz/ >> Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth >> "Please try to fit your code to 80 columns. That's decimal 80." -- A. Morton ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Enumerate all undiscovered PCIe busses 2015-10-07 7:30 ` Ruud @ 2015-10-07 9:16 ` Ruud 0 siblings, 0 replies; 6+ messages in thread From: Ruud @ 2015-10-07 9:16 UTC (permalink / raw) To: Martin Mares, linux-pci As alternative I made another patch that allows to specify a specific busnumber as a base: https://github.com/netwerkforens/pciutils/tree/multibus_v2 https://github.com/pciutils/pciutils/pull/2 >> It is not a problem for me to use a patched version of pciutils >> locally, but hoped to share. Perhaps as an idea: make the base >> bus-number configurable at the command line instead of hard coded? >> ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-10-07 9:16 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-10-02 18:23 [PATCH] Enumerate all undiscovered PCIe busses Ruud 2015-10-03 14:30 ` Bjorn Helgaas 2015-10-05 10:21 ` Martin Mares 2015-10-05 14:23 ` Ruud 2015-10-07 7:30 ` Ruud 2015-10-07 9:16 ` Ruud
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox