Commit 4306f200 authored by Radim Krčmář's avatar Radim Krčmář Committed by Paolo Bonzini

ptp_kvm: try to detect hypercall availability

No point in registering the device if it cannot work.
The hypercall does not advertise itself, so we have to call it.
Signed-off-by: default avatarRadim Krčmář <>
Signed-off-by: default avatarPaolo Bonzini <>
parent 681bcea8
......@@ -176,12 +176,19 @@ static void __exit ptp_kvm_exit(void)
static int __init ptp_kvm_init(void)
long ret;
clock_pair_gpa = slow_virt_to_phys(&clock_pair);
hv_clock = pvclock_pvti_cpu0_va();
if (!hv_clock)
return -ENODEV;
ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING, clock_pair_gpa,
if (ret == -KVM_ENOSYS || ret == -KVM_EOPNOTSUPP)
return -ENODEV;
kvm_ptp_clock.caps = ptp_kvm_caps;
kvm_ptp_clock.ptp_clock = ptp_clock_register(&kvm_ptp_clock.caps, NULL);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment