]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: arm64: Remove vestiges of debug_ptr
authorOliver Upton <oliver.upton@linux.dev>
Thu, 19 Dec 2024 22:41:07 +0000 (14:41 -0800)
committerMarc Zyngier <maz@kernel.org>
Fri, 20 Dec 2024 09:01:25 +0000 (09:01 +0000)
Delete the remnants of debug_ptr now that debug registers are selected
based on the debug owner instead.

Tested-by: James Clark <james.clark@linaro.org>
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20241219224116.3941496-11-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/arm.c
arch/arm64/kvm/debug.c
arch/arm64/kvm/hyp/nvhe/hyp-main.c

index 5ef1b2f69e89d91b2d3fec3cd331ea4e0ae5ff99..905b84e59c24de531b8fe5c2875935775f069700 100644 (file)
@@ -748,11 +748,7 @@ struct kvm_vcpu_arch {
         *
         * external_debug_state contains the debug values we want to debug the
         * guest. This is set via the KVM_SET_GUEST_DEBUG ioctl.
-        *
-        * debug_ptr points to the set of debug registers that should be loaded
-        * onto the hardware when running the guest.
         */
-       struct kvm_guest_debug_arch *debug_ptr;
        struct kvm_guest_debug_arch vcpu_debug_state;
        struct kvm_guest_debug_arch external_debug_state;
 
@@ -1350,7 +1346,6 @@ void kvm_init_host_debug_data(void);
 void kvm_arm_vcpu_init_debug(struct kvm_vcpu *vcpu);
 void kvm_arm_setup_debug(struct kvm_vcpu *vcpu);
 void kvm_arm_clear_debug(struct kvm_vcpu *vcpu);
-void kvm_arm_reset_debug_ptr(struct kvm_vcpu *vcpu);
 void kvm_vcpu_load_debug(struct kvm_vcpu *vcpu);
 void kvm_debug_set_guest_ownership(struct kvm_vcpu *vcpu);
 
index a068337da52ab172cad4f9e74178adb437c00b9d..44a6093b0d9eb4efb8eb5c0ffc038251de1833d1 100644 (file)
@@ -476,8 +476,6 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
 
        kvm_pmu_vcpu_init(vcpu);
 
-       kvm_arm_reset_debug_ptr(vcpu);
-
        kvm_arm_pvtime_vcpu_init(&vcpu->arch);
 
        vcpu->arch.hw_mmu = &vcpu->kvm->arch.mmu;
index 9979fc1a20bd3ad20eb688792c48cf35d8cc26f4..f39004c52d3345db39b11e909aadfa4d2612b450 100644 (file)
@@ -118,16 +118,6 @@ void kvm_arm_vcpu_init_debug(struct kvm_vcpu *vcpu)
        preempt_enable();
 }
 
-/**
- * kvm_arm_reset_debug_ptr - reset the debug ptr to point to the vcpu state
- * @vcpu:      the vcpu pointer
- */
-
-void kvm_arm_reset_debug_ptr(struct kvm_vcpu *vcpu)
-{
-       vcpu->arch.debug_ptr = &vcpu->arch.vcpu_debug_state;
-}
-
 /**
  * kvm_arm_setup_debug - set up debug related stuff
  *
@@ -198,20 +188,13 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
                }
 
                /*
-                * HW Breakpoints and watchpoints
-                *
-                * We simply switch the debug_ptr to point to our new
-                * external_debug_state which has been populated by the
-                * debug ioctl. The existing DEBUG_DIRTY mechanism ensures
-                * the registers are updated on the world switch.
+                * Enable breakpoints and watchpoints if userspace wants them.
                 */
                if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW) {
-                       /* Enable breakpoints/watchpoints */
                        mdscr = vcpu_read_sys_reg(vcpu, MDSCR_EL1);
                        mdscr |= DBG_MDSCR_MDE;
                        vcpu_write_sys_reg(vcpu, mdscr, MDSCR_EL1);
 
-                       vcpu->arch.debug_ptr = &vcpu->arch.external_debug_state;
                        vcpu_set_flag(vcpu, DEBUG_DIRTY);
 
                /*
@@ -229,9 +212,6 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
                }
        }
 
-       BUG_ON(!vcpu->guest_debug &&
-               vcpu->arch.debug_ptr != &vcpu->arch.vcpu_debug_state);
-
        /* If KDE or MDE are set, perform a full save/restore cycle. */
        if (vcpu_read_sys_reg(vcpu, MDSCR_EL1) & (DBG_MDSCR_KDE | DBG_MDSCR_MDE))
                vcpu_set_flag(vcpu, DEBUG_DIRTY);
@@ -253,14 +233,6 @@ void kvm_arm_clear_debug(struct kvm_vcpu *vcpu)
                }
 
                restore_guest_debug_regs(vcpu);
-
-               /*
-                * If we were using HW debug we need to restore the
-                * debug_ptr to the guest debug state.
-                */
-               if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW) {
-                       kvm_arm_reset_debug_ptr(vcpu);
-               }
        }
 }
 
index 16f5da3a884a47fc400e9bc847c69e4dc90c40c6..f98ef98af18374db5ff381dd600367b02726da2f 100644 (file)
@@ -112,8 +112,6 @@ static void flush_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu)
 
        hyp_vcpu->vcpu.arch.iflags      = host_vcpu->arch.iflags;
 
-       hyp_vcpu->vcpu.arch.debug_ptr   = kern_hyp_va(host_vcpu->arch.debug_ptr);
-
        hyp_vcpu->vcpu.arch.vsesr_el2   = host_vcpu->arch.vsesr_el2;
 
        hyp_vcpu->vcpu.arch.vgic_cpu.vgic_v3 = host_vcpu->arch.vgic_cpu.vgic_v3;