From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2256C12B6C for ; Fri, 23 Aug 2024 16:53:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724431992; cv=none; b=s9DcpMQLbGFz2xDmLpL09POMsK4cw5twx9rawHPSW4KWuGQU3c4sQiGpiOSw0+T0bLjywpXZ+hbomESB5/sHSjihPD2z8Cl6kaFjgE7ld/Td0GEH6kYicxegwUyKRslm0CQ88uWUA2T1swyK41fZQcRklgodS0r+f6gOiM5Gyok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724431992; c=relaxed/simple; bh=0emxv4fRxFMZ7TaCZ+BzeNne2Cal9/6HFcmpwC/2+Uo=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=FP6wqe0b1rBceLyINMXugTwtICAZfC7/AsyCUD/WBcRZfvDIwtQSI/UM/8T5iZcbSQHyTFgFz1f3ZzEuMabu/WdRu+LjlBiyq5L+XoDoHQB4b1O+eXh5OYVttqsEc4lSi0C5dEEpUGS5dNjfA2pBZn89yBHnem+Kao2aMHj/Vzk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mvOmJwPo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mvOmJwPo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BCCAC32786; Fri, 23 Aug 2024 16:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724431991; bh=0emxv4fRxFMZ7TaCZ+BzeNne2Cal9/6HFcmpwC/2+Uo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mvOmJwPov8mjFdZ3aVkO3rjkmMroNB3coK7H3g8rQ4F7WcvfwT/1QfYUQ1kDUPN3C Q1SkfUI6X0CmsLlVj3/nJaTcQqxSdTMZmjLxTsf8do5evm1T0S48uGLQvaSJxCYHhu pGPxCpJ2IGrS+Q21Rnfz1lhn31JYKoVPNoxyYSObwli8UHSsKvyr2ST7a/cfXEM0hD IvUNFkF/hcU/G6sf239f5Cr9ekJ3QbE8SU4mwnIshH8Svi5FQUukSISDPYvhFLA36z +PbZWcisFeIn3Qz7LJQEUflvfB6tqlRCOio8mTPnQehWdjfRqdISZdDDky8+NZS9zr Ox802Y0HBTxaQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1shXXB-006L62-70; Fri, 23 Aug 2024 17:53:09 +0100 Date: Fri, 23 Aug 2024 17:53:08 +0100 Message-ID: <86wmk7w58r.wl-maz@kernel.org> From: Marc Zyngier To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, Sudeep Holla , Catalin Marinas , Lorenzo Pieralisi , Suzuki Poulose , Steven Price , Oliver Upton , linux-coco@lists.linux.dev Subject: Re: [PATCH 4/6] drivers/virt: pkvm: Hook up mem_encrypt API using pKVM hypercalls In-Reply-To: <20240823154155.GB525@willie-the-truck> References: <20240730151113.1497-1-will@kernel.org> <20240730151113.1497-5-will@kernel.org> <86a5h5yg5y.wl-maz@kernel.org> <20240823154155.GB525@willie-the-truck> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: will@kernel.org, linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com, catalin.marinas@arm.com, lpieralisi@kernel.org, suzuki.poulose@arm.com, steven.price@arm.com, oliver.upton@linux.dev, linux-coco@lists.linux.dev X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Fri, 23 Aug 2024 16:41:55 +0100, Will Deacon wrote: > > Hi Marc, > > On Wed, Aug 21, 2024 at 05:49:45PM +0100, Marc Zyngier wrote: > > On Tue, 30 Jul 2024 16:11:10 +0100, > > Will Deacon wrote: > > > > > > If we detect the presence of pKVM's SHARE and UNSHARE hypercalls, then > > > register a backend implementation of the mem_encrypt API so that things > > > like DMA buffers can be shared appropriately with the host. > > > > > > Signed-off-by: Will Deacon > > > --- > > > Documentation/virt/kvm/arm/hypercalls.rst | 50 +++++++++++++++++ > > > drivers/virt/coco/pkvm-guest/arm-pkvm-guest.c | 55 +++++++++++++++++++ > > > include/linux/arm-smccc.h | 14 +++++ > > > 3 files changed, 119 insertions(+) > > > > > > > [...] > > > > > diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h > > > index 16b6dcc54e02..9cb7c95920b0 100644 > > > --- a/include/linux/arm-smccc.h > > > +++ b/include/linux/arm-smccc.h > > > @@ -116,6 +116,8 @@ > > > #define ARM_SMCCC_KVM_FUNC_FEATURES 0 > > > #define ARM_SMCCC_KVM_FUNC_PTP 1 > > > #define ARM_SMCCC_KVM_FUNC_HYP_MEMINFO 2 > > > +#define ARM_SMCCC_KVM_FUNC_MEM_SHARE 3 > > > +#define ARM_SMCCC_KVM_FUNC_MEM_UNSHARE 4 > > > #define ARM_SMCCC_KVM_FUNC_FEATURES_2 127 > > > #define ARM_SMCCC_KVM_NUM_FUNCS 128 > > > > As you will certainly add a bunch of other calls (hopefully soon-ish), > > how about reserving an actual range for those, so that we can > > future-proof the ABI early? > > > > Grab 64 right away, and we don't have to worry about new stuff for a > > while. > > > > What do you think? > > I think that's incredibly generous. Let's see whether we really need > that to start with... > > /me dives into android15-6.6 > > So we currently allocate 3-11 there and some of those are because we > messed up v1 of a hypercall and had to introduce a new one. I don't plan > to inflict that on upstream, but avoiding conflicts would be good. > > The big thing on the horizon is a hypercall-based IOMMU interface which > looks like it will need ~10 new calls. I suppose we could multiplex some > of that, but otherwise 32 would probably do us if you don't want to give > up such a big chunk of the space immediately. Honestly, whatever number of bits you have in mind, just double it and run with it. We don't need to be precious about those, specially given that bog-standard KVM is unlikely to grow any new PV hypercall (PTP was enough of a disaster to cure me from that disease). Thanks, M. -- Without deviation from the norm, progress is not possible.