]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: arm64: Promote guest ownership for DBGxVR/DBGxCR reads
authorOliver Upton <oliver.upton@linux.dev>
Thu, 19 Dec 2024 22:41:16 +0000 (14:41 -0800)
committerMarc Zyngier <maz@kernel.org>
Fri, 20 Dec 2024 09:04:19 +0000 (09:04 +0000)
Only yielding control of the debug registers for writes is a bit silly,
unless of course you're a fan of pointless traps. Give control of the
debug registers to the guest upon the first access, regardless of
direction.

Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20241219224116.3941496-20-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/sys_regs.c

index d9c7911ec58a64e9114319ce9a95c32d671d6f96..aac79e34cd5066df1b95588235c61bc956e0f0d9 100644 (file)
@@ -643,8 +643,6 @@ static void reg_to_dbg(struct kvm_vcpu *vcpu,
        val &= ~mask;
        val |= (p->regval & (mask >> shift)) << shift;
        *dbg_reg = val;
-
-       kvm_debug_set_guest_ownership(vcpu);
 }
 
 static void dbg_to_reg(struct kvm_vcpu *vcpu,
@@ -690,6 +688,7 @@ static bool trap_dbg_wb_reg(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
        else
                dbg_to_reg(vcpu, p, rd, reg);
 
+       kvm_debug_set_guest_ownership(vcpu);
        return true;
 }