]> www.infradead.org Git - users/jedix/linux-maple.git/commit
arm64/fpsimd: Avoid RES0 bits in the SME trap handler
authorMark Rutland <mark.rutland@arm.com>
Wed, 9 Apr 2025 16:39:58 +0000 (17:39 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 9 Apr 2025 17:06:30 +0000 (18:06 +0100)
commit95507570fb2f75544af69760cd5d8f48fc5c7f20
tree603aba45b8c0efd14addd6cc5f057520c1b24002
parent0af2f6be1b4281385b618cb86ad946eded089ac8
arm64/fpsimd: Avoid RES0 bits in the SME trap handler

The SME trap handler consumes RES0 bits from the ESR when determining
the reason for the trap, and depends upon those bits reading as zero.
This may break in future when those RES0 bits are allocated a meaning
and stop reading as zero.

For SME traps taken with ESR_ELx.EC == 0b011101, the specific reason for
the trap is indicated by ESR_ELx.ISS.SMTC ("SME Trap Code"). This field
occupies bits [2:0] of ESR_ELx.ISS, and as of ARM DDI 0487 L.a, bits
[24:3] of ESR_ELx.ISS are RES0. ESR_ELx.ISS itself occupies bits [24:0]
of ESR_ELx.

Extract the SMTC field specifically, matching the way we handle ESR_ELx
fields elsewhere, and ensuring that the handler is future-proof.

Fixes: 8bd7f91c03d8 ("arm64/sme: Implement traps and syscall handling for SME")
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Will Deacon <will@kernel.org>
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20250409164010.3480271-2-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/esr.h
arch/arm64/kernel/fpsimd.c