Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1677475ybz; Thu, 30 Apr 2020 03:38:56 -0700 (PDT) X-Google-Smtp-Source: APiQypLPiUaW5t7wYWD6b6/sR929XKJMwPSNYhf/9xk7vk+SOQUxIm7Vwn8m0gFK8xkvMrjVx+XE X-Received: by 2002:a17:907:214f:: with SMTP id rk15mr2056013ejb.301.1588243136330; Thu, 30 Apr 2020 03:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588243136; cv=none; d=google.com; s=arc-20160816; b=TwZCWYfKVCyVh4QqpqpjSPxLQGNiXA5lajveuXPP07YLPX1oeAHUf47HFi1TgXm0Mv rPljjRqVNG1iIurQz79vb7cGTgjUBjAW+fcAApv6f27Yb11ITuNxsDGB0If+pnWD14YV ssHXZf4D761dZjWRpzcjhD2q7JsPLi0xm1rJECl/xdImTEQ/behlU6ZtE/eHXfO5k8OZ YOo6vXzpJBz0+V4/oYP/0yL++wP2JsCvh9AMGi5/fQrINKpfAmjg5zeVPDyWa2FqAPhX j18IzHvE6Blf9+RgYlqojbo+KbJjZha9/Kvi3N4zeaoAjoBDnkKnxheTxJyqB6aBOk6E MKcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=x60r1D7w8bY0iqxi4hM+7vQLHNSF/NJFk7C/s70hBEU=; b=UlaQLtB1/hLAkUwTAQJsvCpJ/pqyJggKQpQ4a6LBbIyEJhSw7zeWIIYSyA9wBzZKzq AJK5aWbCKowN17xGh5z+s8p8PLlO6cISn7KbroHWnQgKcpbwr3p+cscGDoZHV3f02oGf p6g1iEe8bOBNB+mHHXdwzOo8Y6jdCXimTekv0qGlV2JqS45PtQA/TrkU8G+lZta7JU17 zCwsJVl9iu4itQd1rTthmOG1N8NlR2jb4SSsImtcyL9zw+mH72ssLHB57cSO0b8jOBiC dQ1z5KkQ3EZLrswpey1R1lrORTgIt6n+JVZ178CWwj5RjyEcdUabNIfadVvnkYBCwUf6 PSwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j22si5255386ejm.490.2020.04.30.03.38.33; Thu, 30 Apr 2020 03:38:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726789AbgD3Kg5 (ORCPT + 99 others); Thu, 30 Apr 2020 06:36:57 -0400 Received: from foss.arm.com ([217.140.110.172]:52242 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725280AbgD3Kg4 (ORCPT ); Thu, 30 Apr 2020 06:36:56 -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 B27C61063; Thu, 30 Apr 2020 03:36:53 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A03223F68F; Thu, 30 Apr 2020 03:36:49 -0700 (PDT) Date: Thu, 30 Apr 2020 11:36:46 +0100 From: Mark Rutland To: Jianyong Wu Cc: "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" , "will@kernel.org" , Suzuki Poulose , Steven Price , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.cs.columbia.edu" , "kvm@vger.kernel.org" , Steve Capper , Kaly Xin , Justin He , nd , Haibo Xu Subject: Re: [RFC PATCH v11 5/9] psci: Add hypercall service for ptp_kvm. Message-ID: <20200430103646.GB39784@C02TD0UTHF1T.local> References: <20200421032304.26300-1-jianyong.wu@arm.com> <20200421032304.26300-6-jianyong.wu@arm.com> <20200421095736.GB16306@C02TD0UTHF1T.local> <20200424103953.GD1167@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 28, 2020 at 07:14:52AM +0100, Jianyong Wu wrote: > On 2020/4/24 6:39 PM, Mark Rutland wrote: > > On Fri, Apr 24, 2020 at 03:50:22AM +0100, Jianyong Wu wrote: > >> On 2020/4/21 5:57 PM, Mark Rutland wrote: > >>> On Tue, Apr 21, 2020 at 11:23:00AM +0800, Jianyong Wu wrote: > >>>> diff --git a/virt/kvm/arm/hypercalls.c b/virt/kvm/arm/hypercalls.c > >>>> index 550dfa3e53cd..a5309c28d4dc 100644 > >>>> --- a/virt/kvm/arm/hypercalls.c > >>>> +++ b/virt/kvm/arm/hypercalls.c > >>>> @@ -62,6 +66,44 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu) > >>>> if (gpa != GPA_INVALID) > >>>> val = gpa; > >>>> break; > >>>> +/* > >>>> + * This serves virtual kvm_ptp. > >>>> + * Four values will be passed back. > >>>> + * reg0 stores high 32-bit host ktime; > >>>> + * reg1 stores low 32-bit host ktime; > >>>> + * reg2 stores high 32-bit difference of host cycles and cntvoff; > >>>> + * reg3 stores low 32-bit difference of host cycles and cntvoff. > >>>> + */ > >>>> +case ARM_SMCCC_HYP_KVM_PTP_FUNC_ID: > >>> Shouldn't the host opt-in to providing this to the guest, as with other > >>> features? > >> er, do you mean that "ARM_SMCCC_HV_PV_TIME_XXX" as "opt-in"? if so, I > >> think this > >> > >> kvm_ptp doesn't need a buddy. the driver in guest will call this service > >> in a definite way. > > I mean that when creating the VM, userspace should be able to choose > > whether the PTP service is provided to the guest. The host shouldn't > > always provide it as there may be cases where doing so is undesireable. > > > I think I have implemented in patch 9/9 that userspace can get the info > that if the host offers the kvm_ptp service. But for now, the host > kernel will always offer the kvm_ptp capability in the current > implementation. I think x86 follow the same behavior (see [1]). so I > have not considered when and how to disable this kvm_ptp service in > host. Do you think we should offer this opt-in? I think taht should be opt-in, yes. [...] > > It's also not clear to me what notion of host time is being exposed to > > the guest (and consequently how this would interact with time changes on > > the host, time namespaces, etc). Having some description of that would > > be very helpful. > > sorry to have not made it clear. > > Time will not change in host and only time in guest will change to sync > with host. host time is the target that time in guest want to adjust to. > guest need to get the host time then compute the different of the time > in guest and host, so the guest can adjust the time base on the difference. I understood that host time wouldn't change here, but what was not clear is which notion of host time is being exposed to the guest. e.g. is that a raw monotonic clock, or one subject to periodic adjument, or wall time in the host? What is the epoch of the host time? > I will add the base principle of time sync service in guest using > kvm_ptp in commit message. That would be great; thanks! Mark.