arm64: entry: consolidate Cortex-A76 erratum 1463225 workaround
authorMark Rutland <mark.rutland@arm.com>
Tue, 2 Feb 2021 12:03:41 +0000 (12:03 +0000)
committerWill Deacon <will@kernel.org>
Mon, 8 Feb 2021 17:39:02 +0000 (17:39 +0000)
commit6459b8469753e9feaa8b34691d097cffad905931
tree7b7b83247705771f0f7004ab7d3b9f2b5c1f726e
parentc0b15c25d25171db4b70cc0b7dbc1130ee94017d
arm64: entry: consolidate Cortex-A76 erratum 1463225 workaround

The workaround for Cortex-A76 erratum 1463225 is split across the
syscall and debug handlers in separate files. This structure currently
forces us to do some redundant work for debug exceptions from EL0, is a
little difficult to follow, and gets in the way of some future rework of
the exception entry code as it requires exceptions to be unmasked late
in the syscall handling path.

To simplify things, and as a preparatory step for future rework of
exception entry, this patch moves all the workaround logic into
entry-common.c. As the debug handler only needs to run for EL1 debug
exceptions, we no longer call it for EL0 debug exceptions, and no longer
need to check user_mode(regs) as this is always false. For clarity
cortex_a76_erratum_1463225_debug_handler() is changed to return bool.

In the SVC path, the workaround is applied earlier, but this should have
no functional impact as exceptions are still masked. In the debug path
we run the fixup before explicitly disabling preemption, but we will not
attempt to preempt before returning from the exception.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20210202120341.28858-1-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/cpu_errata.c
arch/arm64/kernel/entry-common.c
arch/arm64/kernel/syscall.c
arch/arm64/mm/fault.c