From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85EC8C2D0C0 for ; Fri, 20 Dec 2019 11:43:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C95C2467F for ; Fri, 20 Dec 2019 11:43:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727381AbfLTLnz (ORCPT ); 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 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59AD8C2D0D2 for ; Fri, 20 Dec 2019 11:43:59 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id CC78D2467F for ; Fri, 20 Dec 2019 11:43:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC78D2467F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 35B944A51E; Fri, 20 Dec 2019 06:43:58 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jpyvuUQa3Gbx; Fri, 20 Dec 2019 06:43:56 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id D14464A7F1; Fri, 20 Dec 2019 06:43:56 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id F0D0D4A51E for ; Fri, 20 Dec 2019 06:43:55 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DT9V2NL2lP8w for ; Fri, 20 Dec 2019 06:43:54 -0500 (EST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 723BB4A50F for ; Fri, 20 Dec 2019 06:43:54 -0500 (EST) 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 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-Language: en-US Cc: "kvm@vger.kernel.org" , "maz@kernel.org" , "daniel.lezcano@linaro.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "linux-arm-kernel@lists.infradead.org" , Catalin Marinas , "linux@armlinux.org.uk" , "will@kernel.org" , "kvmarm@lists.cs.columbia.edu" X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu 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 > _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25D03C2D0C0 for ; Fri, 20 Dec 2019 11:44:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D7C852467F for ; Fri, 20 Dec 2019 11:44:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="O1GFTkvz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D7C852467F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XQXLcEvBDaqJEKIy0xb/LTtP3t5fv/DJQJG/twwSADY=; b=O1GFTkvz2t4WB9 zyLYM1eTC5Y1qOZ78U16fUGOlT+zMvt/NRzALymJRa5L17RfWXGQotHbykLRh0WsfDQg2ZahbtkKc fsPwVjLpvyIBFovP7zZHPamQ55IIsm/emClPuqlHkHDIn/GJdcyC8yuxGUR7vuFoHS658r/a/dlIY npkdFs+SwbvzmnxWAEap7xZ7y8OI9AoL2p0kFcE1O5p6bmgcLmSyhURT/GEpZ+x+Vt+XyDlHINPXK HJo6AXV6grv+eyuRQD4PojijpDImERsFAcuI6vjnmdf8FRv19vapQ3bcDh3wNLI7HsYzLweHfRrTj U/Ib98J1vJDLo2Qflo3w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGhM-0005dU-GF; Fri, 20 Dec 2019 11:44:00 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGhJ-0005cC-Sr for linux-arm-kernel@lists.infradead.org; Fri, 20 Dec 2019 11:43:59 +0000 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 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-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191220_034358_024296_BC668A0B X-CRM114-Status: GOOD ( 23.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , "kvm@vger.kernel.org" , Suzuki Poulose , "maz@kernel.org" , "daniel.lezcano@linaro.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , James Morse , "linux-arm-kernel@lists.infradead.org" , Catalin Marinas , "linux@armlinux.org.uk" , "will@kernel.org" , "kvmarm@lists.cs.columbia.edu" , "julien.thierry.kdev@gmail.com" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel