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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8EC3EC433EF for ; Wed, 20 Jul 2022 18:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rwZOOJEE54xIm00Nl6CeqaEDnI9y4S1ypE+RX/t1hdk=; b=ioVldppPxqOaFy 1p4Qjn7qp566wz3DXUWFws7tXDZPwFwDYvTNKxAiSv19thbjCeoQu/tD0ao3cIt4letdf6Ebp//fe qxDYWfUmmpO1rSrh+AzyzkqVoHGnLQn0ua7IbWHL2BME5gQuNgDjE7bCKEgjsQjyM/PEZYwOjw+WC Om+u/9WxeK/TdM0vFQBFNIAVhEU98YK6CirGml2oOyXuUaptPuJmQkubpJXAC3S2mlAnOcdaWTD9m uoV+SVNbpyZ2w33qbRiL5pBGzY3TbahmNRggyyuzfR3Xby9MjzimeER4T0MVEGQbXtI/m0sqnBdbk qHyC3RLkUstMdMYPm1KQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEEDE-0097ex-QU; Wed, 20 Jul 2022 18:14:20 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEEDB-0097e1-C3 for linux-arm-kernel@lists.infradead.org; Wed, 20 Jul 2022 18:14:18 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C2503B8217E; Wed, 20 Jul 2022 18:14:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC421C3411E; Wed, 20 Jul 2022 18:14:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658340854; bh=Zy3j8P3splX48YJkjCqikBQJuhtL387mwjUOqWwhZyg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=f1bSc0Yj3ibRsagQc+g6SlYtxYklYtOgYuELU4/xH6eumhIXFB0mvrGzjq7Cq2/rx 1L+jEMH8/N2dpUzOYhcT6ku+7sO7tjKA+JPJXSBFXDeSA2yZFC6QwIbS7zo3GYVAli X+jZ3ubhnXd/DVyN5CD4O+BCW+nIOcvoL7qy9OAZFm79QI9eNd6pX1vbdxD2cA/OSD rNMfyoqxx9j+72gIYM95fnrXCTYoTdrlP8UFHxmN70WwsgreKeJW6Ae32G+hX+rraQ hqOBKq+TCkoU+034Kv4E36/ZCl+EgW2RUjseeClMBew0i29/Id0e7HycMOhUA6upY6 Q3tXZDv1WY/oA== Date: Wed, 20 Jul 2022 19:14:07 +0100 From: Will Deacon To: Oliver Upton Cc: kvmarm@lists.cs.columbia.edu, Ard Biesheuvel , Sean Christopherson , Alexandru Elisei , Andy Lutomirski , Catalin Marinas , James Morse , Chao Peng , Quentin Perret , Suzuki K Poulose , Michael Roth , Mark Rutland , Fuad Tabba , Marc Zyngier , kernel-team@android.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 06/24] KVM: arm64: Unify identifiers used to distinguish host and hypervisor Message-ID: <20220720181406.GA16603@willie-the-truck> References: <20220630135747.26983-1-will@kernel.org> <20220630135747.26983-7-will@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220720_111417_711386_83C5A1AB X-CRM114-Status: GOOD ( 26.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Oliver, Thanks for having a look. On Wed, Jul 20, 2022 at 03:11:04PM +0000, Oliver Upton wrote: > On Thu, Jun 30, 2022 at 02:57:29PM +0100, Will Deacon wrote: > > The 'pkvm_component_id' enum type provides constants to refer to the > > host and the hypervisor, yet this information is duplicated by the > > 'pkvm_hyp_id' constant. > > > > Remove the definition of 'pkvm_hyp_id' and move the 'pkvm_component_id' > > type definition to 'mem_protect.h' so that it can be used outside of > > the memory protection code. > > > > Signed-off-by: Will Deacon > > --- > > arch/arm64/kvm/hyp/include/nvhe/mem_protect.h | 6 +++++- > > arch/arm64/kvm/hyp/nvhe/mem_protect.c | 8 -------- > > arch/arm64/kvm/hyp/nvhe/setup.c | 2 +- > > 3 files changed, 6 insertions(+), 10 deletions(-) > > > > diff --git a/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h b/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h > > index 80e99836eac7..f5705a1e972f 100644 > > --- a/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h > > +++ b/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h > > @@ -51,7 +51,11 @@ struct host_kvm { > > }; > > extern struct host_kvm host_kvm; > > > > -extern const u8 pkvm_hyp_id; > > +/* This corresponds to page-table locking order */ > > +enum pkvm_component_id { > > + PKVM_ID_HOST, > > + PKVM_ID_HYP, > > +}; > > Since we have the concept of PTE ownership in pgtable.c, WDYT about > moving the owner ID enumeration there? KVM_MAX_OWNER_ID should be > incorporated in the enum too. Interesting idea... I think we need the definition in a header file so that it can be used by mem_protect.c, so I'm not entirely sure where you'd like to see it moved. The main worry I have is that if we ever need to distinguish e.g. one guest instance from another, which is likely needed for sharing of memory between more than just two components, then the pgtable code really cares about the number of instances ("which guest is it?") whilst the mem_protect cares about the component type ("is it a guest?"). Finally, the pgtable code is also used outside of pKVM so, although the concept of ownership doesn't yet apply elsewhere, keeping the concept available without dictacting the different types of owners makes sense to me. Does that make sense? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel