Commit c37f7c52 authored by Michael Ellerman's avatar Michael Ellerman Committed by Kelsey Skunberg

powerpc: Fix circular dependency between percpu.h and mmu.h

BugLink: https://bugs.launchpad.net/bugs/1892822

commit 0c83b277 upstream.

Recently random.h started including percpu.h (see commit
f227e3ec ("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: f227e3ec ("random32: update the net random state on interrupt and activity")
Cc: stable@vger.kernel.org # v5.8
Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200804130558.292328-1-mpe@ellerman.id.auSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKelsey Skunberg <kelsey.skunberg@canonical.com>
parent d4c02a1e
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
#include <asm/paca.h>
#define __my_cpu_offset local_paca->data_offset #define __my_cpu_offset local_paca->data_offset
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
...@@ -18,4 +16,6 @@ ...@@ -18,4 +16,6 @@
#include <asm-generic/percpu.h> #include <asm-generic/percpu.h>
#include <asm/paca.h>
#endif /* _ASM_POWERPC_PERCPU_H_ */ #endif /* _ASM_POWERPC_PERCPU_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment