]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: arm64: Inject UNDEF when accessing MTE sysregs with MTE disabled
authorFuad Tabba <tabba@google.com>
Thu, 22 Jan 2026 11:22:17 +0000 (11:22 +0000)
committerMarc Zyngier <maz@kernel.org>
Fri, 23 Jan 2026 11:28:48 +0000 (11:28 +0000)
commit5ee8ad69da07d0e2cffa0ce2f2339c9ad2d587f2
treeb4e0a9007a5f25f9523387455217e9ac3b1cca5e
parentf35abcbb8a084db4c24b66ccc8db0405c08e2f61
KVM: arm64: Inject UNDEF when accessing MTE sysregs with MTE disabled

When MTE hardware is present but disabled via software (`arm64.nomte` or
`CONFIG_ARM64_MTE=n`), the kernel clears `HCR_EL2.ATA` and sets
`HCR_EL2.TID5`, to prevent the use of MTE instructions.

Additionally, accesses to certain MTE system registers trap to EL2 with
exception class ESR_ELx_EC_SYS64. To emulate hardware without MTE (where
such accesses would cause an Undefined Instruction exception), inject
UNDEF into the host.

Signed-off-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20260122112218.531948-4-tabba@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/nvhe/hyp-main.c