linux/arch/arm64
Peter Collingbourne 973b9e3733 arm64: mte: move register initialization to C
If FEAT_MTE2 is disabled via the arm64.nomte command line argument on a
CPU that claims to support FEAT_MTE2, the kernel will use Tagged Normal
in the MAIR. If we interpret arm64.nomte to mean that the CPU does not
in fact implement FEAT_MTE2, setting the system register like this may
lead to UNSPECIFIED behavior. Fix it by arranging for MAIR to be set
in the C function cpu_enable_mte which is called based on the sanitized
version of the system register.

There is no need for the rest of the MTE-related system register
initialization to happen from assembly, with the exception of TCR_EL1,
which must be set to include at least TBI1 because the secondary CPUs
access KASan-allocated data structures early. Therefore, make the TCR_EL1
initialization unconditional and move the rest of the initialization to
cpu_enable_mte so that we no longer have a dependency on the unsanitized
ID register value.

Co-developed-by: Evgenii Stepanov <eugenis@google.com>
Signed-off-by: Peter Collingbourne <pcc@google.com>
Signed-off-by: Evgenii Stepanov <eugenis@google.com>
Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: kernel test robot <lkp@intel.com>
Fixes: 3b714d24ef ("arm64: mte: CPU feature detection and initial sysreg configuration")
Cc: <stable@vger.kernel.org> # 5.10.x
Link: https://lore.kernel.org/r/20220915222053.3484231-1-eugenis@google.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2022-09-22 18:02:50 +01:00
..
boot ARM: SoC: late updates for 6.0 2022-08-05 10:02:33 -07:00
configs ARM: new SoC support for 6.0 2022-08-02 08:29:18 -07:00
crypto crypto: arm64/poly1305 - fix a read out-of-bound 2022-07-29 18:29:17 +08:00
hyperv
include arm64: mte: move register initialization to C 2022-09-22 18:02:50 +01:00
kernel arm64: mte: move register initialization to C 2022-09-22 18:02:50 +01:00
kvm KVM/arm64 fixes for 6.0, take #1 2022-08-19 05:43:53 -04:00
lib Networking changes for 6.0. 2022-08-03 16:29:08 -07:00
mm arm64: mte: move register initialization to C 2022-09-22 18:02:50 +01:00
net bpf, arm64: Fix bpf trampoline instruction endianness 2022-08-10 16:50:57 +02:00
tools arm64: errata: add detection for AMEVCNTR01 incrementing incorrectly 2022-08-23 11:06:48 +01:00
xen xen: allow pv-only hypercalls only with CONFIG_XEN_PV 2021-11-02 08:11:01 -05:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig arm64: support huge vmalloc mappings 2022-09-16 09:51:28 +01:00
Kconfig.debug
Kconfig.platforms ARM: new SoC support for 6.0 2022-08-02 08:29:18 -07:00
Makefile kbuild: factor out the common installation code into scripts/install.sh 2022-05-11 21:45:53 +09:00