summaryrefslogtreecommitdiffstats
path: root/drivers/ptp
diff options
context:
space:
mode:
authorRadim Krčmář <rkrcmar@redhat.com>2017-02-15 20:27:20 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2017-02-16 18:42:17 +0100
commit4306f200c71b959c44c32c8a0048fd5857a357c5 (patch)
treed617e885fd9bee0a0a1658040ac85c6251d1a73d /drivers/ptp
parent681bcea802f2bf0a28cdf0fd0f813de7bb5cd3c7 (diff)
downloadop-kernel-dev-4306f200c71b959c44c32c8a0048fd5857a357c5.zip
op-kernel-dev-4306f200c71b959c44c32c8a0048fd5857a357c5.tar.gz
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: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'drivers/ptp')
-rw-r--r--drivers/ptp/ptp_kvm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/ptp/ptp_kvm.c b/drivers/ptp/ptp_kvm.c
index 0a54e83..09b4df7 100644
--- a/drivers/ptp/ptp_kvm.c
+++ b/drivers/ptp/ptp_kvm.c
@@ -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,
+ KVM_CLOCK_PAIRING_WALLCLOCK);
+ 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);
OpenPOWER on IntegriCloud