Skip to content

Commit 4cefbec

Browse files
ouptonMarc Zyngier
authored andcommitted
KVM: arm64: Clean up KVM_SET_GUEST_DEBUG handler
No particular reason other than it isn't nice to look at. 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 cd9b101 commit 4cefbec

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

arch/arm64/kvm/guest.c

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -917,31 +917,24 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
917917
int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
918918
struct kvm_guest_debug *dbg)
919919
{
920-
int ret = 0;
921-
922920
trace_kvm_set_guest_debug(vcpu, dbg->control);
923921

924-
if (dbg->control & ~KVM_GUESTDBG_VALID_MASK) {
925-
ret = -EINVAL;
926-
goto out;
927-
}
928-
929-
if (dbg->control & KVM_GUESTDBG_ENABLE) {
930-
vcpu->guest_debug = dbg->control;
931-
932-
/* Hardware assisted Break and Watch points */
933-
if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW) {
934-
vcpu->arch.external_debug_state = dbg->arch;
935-
}
922+
if (dbg->control & ~KVM_GUESTDBG_VALID_MASK)
923+
return -EINVAL;
936924

937-
} else {
938-
/* If not enabled clear all flags */
925+
if (!(dbg->control & KVM_GUESTDBG_ENABLE)) {
939926
vcpu->guest_debug = 0;
940927
vcpu_clear_flag(vcpu, DBG_SS_ACTIVE_PENDING);
928+
return 0;
941929
}
942930

943-
out:
944-
return ret;
931+
vcpu->guest_debug = dbg->control;
932+
933+
/* Hardware assisted Break and Watch points */
934+
if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW)
935+
vcpu->arch.external_debug_state = dbg->arch;
936+
937+
return 0;
945938
}
946939

947940
int kvm_arm_vcpu_arch_set_attr(struct kvm_vcpu *vcpu,

0 commit comments

Comments
 (0)