Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  *  Virtual PTP 1588 clock for use with KVM guests
0004  *  Copyright (C) 2019 ARM Ltd.
0005  *  All Rights Reserved
0006  */
0007 
0008 #include <linux/arm-smccc.h>
0009 #include <linux/ptp_kvm.h>
0010 
0011 #include <asm/arch_timer.h>
0012 #include <asm/hypervisor.h>
0013 
0014 int kvm_arch_ptp_init(void)
0015 {
0016     int ret;
0017 
0018     ret = kvm_arm_hyp_service_available(ARM_SMCCC_KVM_FUNC_PTP);
0019     if (ret <= 0)
0020         return -EOPNOTSUPP;
0021 
0022     return 0;
0023 }
0024 
0025 int kvm_arch_ptp_get_clock(struct timespec64 *ts)
0026 {
0027     return kvm_arch_ptp_get_crosststamp(NULL, ts, NULL);
0028 }