linux-stable/arch
Oliver O'Halloran 912237ec34 powerpc/pci: Add ppc_md.discover_phbs()
[ Upstream commit 5537fcb319 ]

On many powerpc platforms the discovery and initalisation of
pci_controllers (PHBs) happens inside of setup_arch(). This is very early
in boot (pre-initcalls) and means that we're initialising the PHB long
before many basic kernel services (slab allocator, debugfs, a real ioremap)
are available.

On PowerNV this causes an additional problem since we map the PHB registers
with ioremap(). As of commit d538aadc27 ("powerpc/ioremap: warn on early
use of ioremap()") a warning is printed because we're using the "incorrect"
API to setup and MMIO mapping in searly boot. The kernel does provide
early_ioremap(), but that is not intended to create long-lived MMIO
mappings and a seperate warning is printed by generic code if
early_ioremap() mappings are "leaked."

This is all fixable with dumb hacks like using early_ioremap() to setup
the initial mapping then replacing it with a real ioremap later on in
boot, but it does raise the question: Why the hell are we setting up the
PHB's this early in boot?

The old and wise claim it's due to "hysterical rasins." Aside from amused
grapes there doesn't appear to be any real reason to maintain the current
behaviour. Already most of the newer embedded platforms perform PHB
discovery in an arch_initcall and between the end of setup_arch() and the
start of initcalls none of the generic kernel code does anything PCI
related. On powerpc scanning PHBs occurs in a subsys_initcall so it should
be possible to move the PHB discovery to a core, postcore or arch initcall.

This patch adds the ppc_md.discover_phbs hook and a core_initcall stub that
calls it. The core_initcalls are the earliest to be called so this will
any possibly issues with dependency between initcalls. This isn't just an
academic issue either since on pseries and PowerNV EEH init occurs in an
arch_initcall and depends on the pci_controllers being available, similarly
the creation of pci_dns occurs at core_initcall_sync (i.e. between core and
postcore initcalls). These problems need to be addressed seperately.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
[mpe: Make discover_phbs() static]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201103043523.916109-1-oohall@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-17 17:06:23 +01:00
..
alpha local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
arc arch/arc: add copy_user_page() to <asm/page.h> to fix build error on ARC 2021-01-19 18:27:26 +01:00
arm Xen/gnttab: handle p2m update errors on a per-slot basis 2021-03-07 12:34:15 +01:00
arm64 arm64: Make CPU_BIG_ENDIAN depend on ld.bfd or ld.lld 13.0.0+ 2021-03-11 14:17:22 +01:00
c6x
csky csky: Fix a size determination in gpr_get() 2021-03-04 11:38:21 +01:00
h8300 h8300: fix PREEMPTION build, TI_PRE_COUNT undefined 2021-02-17 11:02:28 +01:00
hexagon local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
ia64 local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
m68k local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
microblaze local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
mips crypto: mips/poly1305 - enable for all MIPS processors 2021-03-17 17:06:10 +01:00
nds32 local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
nios2 nios2: fixed broken sys_clone syscall 2021-03-04 11:38:16 +01:00
openrisc
parisc parisc: Enable -mlong-calls gcc option with CONFIG_COMPILE_TEST 2021-03-11 14:17:21 +01:00
powerpc powerpc/pci: Add ppc_md.discover_phbs() 2021-03-17 17:06:23 +01:00
riscv riscv: Get rid of MAX_EARLY_MAPPING_SIZE 2021-03-07 12:34:05 +01:00
s390 s390/vtime: fix inline assembly clobber list 2021-03-04 11:38:42 +01:00
sh sh: Remove unused HAVE_COPY_THREAD_TLS macro 2021-01-27 11:55:20 +01:00
sparc sparc32: fix a user-triggerable oops in clear_user() 2021-03-04 11:38:43 +01:00
um um: defer killing userspace on page table update failures 2021-03-04 11:38:42 +01:00
x86 KVM: SVM: Clear the CR4 register on reset 2021-03-11 14:17:29 +01:00
xtensa local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
.gitignore
Kconfig fanotify: Fix sys_fanotify_mark() on native x86-32 2021-01-17 14:16:59 +01:00