Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3347849ybg; Fri, 25 Oct 2019 02:49:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUmRAJlFCXbyDl20gxCL1GQurkuyB+d62FDtYso4OckKIA0ABU1jrshP/UYgRoMv62HuY+ X-Received: by 2002:a17:906:184e:: with SMTP id w14mr2521682eje.10.1571996950340; Fri, 25 Oct 2019 02:49:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571996950; cv=none; d=google.com; s=arc-20160816; b=LfnJoKVaUpY8FBIiXm/aCTKoniU3ah8g06mZiULWT8gikcbp06PBydO6Qboy+Wzb+D t+NOUqR3lKC0SjkBFIi+K+JkIc278LXF4I4t7qs+KhHGo5W3ojG0wvW+iEsMoIBrRwFk bcqbJDFQQrAcvycCWSBi8BD7jPPwoycAppuBlyXHKJjfgW6JEamv7M9A93YFvLj9jClp D1BC4myIVO0nwk9Wp0vidLyYnA0QIKDyQ64vOVAN2+TjaUzA9fl1jT1KeeXJpznUndsM 4nFsATCSbNa5wSv9VelBAJo/AWkw3SqaIWCPwXM8aJyWS3pWkMXLxkQG6XOl8euZM/AX WqTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=ob/OQ65n/5YBIhIMWND0x3YSb4kVJX02FlJLSSjYtfo=; b=vTG/kRw2RPJn/s/2OVatOl+zsbzTmBhAHzDGUpiXjPYrmCIITJY07KQH+XYsMkRO7L GkzgIMOVo1/yEL5CEXOL4DaGGA1S3ImxInzG2KwBPENzBTMjE2/avVqB2o+PEI5yJ1o7 YI75P43q0Byru2UmLEaSJvsFeKRwrtR96wKMGLqHxdHhN+LU8op+K1WaHBhAce3Zo0ku o2y+chrGyXxN/4/XkOOdWdurOSzcTrejxbx1kf7+uIv3hkVWmqgFdNDZ9yTAAEJ7lfK/ utjrfJbCyqMayozmoAioiFy3wbR43q974kJw28J0yTwJ7pbJ22fBqWioHL53jglseC1+ wliw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p30si899891eda.205.2019.10.25.02.48.46; Fri, 25 Oct 2019 02:49:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393483AbfJXLDU (ORCPT + 99 others); Thu, 24 Oct 2019 07:03:20 -0400 Received: from foss.arm.com ([217.140.110.172]:47590 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393475AbfJXLDR (ORCPT ); Thu, 24 Oct 2019 07:03:17 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8926C8E6; Thu, 24 Oct 2019 04:03:01 -0700 (PDT) Received: from entos-d05.shanghai.arm.com (entos-d05.shanghai.arm.com [10.169.40.35]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6B6363F71A; Thu, 24 Oct 2019 04:02:56 -0700 (PDT) From: Jianyong Wu To: netdev@vger.kernel.org, yangbo.lu@nxp.com, john.stultz@linaro.org, tglx@linutronix.de, pbonzini@redhat.com, sean.j.christopherson@intel.com, maz@kernel.org, richardcochran@gmail.com, Mark.Rutland@arm.com, will@kernel.org, suzuki.poulose@arm.com Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Steve.Capper@arm.com, Kaly.Xin@arm.com, justin.he@arm.com, jianyong.wu@arm.com, nd@arm.com Subject: [RFC PATCH v6 7/7] kvm: arm64: Add capability check extension for ptp_kvm Date: Thu, 24 Oct 2019 19:02:09 +0800 Message-Id: <20191024110209.21328-8-jianyong.wu@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191024110209.21328-1-jianyong.wu@arm.com> References: <20191024110209.21328-1-jianyong.wu@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let userspace check if there is kvm ptp service in host. before VMs migrate to a another host, VMM may check if this cap is available to determine the migration behaviour. Signed-off-by: Jianyong Wu Suggested-by: Marc Zyngier --- drivers/clocksource/arm_arch_timer.c | 4 ++-- drivers/ptp/ptp_kvm_arm64.c | 1 - include/uapi/linux/kvm.h | 1 + virt/kvm/arm/arm.c | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index fe0ed8acfa33..0ae673193bee 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -1639,7 +1639,7 @@ TIMER_ACPI_DECLARE(arch_timer, ACPI_SIG_GTDT, arch_timer_acpi_init); #if IS_ENABLED(CONFIG_PTP_1588_CLOCK_KVM) #include -int kvm_arch_ptp_get_clock_fn(unsigned long *cycle, struct timespec64 *ts, +int kvm_arch_ptp_get_crosststamp(unsigned long *cycle, struct timespec64 *ts, struct clocksource **cs) { struct arm_smccc_res hvc_res; @@ -1656,5 +1656,5 @@ int kvm_arch_ptp_get_clock_fn(unsigned long *cycle, struct timespec64 *ts, return 0; } -EXPORT_SYMBOL_GPL(kvm_arch_ptp_get_clock_fn); +EXPORT_SYMBOL_GPL(kvm_arch_ptp_get_crosststamp); #endif diff --git a/drivers/ptp/ptp_kvm_arm64.c b/drivers/ptp/ptp_kvm_arm64.c index 7c697f20904f..f3f957117865 100644 --- a/drivers/ptp/ptp_kvm_arm64.c +++ b/drivers/ptp/ptp_kvm_arm64.c @@ -30,7 +30,6 @@ int kvm_arch_ptp_init(void) int kvm_arch_ptp_get_clock_generic(struct timespec64 *ts, struct arm_smccc_res *hvc_res) { - u64 ns; ktime_t ktime_overall; arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID, diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 2fe12b40d503..a0bff6002bd9 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -993,6 +993,7 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_ARM_SVE 170 #define KVM_CAP_ARM_PTRAUTH_ADDRESS 171 #define KVM_CAP_ARM_PTRAUTH_GENERIC 172 +#define KVM_CAP_ARM_KVM_PTP 173 #ifdef KVM_CAP_IRQ_ROUTING diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index bd5c55916d0d..80999985160b 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -201,6 +201,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) case KVM_CAP_MP_STATE: case KVM_CAP_IMMEDIATE_EXIT: case KVM_CAP_VCPU_EVENTS: + case KVM_CAP_ARM_KVM_PTP: r = 1; break; case KVM_CAP_ARM_SET_DEVICE_ADDR: -- 2.17.1