Re: [PATCH 3/4] x86, pci: Add interface to force mmconfig

2017-03-16 Thread Thomas Gleixner
On Wed, 15 Mar 2017, Andi Kleen wrote: > > pci_root_ops is what is finally handed in to pci_scan_root_bus() as ops > > argument for any bus segment no matter which type it is. > > mmconfig is only initialized after PCI is initialized (an ordering > problem with ACPI). Wrong. It can be initialized

Re: [PATCH 3/4] x86, pci: Add interface to force mmconfig

2017-03-15 Thread Andi Kleen
> pci_root_ops is what is finally handed in to pci_scan_root_bus() as ops > argument for any bus segment no matter which type it is. mmconfig is only initialized after PCI is initialized (an ordering problem with ACPI). So it would require updating existing busses with likely interesting race cond

Re: [PATCH 3/4] x86, pci: Add interface to force mmconfig

2017-03-15 Thread Bjorn Helgaas
On Wed, Mar 15, 2017 at 11:00:22AM +0100, Thomas Gleixner wrote: > On Tue, 14 Mar 2017, Bjorn Helgaas wrote: > > On Tue, Mar 14, 2017 at 07:24:14PM -0700, Andi Kleen wrote: > > > > I agree that it should be fairly safe to do ECAM/MMCONFIG without > > > > locking. Can we handle the decision part by

Re: [PATCH 3/4] x86, pci: Add interface to force mmconfig

2017-03-15 Thread Thomas Gleixner
On Tue, 14 Mar 2017, Bjorn Helgaas wrote: > On Tue, Mar 14, 2017 at 07:24:14PM -0700, Andi Kleen wrote: > > > I agree that it should be fairly safe to do ECAM/MMCONFIG without > > > locking. Can we handle the decision part by adding a "lockless" bit > > > to struct pci_ops? Old ops don't mention

Re: [PATCH 3/4] x86, pci: Add interface to force mmconfig

2017-03-14 Thread Bjorn Helgaas
On Tue, Mar 14, 2017 at 07:24:14PM -0700, Andi Kleen wrote: > > I agree that it should be fairly safe to do ECAM/MMCONFIG without > > locking. Can we handle the decision part by adding a "lockless" bit > > to struct pci_ops? Old ops don't mention that bit, so it will be > > initialized to zero an

Re: [PATCH 3/4] x86, pci: Add interface to force mmconfig

2017-03-14 Thread Andi Kleen
> I agree that it should be fairly safe to do ECAM/MMCONFIG without > locking. Can we handle the decision part by adding a "lockless" bit > to struct pci_ops? Old ops don't mention that bit, so it will be > initialized to zero and we'll do locking as today. ECAM/MMCONFIG ops > can set it and we

Re: [PATCH 3/4] x86, pci: Add interface to force mmconfig

2017-03-14 Thread Bjorn Helgaas
On Tue, Mar 14, 2017 at 06:56:26PM +0100, Thomas Gleixner wrote: > On Tue, 14 Mar 2017, Andi Kleen wrote: > > The other option is to simply make it unconditional. That would > > be even simpler, but it is a bit more risky. Hmm, I suppose may > > be worth trying to find out what Windows uses. If the

Re: [PATCH 3/4] x86, pci: Add interface to force mmconfig

2017-03-14 Thread Thomas Gleixner
On Tue, 14 Mar 2017, Andi Kleen wrote: > The other option is to simply make it unconditional. That would > be even simpler, but it is a bit more risky. Hmm, I suppose may > be worth trying to find out what Windows uses. If they get away > with MMCONFIG everywhere we should be too. >From the PCIe s

Re: [PATCH 3/4] x86, pci: Add interface to force mmconfig

2017-03-14 Thread Andi Kleen
> > Or define some quirk table just for this purpose? > > Nope. It's about identifying the bus. PCI just has no good way to identify busses. > > The bus which contains the uncore devices: > > The Uncore devices reside on CPUBUSNO(1), which is the PCI bus assigned > for the processor socket.

Re: [PATCH 3/4] x86, pci: Add interface to force mmconfig

2017-03-14 Thread Thomas Gleixner
On Tue, 14 Mar 2017, Andi Kleen wrote: > > And the way how this function is used is a horrible hack. It's called from > > a random driver at some random point in time. > > > > The proper solution is to identify the bus at the point where the bus is > > discovered and switch it to mmconfig if poss

Re: [PATCH 3/4] x86, pci: Add interface to force mmconfig

2017-03-14 Thread Andi Kleen
> And the way how this function is used is a horrible hack. It's called from > a random driver at some random point in time. > > The proper solution is to identify the bus at the point where the bus is > discovered and switch it to mmconfig if possible. But how would you know that it is safe? AFA

Re: [PATCH 3/4] x86, pci: Add interface to force mmconfig

2017-03-14 Thread Thomas Gleixner
On Thu, 2 Mar 2017, Andi Kleen wrote: > +struct pci_ops pci_mmconfig_ops = { > + .read = pci_mmconfig_read, > + .write = pci_mmconfig_write, > +}; > + > +/* Force all config accesses to go through mmconfig. */ > +int pci_bus_force_mmconfig(struct pci_bus *bus) > +{ > + if (!raw_pci_ext_

[PATCH 3/4] x86, pci: Add interface to force mmconfig

2017-03-02 Thread Andi Kleen
From: Andi Kleen This fills in the pci_bus_force_mmconfig interface that was added earlier for x86 to allow drivers to optimize config space accesses. The implementation is straight forward and uses the existing mmconfig access functions, just forcing mmconfig access. Signed-off-by: Andi Kleen