ARM: spectre-v2: per-CPU vtables to work around big.Little systems
authorRussell King <rmk+kernel@armlinux.org.uk>
Thu, 14 Feb 2019 14:49:28 +0000 (09:49 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Feb 2019 09:18:27 +0000 (10:18 +0100)
commitab6c39771d579350bcd9c46514831b05430bd51a
treeaa13fe5089a5d051f9840e8c93799e1d333a4566
parent2dbc7e3efe2ca2e9eb614c66ea725c2116103b56
ARM: spectre-v2: per-CPU vtables to work around big.Little systems

Commit 383fb3ee8024d596f488d2dbaf45e572897acbdb upstream.

In big.Little systems, some CPUs require the Spectre workarounds in
paths such as the context switch, but other CPUs do not.  In order
to handle these differences, we need per-CPU vtables.

We are unable to use the kernel's per-CPU variables to support this
as per-CPU is not initialised at times when we need access to the
vtables, so we have to use an array indexed by logical CPU number.

We use an array-of-pointers to avoid having function pointers in
the kernel's read/write .data section.

Note: Added include of linux/slab.h in arch/arm/smp.c.

Reviewed-by: Julien Thierry <julien.thierry@arm.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David A. Long <dave.long@linaro.org>
Reviewed-by: Julien Thierry <julien.thierry@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm/include/asm/proc-fns.h
arch/arm/kernel/setup.c
arch/arm/kernel/smp.c
arch/arm/mm/proc-v7-bugs.c