OSDN Git Service

powerpc: Fix circular dependency between percpu.h and mmu.h
authorMichael Ellerman <mpe@ellerman.id.au>
Tue, 4 Aug 2020 12:44:06 +0000 (22:44 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 4 Aug 2020 13:15:59 +0000 (23:15 +1000)
commit0c83b277ada72b585e6a3e52b067669df15bcedb
tree5850a18df65d9d40478efdc2d62bc3b323692357
parent2075ec9896c5aef01e837198381d04cfa6452317
powerpc: Fix circular dependency between percpu.h and mmu.h

Recently random.h started including percpu.h (see commit
f227e3ec3b5c ("random32: update the net random state on interrupt and
activity")), which broke corenet64_smp_defconfig:

  In file included from /linux/arch/powerpc/include/asm/paca.h:18,
                   from /linux/arch/powerpc/include/asm/percpu.h:13,
                   from /linux/include/linux/random.h:14,
                   from /linux/lib/uuid.c:14:
  /linux/arch/powerpc/include/asm/mmu.h:139:22: error: unknown type name 'next_tlbcam_idx'
    139 | DECLARE_PER_CPU(int, next_tlbcam_idx);

This is due to a circular header dependency:
  asm/mmu.h includes asm/percpu.h, which includes asm/paca.h, which
  includes asm/mmu.h

Which means DECLARE_PER_CPU() isn't defined when mmu.h needs it.

We can fix it by moving the include of paca.h below the include of
asm-generic/percpu.h.

This moves the include of paca.h out of the #ifdef __powerpc64__, but
that is OK because paca.h is almost entirely inside #ifdef
CONFIG_PPC64 anyway.

It also moves the include of paca.h out of the #ifdef CONFIG_SMP,
which could possibly break something, but seems to have no ill
effects.

Fixes: f227e3ec3b5c ("random32: update the net random state on interrupt and activity")
Cc: stable@vger.kernel.org # v5.8
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200804130558.292328-1-mpe@ellerman.id.au
arch/powerpc/include/asm/percpu.h