linux/arch/powerpc
Oliver O'Halloran dc3d8f85bb powerpc/powernv/pci: Re-work bus PE configuration
For normal PHBs IODA PEs are handled on a per-bus basis so all the devices
on that bus will share a PE. Which PE specificly is determined by the location
of the MMIO BARs for the devices on the bus so we can't actually configure the
bus PEs until after MMIO resources are allocated. As a result PEs are currently
configured by pcibios_setup_bridge(), which is called just before the bridge
windows are programmed into the bus' parent bridge. Configuring the bus PE here
causes a few problems:

1. The root bus doesn't have a parent bridge so setting up the PE for the root
   bus requires some hacks.

2. The PELT-V isn't setup correctly because pnv_ioda_set_peltv() assumes that
   PEs will be configured in root-to-leaf order. This assumption is broken
   because resource assignment is performed depth-first so the leaf bridges
   are setup before their parents are. The hack mentioned in 1) results in
   the "correct" PELT-V for busses immediately below the root port, but not
   for devices below a switch.

3. It's possible to break the sysfs PCI rescan feature by removing all
   the devices on a bus. When the last device is removed from a PE its
   will be de-configured. Rescanning the devices on a bus does not cause
   the bridge to be reconfigured rendering the devices on that bus
   unusable.

We can address most of these problems by moving the PE setup out of
pcibios_setup_bridge() and into pcibios_bus_add_device(). This fixes 1)
and 2) because pcibios_bus_add_device() is called on each device in
root-to-leaf order so PEs for parent buses will always be configured
before their children. It also fixes 3) by ensuring the PE is
configured before initialising DMA for the device. In the event the PE
was de-configured due to removing all the devices in that PE it will
now be reconfigured when a new device is added since there's no
dependecy on the bridge_setup() hook being called.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200417073508.30356-3-oohall@gmail.com
2020-05-28 23:24:39 +10:00
..
boot powerpc/40x: Remove EP405 2020-05-28 23:24:35 +10:00
configs powerpc/40x: Remove EP405 2020-05-28 23:24:35 +10:00
crypto crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
include powerpc/64s/kuap: Conditionally restore AMR in kuap_restore_amr asm 2020-05-28 23:24:37 +10:00
kernel powerpc/64s/kuap: Conditionally restore AMR in kuap_restore_amr asm 2020-05-28 23:24:37 +10:00
kexec powerpc updates for 5.7 2020-04-05 11:12:59 -07:00
kvm Merge branch 'topic/ppc-kvm' into next 2020-05-20 23:38:13 +10:00
lib powerpc: Add ppc_inst_as_u64() 2020-05-26 23:36:57 +10:00
math-emu
mm powerpc/40x: Rework 40x PTE access and TLB miss 2020-05-28 23:24:34 +10:00
net treewide: Use sizeof_field() macro 2019-12-09 10:36:44 -08:00
oprofile powerpc updates for 5.6 2020-02-04 13:06:46 +00:00
perf powerpc/8xx: Remove now unused TLB miss functions 2020-05-26 22:22:22 +10:00
platforms powerpc/powernv/pci: Re-work bus PE configuration 2020-05-28 23:24:39 +10:00
purgatory .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
sysdev powerpc: Remove Xilinx PPC405/PPC440 support 2020-05-28 23:24:34 +10:00
tools powerpc/head_check: Avoid broken pipe 2020-05-19 00:10:35 +10:00
xmon powerpc: Add ppc_inst_next() 2020-05-26 23:36:51 +10:00
Kbuild powerpc/kexec: Move kexec files into a dedicated subdir. 2019-11-21 15:41:34 +11:00
Kconfig Merge branch 'fixes' into next 2020-05-26 22:56:03 +10:00
Kconfig.debug powerpc: Remove Xilinx PPC405/PPC440 support 2020-05-28 23:24:34 +10:00
Makefile powerpc: Suppress .eh_frame generation 2020-04-01 14:30:51 +11:00
Makefile.postlink powerpc: Do not consider weak unresolved symbol relocations as bad 2020-01-31 20:17:22 +11:00