[PATCH v16 3/9] ptp: Reorganize ptp_kvm module to make it arch-independent.

Marc Zyngier maz at kernel.org
Tue Feb 2 08:23:12 EST 2021


On 2020-12-09 06:09, Jianyong Wu wrote:
> Currently, ptp_kvm modules implementation is only for x86 which 
> includes
> large part of arch-specific code.  This patch moves all of this code
> into a new arch related file in the same directory.
> 
> Signed-off-by: Jianyong Wu <jianyong.wu at arm.com>
> ---
>  drivers/ptp/Makefile                        |  1 +
>  drivers/ptp/{ptp_kvm.c => ptp_kvm_common.c} | 84 +++++-------------
>  drivers/ptp/ptp_kvm_x86.c                   | 96 +++++++++++++++++++++
>  include/linux/ptp_kvm.h                     | 16 ++++
>  4 files changed, 135 insertions(+), 62 deletions(-)
>  rename drivers/ptp/{ptp_kvm.c => ptp_kvm_common.c} (60%)
>  create mode 100644 drivers/ptp/ptp_kvm_x86.c
>  create mode 100644 include/linux/ptp_kvm.h
> 

[...]

> diff --git a/include/linux/ptp_kvm.h b/include/linux/ptp_kvm.h
> new file mode 100644
> index 000000000000..6f104b1967bb
> --- /dev/null
> +++ b/include/linux/ptp_kvm.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * Virtual PTP 1588 clock for use with KVM guests
> + *
> + * Copyright (C) 2017 Red Hat Inc.
> + */
> +
> +#ifndef _PTP_KVM_H_
> +#define _PTP_KVM_H_
> +
> +int kvm_arch_ptp_init(void);
> +int kvm_arch_ptp_get_clock(struct timespec64 *ts);
> +int kvm_arch_ptp_get_crosststamp(u64 *cycle,
> +		struct timespec64 *tspec, struct clocksource **cs);

You probably want some forward declarations for timespec64 and
clocksource, so that this include file is standalone.

Thanks,

         M.
-- 
Jazz is not dead. It just smells funny...



More information about the linux-arm-kernel mailing list