Re: Archs using generic PCI controller drivers vs. resource policy

Benjamin Herrenschmidt
2019-06-24T11:11:19Z

On Mon, 2019-06-24 at 04:02 -0700, Christoph Hellwig wrote:
> On Sun, Jun 23, 2019 at 10:30:42AM +1000, Benjamin Herrenschmidt wrote:
> > This is wrong. I want to move it to the architecture (initially,
> > eventually it should be platform driven, but the default will start
> > with architecture specific to avoid changing the existing behaviours
> > while consolidating the code).
>
> Doing this per arch sounds fundamentally wrong. At best per firmware
> type, but hopefully firmware messing with PCIe setup is slowly going
> away, at least outside of x86.

No it's actually the other way around. UEFI/ACPI is growing outside of
x86 and it *is* essing with PCIe in ways we need to deal with better
(it's somewhat broken on arm64 today).

That said, the policy doesn't belong in the host bridge driver. It's
platform (or firmware) driven. At the moment, those platform/firmware
type decisions are done in the architecture. This can change, but I
won't change everything in one day.

Keep in mind that what I'm doing is a clean up keeping existing
behaviours as much as possible. Once we don't have 36 different ways of
doing the same thing, we can look at whether we want to change the
actual policies for some platforms/firmware/arch combinations.

Today, it's a practical fact that the resource allocation policy is
driven by the arch/platform code.

The fact that some host bridge drivers in drivers/pci/controller
effectively implement a resource allocation policy by diretly calling
stuff they shouldn't be calling is what I'm trying to fix.

So I just want to make the arch (today) set a default policy and have
the controller drivers call a generic function that performs the
resource management according to said policy.

> > To do that right, I want to understand which archs can potentially use
> > the code in drivers/pci/controller today so I can change those archs to
> > explicitely set the default to "reassign everything" (and take the
> > policy out of the drivers themselves).
> >
> > So far I've counted arm, arm64 (DT, not ACPI) and nios2. Any other ?
>
> riscv at least and probably anything that can be synthesized to common
> FPGAs with PCIe support.

Ok. I'll set riscv default policy to reassign all like arm and arm64
for now.

Cheers,
Ben.