diff options
| author | Oliver Upton <[email protected]> | 2024-12-19 22:41:10 +0000 |
|---|---|---|
| committer | Marc Zyngier <[email protected]> | 2024-12-20 09:01:25 +0000 |
| commit | 75a5fbaf6623328d3ac69719145c2247f7b4e299 (patch) | |
| tree | b49242e944f26aef5b414294606fe405ca6822da /arch/arm64/kvm/debug.c | |
| parent | KVM: arm64: Reload vCPU for accesses to OSLAR_EL1 (diff) | |
| download | kernel-75a5fbaf6623328d3ac69719145c2247f7b4e299.tar.gz kernel-75a5fbaf6623328d3ac69719145c2247f7b4e299.zip | |
KVM: arm64: Compute MDCR_EL2 at vcpu_load()
KVM has picked up several hacks to cope with vcpu->arch.mdcr_el2 needing
to be prepared before vcpu_load(), which is when it gets programmed
into hardware on VHE.
Now that the flows for reprogramming MDCR_EL2 have been simplified, move
that computation to vcpu_load().
Tested-by: James Clark <[email protected]>
Signed-off-by: Oliver Upton <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Marc Zyngier <[email protected]>
Diffstat (limited to 'arch/arm64/kvm/debug.c')
| -rw-r--r-- | arch/arm64/kvm/debug.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/arch/arm64/kvm/debug.c b/arch/arm64/kvm/debug.c index dec023673d4c..cc9599a7df5f 100644 --- a/arch/arm64/kvm/debug.c +++ b/arch/arm64/kvm/debug.c @@ -99,20 +99,6 @@ static void kvm_arm_setup_mdcr_el2(struct kvm_vcpu *vcpu) } /** - * kvm_arm_vcpu_init_debug - setup vcpu debug traps - * - * @vcpu: the vcpu pointer - * - * Set vcpu initial mdcr_el2 value. - */ -void kvm_arm_vcpu_init_debug(struct kvm_vcpu *vcpu) -{ - preempt_disable(); - kvm_arm_setup_mdcr_el2(vcpu); - preempt_enable(); -} - -/** * kvm_arm_setup_debug - set up debug related stuff * * @vcpu: the vcpu pointer @@ -131,8 +117,6 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu) { unsigned long mdscr; - kvm_arm_setup_mdcr_el2(vcpu); - /* Check if we need to use the debug registers. */ if (vcpu->guest_debug || kvm_vcpu_os_lock_enabled(vcpu)) { /* Save guest debug state */ @@ -273,6 +257,8 @@ void kvm_vcpu_load_debug(struct kvm_vcpu *vcpu) else vcpu->arch.debug_owner = VCPU_DEBUG_FREE; } + + kvm_arm_setup_mdcr_el2(vcpu); } /* @@ -287,6 +273,7 @@ void kvm_debug_set_guest_ownership(struct kvm_vcpu *vcpu) return; vcpu->arch.debug_owner = VCPU_DEBUG_GUEST_OWNED; + kvm_arm_setup_mdcr_el2(vcpu); } void kvm_debug_handle_oslar(struct kvm_vcpu *vcpu, u64 val) |
