cns3xxx PCIe domain support

Lorenzo Pieralisi lorenzo.pieralisi at arm.com
Mon Jan 4 10:36:41 EST 2021


On Mon, Jan 04, 2021 at 02:48:20PM +0100, Arnd Bergmann wrote:
> On Mon, Jan 4, 2021 at 12:34 PM Lorenzo Pieralisi
> <lorenzo.pieralisi at arm.com> wrote:
> > On Sun, Jan 03, 2021 at 11:47:45PM +0100, Arnd Bergmann wrote:
> > > I'm working on a patch series to simplify the ARM pci-common
> > > implementation and came across cns3xxx, which unlike the other
> > > non-DT platforms does not partition the bus space of PCI domain
> > > zero but instead uses the default bus range 0...255 for each
> > > host bridge without assigning domain numbers.
> > >
> > > Before linux-3.20, commitm c88d54ba0c3d ("CNS3xxx: Remove
> > > artificial dependency on pci_sys_data domain."), it used to
> > > assign a domain number, but since then, the pci-common code
> > > just supports a single domain.
> > >
> > > My question is: does this actually work correctly without
> > > leading to duplicate domain/bus/device/function tuples?
> > > Is there anything I'm missing in the code, or could it be
> > > that the machines that Koen and Krzysztof were running
> > > on never used more than one of the host bridges?
> >
> > Hi Arnd,
> >
> > Happy New Year !! I don't think there is anything you are missing, I
> > think that's an issue. A possible solution would consist in selecting
> > PCI_DOMAINS_GENERIC (the OF code should fall back to using a counter for
> > PCI domains - which should do the trick), I'd rather avoid adding back
> > an arch/arm hook to set-up the domain number
> 
> Actually on this platform, CONFIG_PCI_DOMAINS_GENERIC is
> already enabled, however it still uses board files instead of
> devicetree, so the automatic assignment can not work.

It should work, pci_bus_find_domain_nr() falls back to a counter in
of_pci_bus_find_domain_nr() if no DT is present.

Are you in a position to test it ?

> > Please let me know how we can handle this, thanks a lot for spotting
> > it.
> 
> As a treewide cleanup, I was hoping we could just make the domain
> a field in the pci_host_bridge structure that can get set by the host
> bridge driver, and then remove the various other ways of setting
> the data, and then only have a trivial pci_domain_nr() implementation
> everywhere.

I think that was the main driver behind CONFIG_PCI_DOMAINS_GENERIC,
I don't remember why we stopped the effort to the
current CONFIG_PCI_DOMAINS_GENERIC implementation but if you manage
to extend it it is obviously nice.

> For the cns3xxx case, I wonder if anyone actually cares. If
> there are still users, the treewide change would make it trivial
> to set it up right, while backporting would be harder. I noticed
> that openwrt removed cns3xxx support in August with the
> explanation that the platform is not used much anymore,
> and I suspect that any users outside of openwrt stopped updating
> their kernels long ago.

Can you check please whether CONFIG_PCI_DOMAINS_GENERIC still assigns
separate domain numbers even with no DT support at all ?

Thanks,
Lorenzo



More information about the linux-arm-kernel mailing list