Skip to content

Commit 803602b

Browse files
ouptonMarc Zyngier
authored andcommitted
KVM: arm64: Remove vestiges of debug_ptr
Delete the remnants of debug_ptr now that debug registers are selected based on the debug owner instead. 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]>
1 parent 3b77809 commit 803602b

File tree

4 files changed

+1
-38
lines changed

4 files changed

+1
-38
lines changed

arch/arm64/include/asm/kvm_host.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -748,11 +748,7 @@ struct kvm_vcpu_arch {
748748
*
749749
* external_debug_state contains the debug values we want to debug the
750750
* guest. This is set via the KVM_SET_GUEST_DEBUG ioctl.
751-
*
752-
* debug_ptr points to the set of debug registers that should be loaded
753-
* onto the hardware when running the guest.
754751
*/
755-
struct kvm_guest_debug_arch *debug_ptr;
756752
struct kvm_guest_debug_arch vcpu_debug_state;
757753
struct kvm_guest_debug_arch external_debug_state;
758754

@@ -1350,7 +1346,6 @@ void kvm_init_host_debug_data(void);
13501346
void kvm_arm_vcpu_init_debug(struct kvm_vcpu *vcpu);
13511347
void kvm_arm_setup_debug(struct kvm_vcpu *vcpu);
13521348
void kvm_arm_clear_debug(struct kvm_vcpu *vcpu);
1353-
void kvm_arm_reset_debug_ptr(struct kvm_vcpu *vcpu);
13541349
void kvm_vcpu_load_debug(struct kvm_vcpu *vcpu);
13551350
void kvm_debug_set_guest_ownership(struct kvm_vcpu *vcpu);
13561351

arch/arm64/kvm/arm.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,6 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
476476

477477
kvm_pmu_vcpu_init(vcpu);
478478

479-
kvm_arm_reset_debug_ptr(vcpu);
480-
481479
kvm_arm_pvtime_vcpu_init(&vcpu->arch);
482480

483481
vcpu->arch.hw_mmu = &vcpu->kvm->arch.mmu;

arch/arm64/kvm/debug.c

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,6 @@ void kvm_arm_vcpu_init_debug(struct kvm_vcpu *vcpu)
118118
preempt_enable();
119119
}
120120

121-
/**
122-
* kvm_arm_reset_debug_ptr - reset the debug ptr to point to the vcpu state
123-
* @vcpu: the vcpu pointer
124-
*/
125-
126-
void kvm_arm_reset_debug_ptr(struct kvm_vcpu *vcpu)
127-
{
128-
vcpu->arch.debug_ptr = &vcpu->arch.vcpu_debug_state;
129-
}
130-
131121
/**
132122
* kvm_arm_setup_debug - set up debug related stuff
133123
*
@@ -198,20 +188,13 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
198188
}
199189

200190
/*
201-
* HW Breakpoints and watchpoints
202-
*
203-
* We simply switch the debug_ptr to point to our new
204-
* external_debug_state which has been populated by the
205-
* debug ioctl. The existing DEBUG_DIRTY mechanism ensures
206-
* the registers are updated on the world switch.
191+
* Enable breakpoints and watchpoints if userspace wants them.
207192
*/
208193
if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW) {
209-
/* Enable breakpoints/watchpoints */
210194
mdscr = vcpu_read_sys_reg(vcpu, MDSCR_EL1);
211195
mdscr |= DBG_MDSCR_MDE;
212196
vcpu_write_sys_reg(vcpu, mdscr, MDSCR_EL1);
213197

214-
vcpu->arch.debug_ptr = &vcpu->arch.external_debug_state;
215198
vcpu_set_flag(vcpu, DEBUG_DIRTY);
216199

217200
/*
@@ -229,9 +212,6 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
229212
}
230213
}
231214

232-
BUG_ON(!vcpu->guest_debug &&
233-
vcpu->arch.debug_ptr != &vcpu->arch.vcpu_debug_state);
234-
235215
/* If KDE or MDE are set, perform a full save/restore cycle. */
236216
if (vcpu_read_sys_reg(vcpu, MDSCR_EL1) & (DBG_MDSCR_KDE | DBG_MDSCR_MDE))
237217
vcpu_set_flag(vcpu, DEBUG_DIRTY);
@@ -253,14 +233,6 @@ void kvm_arm_clear_debug(struct kvm_vcpu *vcpu)
253233
}
254234

255235
restore_guest_debug_regs(vcpu);
256-
257-
/*
258-
* If we were using HW debug we need to restore the
259-
* debug_ptr to the guest debug state.
260-
*/
261-
if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW) {
262-
kvm_arm_reset_debug_ptr(vcpu);
263-
}
264236
}
265237
}
266238

arch/arm64/kvm/hyp/nvhe/hyp-main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ static void flush_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu)
112112

113113
hyp_vcpu->vcpu.arch.iflags = host_vcpu->arch.iflags;
114114

115-
hyp_vcpu->vcpu.arch.debug_ptr = kern_hyp_va(host_vcpu->arch.debug_ptr);
116-
117115
hyp_vcpu->vcpu.arch.vsesr_el2 = host_vcpu->arch.vsesr_el2;
118116

119117
hyp_vcpu->vcpu.arch.vgic_cpu.vgic_v3 = host_vcpu->arch.vgic_cpu.vgic_v3;

0 commit comments

Comments
 (0)