Skip to content

Commit

Permalink
KVM: arm64: Promote guest ownership for DBGxVR/DBGxCR reads
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Oliver Upton authored and Marc Zyngier committed Dec 20, 2024
1 parent 3ce9f33 commit c4a6ed8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions arch/arm64/kvm/sys_regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit c4a6ed8

Please sign in to comment.