Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3087663ybl; Fri, 20 Dec 2019 03:45:04 -0800 (PST) X-Google-Smtp-Source: APXvYqyqWkuAOZgWfdFDpq4VaUetfvMaxVWlrumhexJxEtwyIp2EFoihyLv+/7gSExNKQ+dokKIF X-Received: by 2002:a9d:3a65:: with SMTP id j92mr14153462otc.37.1576842304755; Fri, 20 Dec 2019 03:45:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576842304; cv=none; d=google.com; s=arc-20160816; b=gjiOY36aELQLE1LFYJUCriLc424VnKCoI64Wk01t1oe/3y6rZBMl14eXSuEusZvgPo uwB2ySSfq6M7ZPLowyAxJ8ZheXMtVJPXaW05SiqzDsH+N6ExDErc7KIbQFfBr0NAzEzr PY/Wbx70qSIay1EyfmNkRy8CYJ6ztpM4eB6cqLVW2snGHXFBRjSdlo/cRNwjKuBYRvvz s/o9lVEa8Wtg8UZphCNYfVI618Uiie9IYDBSOTY+CJiVe3OrCLgM8StBtmVIsTGpZvkE LesypcrN35VhKCf2KlYrWtDG9iZJJ/tjGXPBzp65x06QwLeV3whtasnspvrKrInkVq7K uNuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=UrOBjicorhXExIlRN/+G5YqPnDQgcEBMYhhcom2846Q=; b=Ky+rUI6QqR2rSosNONST3XDxS2RHjlNPU4kCgP8lsNuE4j3wuvRt5Be2LgUuXgmB5t S/uuf6fZUETT9SlYwH46JKx//i8QGvoC2e/PPtxJepCp7fOHEcLEv9FlElmFdtP9nPZ+ C3UhFdFzxBYvIJSYz2EBY2ounfQYovbdm5H9kR6xKBjqyYCYVBXSTQa2sGoMd60pfkpx S3R0quBqRsOZKNTHlH8BNq/wNaMafzCIqFAWxMWq4fnzVjUzJ5DkZLmbm3CNDUYi1u/5 Ig2VnIiHAFBgKLMsaKEB+5qHJti9gKF3LzBaklOsrshRaPr0fSjENpAE0Wo9AIyjLXMk cGLQ== 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 i20si4627791otk.270.2019.12.20.03.44.53; Fri, 20 Dec 2019 03:45:04 -0800 (PST) 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 S1727351AbfLTLnz (ORCPT + 99 others); Fri, 20 Dec 2019 06:43:55 -0500 Received: from foss.arm.com ([217.140.110.172]:49772 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727177AbfLTLnz (ORCPT ); Fri, 20 Dec 2019 06:43:55 -0500 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 0555B30E; Fri, 20 Dec 2019 03:43:54 -0800 (PST) Received: from [10.1.194.52] (e112269-lin.cambridge.arm.com [10.1.194.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 228E83F719; Fri, 20 Dec 2019 03:43:52 -0800 (PST) Subject: Re: [PATCH 1/5] KVM: arm64: Document PV-lock interface To: yezengruan Cc: Mark Rutland , "daniel.lezcano@linaro.org" , "kvm@vger.kernel.org" , "linux-doc@vger.kernel.org" , "maz@kernel.org" , Suzuki Poulose , "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , James Morse , "julien.thierry.kdev@gmail.com" , Catalin Marinas , "linux@armlinux.org.uk" , "will@kernel.org" , "kvmarm@lists.cs.columbia.edu" , "linux-arm-kernel@lists.infradead.org" References: <20191217135549.3240-1-yezengruan@huawei.com> <20191217135549.3240-2-yezengruan@huawei.com> <20191217142138.GA38811@arm.com> <49120a3c-405d-d2e3-2a88-ba590feccbcc@huawei.com> From: Steven Price Message-ID: Date: Fri, 20 Dec 2019 11:43:50 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <49120a3c-405d-d2e3-2a88-ba590feccbcc@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/12/2019 11:45, yezengruan wrote: > Hi Steve, > > On 2019/12/17 22:21, Steven Price wrote: >> On Tue, Dec 17, 2019 at 01:55:45PM +0000, yezengruan@huawei.com wrote: >>> From: Zengruan Ye >>> >>> Introduce a paravirtualization interface for KVM/arm64 to obtain the vcpu >>> is currently running or not. >>> >>> A hypercall interface is provided for the guest to interrogate the >>> hypervisor's support for this interface and the location of the shared >>> memory structures. >>> >>> Signed-off-by: Zengruan Ye >>> --- >>> Documentation/virt/kvm/arm/pvlock.rst | 31 +++++++++++++++++++++++++++ >>> 1 file changed, 31 insertions(+) >>> create mode 100644 Documentation/virt/kvm/arm/pvlock.rst >>> >>> diff --git a/Documentation/virt/kvm/arm/pvlock.rst b/Documentation/virt/kvm/arm/pvlock.rst >>> new file mode 100644 >>> index 000000000000..eec0c36edf17 >>> --- /dev/null >>> +++ b/Documentation/virt/kvm/arm/pvlock.rst >>> @@ -0,0 +1,31 @@ >>> +.. SPDX-License-Identifier: GPL-2.0 >>> + >>> +Paravirtualized lock support for arm64 >>> +====================================== >>> + >>> +KVM/arm64 provids some hypervisor service calls to support a paravirtualized >>> +guest obtaining the vcpu is currently running or not. >>> + >>> +Two new SMCCC compatible hypercalls are defined: >>> + >>> +* PV_LOCK_FEATURES: 0xC5000040 >>> +* PV_LOCK_PREEMPTED: 0xC5000041 >> >> These values are in the "Standard Hypervisor Service Calls" section of >> SMCCC - so is there a document that describes this features such that >> other OSes or hypervisors can implement it? I'm also not entirely sure >> of the process of ensuring that the IDs picked are non-conflicting. >> >> Otherwise if this is a KVM specific interface this should probably >> belong within the "Vendor Specific Hypervisor Service Calls" section >> along with some probing that the hypervisor is actually KVM. Although I >> don't see anything KVM specific. > > Thanks for pointing it out to me! Actually, I also don't see any documents > or KVM specific that describes this features. The values in the "Vendor > Specific Hypervisor Service Calls" section may be more appropriate, such as > the following > > * PV_LOCK_FEATURES: 0xC6000020 > * PV_LOCK_PREEMPTED: 0xC6000021 > > Please let me know if you have any suggestions. I don't have strong feelings on whether this should be KVM-specific or generic. I'm not familiar with whether there are competing solutions to this problem - it's obviously ideal if all hypervisors can make use of the same interface if possible, but maybe that ship has sailed already? However if this going to be KVM-specific then you'll need to add the probing logic for checking whether the hypervisor is KVM or not. Will has a couple of patches on a branch which do this [1] and [2]. Then you can use kvm_arm_hyp_services_available() as the first step to probe whether the hypervisor is KVM. [1] https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/commit/?h=kvm/hvc&id=464f5a1741e5959c3e4d2be1966ae0093b4dce06 [2] https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/commit/?h=kvm/hvc&id=6597490e005d0eeca8ed8c1c1d7b4318ee014681 Steve >> >>> + >>> +The existence of the PV_LOCK hypercall should be probed using the SMCCC 1.1 >>> +ARCH_FEATURES mechanism before calling it. >>> + >>> +PV_LOCK_FEATURES >>> + ============= ======== ========== >>> + Function ID: (uint32) 0xC5000040 >>> + PV_call_id: (uint32) The function to query for support. >>> + Return value: (int64) NOT_SUPPORTED (-1) or SUCCESS (0) if the relevant >>> + PV-lock feature is supported by the hypervisor. >>> + ============= ======== ========== >>> + >>> +PV_LOCK_PREEMPTED >>> + ============= ======== ========== >>> + Function ID: (uint32) 0xC5000041 >>> + Return value: (int64) NOT_SUPPORTED (-1) or SUCCESS (0) if the IPA of >>> + this vcpu's pv data structure is configured by >>> + the hypervisor. >>> + ============= ======== ========== >> >> >From the code it looks like there's another argument for this SMC - the >> physical address (or IPA) of a struct pvlock_vcpu_state. This structure >> also needs to be described as it is part of the ABI. > > Will update. > >> >> Steve >> >> . >> > > Thanks, > > Zengruan > > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >