Skip to content

Commit

Permalink
ptp_kvm: probe for kvm guest availability
Browse files Browse the repository at this point in the history
In the event of moving pvclock_pvti_cpu0_va() definition to common
pvclock code, this function would return a value on non KVM guests.
Later on this would fail with a GPF on ptp_kvm_init when running on a
Xen guest. Therefore, ptp_kvm_init() should check whether it is running
in a KVM guest.

Signed-off-by: Joao Martins <[email protected]>
Acked-by: Radim Krčmář <[email protected]>
Signed-off-by: Boris Ostrovsky <[email protected]>
  • Loading branch information
jpemartins authored and Boris Ostrovsky committed Nov 8, 2017
1 parent 52847bb commit 001f60e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/ptp/ptp_kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ static int __init ptp_kvm_init(void)
{
long ret;

if (!kvm_para_available())
return -ENODEV;

clock_pair_gpa = slow_virt_to_phys(&clock_pair);
hv_clock = pvclock_pvti_cpu0_va();

Expand Down

0 comments on commit 001f60e

Please sign in to comment.