[PATCH] KVM: arm64: Handle trapped reads of SCTLR2_EL2

Fuad Tabba fuad.tabba at linux.dev
Sun Nov 29 23:07:00 PST 2026


On Sat, 28 Nov 2026 at 21:38, Mark Brown <broonie at kernel.org> wrote:
>
> A read of SCTLR2_EL2 from virtual EL2 can trap to the hypervisor for
> local emulation.  The descriptor for it uses access_vm_reg(), which
> is intended to handle writes trapped by HCR_EL2.TVM and calls BUG_ON()
> for a read.
>
> Use access_rw() for SCTLR2_EL2, as is done for SCTLR_EL2, which provides
> a straightforward read path.  For the write path this drops the use of
> kvm_toggle_cache() which checks if cache flushes or disabling of
> HCR_EL2.TVM are required.  The cache state is not managed in SCTLR2_EL2
> so a write to it cannot trigger a flush.  If the caches were already on
> we would delay disabling HCR_EL2.TVM.  Since SCTLR2_EL2 should only be
> present on systems with FEAT_S2FWB this should not occur, but in any
> case it would be a performance rather than correctness issue.
>
> Fixes: 81fbef164766 ("KVM: arm64: Wire up SCTLR2_ELx sysreg descriptors")
> Signed-off-by: Mark Brown <broonie at kernel.org>
> Cc: stable at vger.kernel.org


Tested-by: Fuad Tabba <fuad.tabba at linux.dev>
Reviewed-by: Fuad Tabba <fuad.tabba at linux.dev>

Cheers,
/fuad



More information about the linux-arm-kernel mailing list