Skip to content

Commit 11f2534

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 KVM fix from Catalin Marinas: "Set the correct MDCR_EL2 register value on the first run of a vCPU" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: KVM: arm64: Write arch.mdcr_el2 changes since last vcpu_load on VHE
2 parents 39bed42 + 4942dc6 commit 11f2534

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arch/arm64/kvm/debug.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void kvm_arm_reset_debug_ptr(struct kvm_vcpu *vcpu)
101101
void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
102102
{
103103
bool trap_debug = !(vcpu->arch.flags & KVM_ARM64_DEBUG_DIRTY);
104-
unsigned long mdscr;
104+
unsigned long mdscr, orig_mdcr_el2 = vcpu->arch.mdcr_el2;
105105

106106
trace_kvm_arm_setup_debug(vcpu, vcpu->guest_debug);
107107

@@ -197,6 +197,10 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
197197
if (vcpu_read_sys_reg(vcpu, MDSCR_EL1) & (DBG_MDSCR_KDE | DBG_MDSCR_MDE))
198198
vcpu->arch.flags |= KVM_ARM64_DEBUG_DIRTY;
199199

200+
/* Write mdcr_el2 changes since vcpu_load on VHE systems */
201+
if (has_vhe() && orig_mdcr_el2 != vcpu->arch.mdcr_el2)
202+
write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2);
203+
200204
trace_kvm_arm_set_dreg32("MDCR_EL2", vcpu->arch.mdcr_el2);
201205
trace_kvm_arm_set_dreg32("MDSCR_EL1", vcpu_read_sys_reg(vcpu, MDSCR_EL1));
202206
}

0 commit comments

Comments
 (0)