Skip to content

Commit b187038

Browse files
ariloubonzini
authored andcommitted
x86/kvm/hyper-v: Add support for synthetic debugger via hypercalls
There is another mode for the synthetic debugger which uses hypercalls to send/recv network data instead of the MSR interface. This interface is much slower and less recommended since you might get a lot of VMExits while KDVM polling for new packets to recv, rather than simply checking the pending page to see if there is data avialble and then request. Reviewed-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: Jon Doron <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 45c3897 commit b187038

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

arch/x86/kvm/hyperv.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,34 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
18351835
}
18361836
ret = kvm_hv_send_ipi(vcpu, ingpa, outgpa, true, false);
18371837
break;
1838+
case HVCALL_POST_DEBUG_DATA:
1839+
case HVCALL_RETRIEVE_DEBUG_DATA:
1840+
if (unlikely(fast)) {
1841+
ret = HV_STATUS_INVALID_PARAMETER;
1842+
break;
1843+
}
1844+
fallthrough;
1845+
case HVCALL_RESET_DEBUG_SESSION: {
1846+
struct kvm_hv_syndbg *syndbg = vcpu_to_hv_syndbg(vcpu);
1847+
1848+
if (!kvm_hv_is_syndbg_enabled(vcpu)) {
1849+
ret = HV_STATUS_INVALID_HYPERCALL_CODE;
1850+
break;
1851+
}
1852+
1853+
if (!(syndbg->options & HV_X64_SYNDBG_OPTION_USE_HCALLS)) {
1854+
ret = HV_STATUS_OPERATION_DENIED;
1855+
break;
1856+
}
1857+
vcpu->run->exit_reason = KVM_EXIT_HYPERV;
1858+
vcpu->run->hyperv.type = KVM_EXIT_HYPERV_HCALL;
1859+
vcpu->run->hyperv.u.hcall.input = param;
1860+
vcpu->run->hyperv.u.hcall.params[0] = ingpa;
1861+
vcpu->run->hyperv.u.hcall.params[1] = outgpa;
1862+
vcpu->arch.complete_userspace_io =
1863+
kvm_hv_hypercall_complete_userspace;
1864+
return 0;
1865+
}
18381866
default:
18391867
ret = HV_STATUS_INVALID_HYPERCALL_CODE;
18401868
break;

0 commit comments

Comments
 (0)