KVM: arm64: Stash OSLSR_EL1 in the cpu context
authorOliver Upton <oupton@google.com>
Thu, 3 Feb 2022 17:41:55 +0000 (17:41 +0000)
committerMarc Zyngier <maz@kernel.org>
Tue, 8 Feb 2022 14:23:41 +0000 (14:23 +0000)
commitd42e26716d038d9689a23c193b934cdf0e2a2117
tree62bba50566f32a4edc7457b9f9ed8b5089d12fe0
parente2ffceaae50883c5064641167078e5720fd8b74a
KVM: arm64: Stash OSLSR_EL1 in the cpu context

An upcoming change to KVM will emulate the OS Lock from the PoV of the
guest. Add OSLSR_EL1 to the cpu context and handle reads using the
stored value. Define some mnemonics for for handling the OSLM field and
use them to make the reset value of OSLSR_EL1 more readable.

Wire up a custom handler for writes from userspace and prevent any of
the invariant bits from changing. Note that the OSLK bit is not
invariant and will be made writable by the aforementioned change.

Reviewed-by: Reiji Watanabe <reijiw@google.com>
Signed-off-by: Oliver Upton <oupton@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220203174159.2887882-3-oupton@google.com
arch/arm64/include/asm/kvm_host.h
arch/arm64/include/asm/sysreg.h
arch/arm64/kvm/sys_regs.c