Unverified Commit 976a0414 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3092 [OLK-5.10]KVM: arm64: Add host/guest KVM-PTP support

Merge Pull Request from: @sundongx 
 
ptp: fix error print of ptp_kvm on X86_64 platform
KVM: arm64: Fix Function ID typo for PTP_KVM service
ptp: Don't print an error if ptp_kvm is not supported
ptp: arm/arm64: Enable ptp_kvm for arm/arm64
KVM: arm64: Add support for the KVM PTP service
clocksource: Add clocksource id for arm arch counter
time: Add mechanism to recognize clocksource in time_get_snapshot
ptp: Reorganize ptp_kvm.c to make it arch-independent
KVM: arm64: Advertise KVM UID to guests via SMCCC
arm/arm64: Probe for the presence of KVM hypervisor
KVM: arm64: fix compile error

https://gitee.com/openeuler/kernel/issues/I8DWT1 
 
Link:https://gitee.com/openeuler/kernel/pulls/3092

 

Reviewed-by: default avatarWeilong Chen <chenweilong@huawei.com>
Reviewed-by: default avatarLiu Chao <liuchao173@huawei.com>
Reviewed-by: default avatarZenghui Yu <yuzenghui@huawei.com>
Reviewed-by: default avatarKevin Zhu <zhukeqian1@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parents 3faea8b7 a67b622c
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -6763,6 +6763,15 @@ guest according to the bits in the KVM_CPUID_FEATURES CPUID leaf
(0x40000001). Otherwise, a guest may use the paravirtual features
regardless of what has actually been exposed through the CPUID leaf.

8.31 KVM_CAP_PTP_KVM
--------------------

:Architectures: arm64

This capability indicates that the KVM virtual PTP service is
supported in the host. A VMM can check whether the service is
available to the guest on migration.

9. Known KVM API problems
=========================

+1 −0
Original line number Diff line number Diff line
@@ -10,3 +10,4 @@ ARM
   hyp-abi
   psci
   pvtime
   ptp_kvm
+25 −0
Original line number Diff line number Diff line
.. SPDX-License-Identifier: GPL-2.0

PTP_KVM support for arm/arm64
=============================

PTP_KVM is used for high precision time sync between host and guests.
It relies on transferring the wall clock and counter value from the
host to the guest using a KVM-specific hypercall.

* ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID: 0x86000001

This hypercall uses the SMC32/HVC32 calling convention:

ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID
    =============    ==========    ==========
    Function ID:     (uint32)      0x86000001
    Arguments:       (uint32)      KVM_PTP_VIRT_COUNTER(0)
                                   KVM_PTP_PHYS_COUNTER(1)
    Return Values:   (int32)       NOT_SUPPORTED(-1) on error, or
                     (uint32)      Upper 32 bits of wall clock time (r0)
                     (uint32)      Lower 32 bits of wall clock time (r1)
                     (uint32)      Upper 32 bits of counter (r2)
                     (uint32)      Lower 32 bits of counter (r3)
    Endianness:                    No Restrictions.
    =============    ==========    ==========
+3 −0
Original line number Diff line number Diff line
@@ -4,4 +4,7 @@

#include <asm/xen/hypervisor.h>

void kvm_init_hyp_services(void);
bool kvm_arm_hyp_service_available(u32 func_id);

#endif
+1 −0
Original line number Diff line number Diff line
@@ -3647,6 +3647,7 @@ CONFIG_PPS_CLIENT_GPIO=m
CONFIG_PTP_1588_CLOCK=y
CONFIG_DP83640_PHY=m
# CONFIG_PTP_1588_CLOCK_INES is not set
CONFIG_PTP_1588_CLOCK_KVM=m
# CONFIG_PTP_1588_CLOCK_IDT82P33 is not set
# CONFIG_PTP_1588_CLOCK_IDTCM is not set
CONFIG_PTP_HISI=m
Loading