aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Upton <[email protected]>2022-02-03 17:41:54 +0000
committerMarc Zyngier <[email protected]>2022-02-08 14:23:40 +0000
commite2ffceaae50883c5064641167078e5720fd8b74a (patch)
tree70f5aff4764a101d5d072ab84bdbb55b5c93f750
parentdfd42facf1e4ada021b939b4e19c935dcdd55566 (diff)
KVM: arm64: Correctly treat writes to OSLSR_EL1 as undefined
Writes to OSLSR_EL1 are UNDEFINED and should never trap from EL1 to EL2, but the kvm trap handler for OSLSR_EL1 handles writes via ignore_write(). This is confusing to readers of code, but should have no functional impact. For clarity, use write_to_read_only() rather than ignore_write(). If a trap is unexpectedly taken to EL2 in violation of the architecture, this will WARN_ONCE() and inject an undef into the guest. Reviewed-by: Reiji Watanabe <[email protected]> Reviewed-by: Mark Rutland <[email protected]> [adopted Mark's changelog suggestion, thanks!] Signed-off-by: Oliver Upton <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--arch/arm64/kvm/sys_regs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index 4dc2fba316ff..85208acd273d 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -292,7 +292,7 @@ static bool trap_oslsr_el1(struct kvm_vcpu *vcpu,
const struct sys_reg_desc *r)
{
if (p->is_write) {
- return ignore_write(vcpu, p);
+ return write_to_read_only(vcpu, p, r);
} else {
p->regval = (1 << 3);
return true;