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 59718108B91B for ; Fri, 20 Mar 2026 12:38:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hi0mA+HGeXq3cy1bE1/QSc//1G5W/HPFmreiN3opnmc=; b=F6boZnNxVJxHIaq6kzfHBt9KQb qQmA6sIWeUN/3sjb/Kh12q3TYMXMer5D3oxyzdnkG89kS7PJs04TTNlT24X3S6/iJBfqildYDCaQL nfzqwnS7348eADxxBb+IhN43VIX80COMKX3XTJ4x8JXDa4Ulejec5GXff9aIWY9xSBsVPcFGzmPjU L0watGTViuedhNbNEQyGvklZ5FITQKMElRINXQ0pR+sVpdytjVCDxFobZqWkw+irb8ACwMmmFe7Kh EJwkvNGqrK/RISF5OIt7uEca32t0Wv1trc5iFeVGk0B2hk/mT+rfEPNy1rO/LioE5wka+jc4JElDv 1nGrdALQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1w3Z7K-0000000CnWn-42ox; Fri, 20 Mar 2026 12:38:18 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1w3Z7K-0000000CnWc-0iWt for linux-arm-kernel@bombadil.infradead.org; Fri, 20 Mar 2026 12:38:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=hi0mA+HGeXq3cy1bE1/QSc//1G5W/HPFmreiN3opnmc=; b=czABLbN5Z9g3YWKuj+vVoAy4Ok W/b9XIi400A3wJiX2G0+nezMvR9HnURbHCWV2RFUp+v8uGUqHR0rYD4M2+nBfTGQNKpj2NS/Ofx0g owUfcMweHZCaETC30wfRVO+1xqqCMeTktsZ22dKdPdz9s9z24TvY0DOP6MthmGAowBrRKuC9nc7bm SRBTq8XJ/I59HmJ3OuyCjr6xEAW72KxUi9yXdjbyWtTdq3Dm46USvAH6QvFcn3vFpuS/21cpdr+hH PlwOu6x8Vz/ghsG6FOY6xIU/0YsIxfQuwyQrSzMU9Lh6+CPJdkgl3KUMRXhkFVwsuH633g4DwXAfE Kn0Lbipw==; Received: from sea.source.kernel.org ([172.234.252.31]) by desiato.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1w3Z7G-0000000FXY2-3iqV for linux-arm-kernel@lists.infradead.org; Fri, 20 Mar 2026 12:38:16 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id BC4BF44477; Fri, 20 Mar 2026 12:38:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F4B4C4CEF7; Fri, 20 Mar 2026 12:38:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774010290; bh=XhWi8VwgsfjjRoCMiPUJUQrZvTCDyjHFM7V9NE2mOAE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gGYp3YkqT9C4A8gq+qoKdAp5ixgpz8FkIXi+Lt8mxoCqhR3BTxO48vCsMGiwkzTFC 2teTyIKIHYC8zd2ZKHSurN6WEaWED5IPGIowV+mmxlxI3VJUjKzNBe7ZFw6na0G7qX 1ZtJYmQ3bcogbrVfAUmy7xI+osUMru930dMtKMcFPB2CHIHXfCaKwqxWRq9cqdcMKx Jr3nL+xzul2CgabW3ZqfG8CTPpDS6ftSrDRwGPoCZX4/ANIt+EWdGVS4WtcqpvVvAe 3rOF/A0uHonQfkyUXzC2OXSxaJU1Mjdwa1QHDH/5s4Z8ja2uBVzeLWiIvBbAuiPluw T0j/sllAsF0Hg== 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.98.2) (envelope-from ) id 1w3Z7A-000000040pr-1FCf; Fri, 20 Mar 2026 12:38:08 +0000 Date: Fri, 20 Mar 2026 12:38:07 +0000 Message-ID: <867br665hs.wl-maz@kernel.org> From: Marc Zyngier To: Will Deacon Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Oliver Upton , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Quentin Perret , Fuad Tabba , Vincent Donnefort , Mostafa Saleh , Alexandru Elisei Subject: Re: [PATCH v3 11/36] KVM: arm64: Introduce __pkvm_host_donate_guest() In-Reply-To: <20260305144351.17071-12-will@kernel.org> References: <20260305144351.17071-1-will@kernel.org> <20260305144351.17071-12-will@kernel.org> 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/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) 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, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, oupton@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, qperret@google.com, tabba@google.com, vdonnefort@google.com, smostafa@google.com, alexandru.elisei@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260320_123815_360400_3C9CE697 X-CRM114-Status: GOOD ( 21.47 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 05 Mar 2026 14:43:24 +0000, Will Deacon wrote: > > In preparation for supporting protected VMs, whose memory pages are > isolated from the host, introduce a new pKVM hypercall to allow the > donation of pages to a guest. > > Signed-off-by: Will Deacon > --- > arch/arm64/include/asm/kvm_asm.h | 1 + > arch/arm64/include/asm/kvm_pgtable.h | 2 +- > arch/arm64/kvm/hyp/include/nvhe/mem_protect.h | 2 ++ > arch/arm64/kvm/hyp/nvhe/hyp-main.c | 21 +++++++++++++ > arch/arm64/kvm/hyp/nvhe/mem_protect.c | 30 +++++++++++++++++++ > 5 files changed, 55 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h > index df6b661701b6..dfc6625c8269 100644 > --- a/arch/arm64/include/asm/kvm_asm.h > +++ b/arch/arm64/include/asm/kvm_asm.h > @@ -79,6 +79,7 @@ enum __kvm_host_smccc_func { > /* Hypercalls that are available only when pKVM has finalised. */ > __KVM_HOST_SMCCC_FUNC___pkvm_host_share_hyp, > __KVM_HOST_SMCCC_FUNC___pkvm_host_unshare_hyp, > + __KVM_HOST_SMCCC_FUNC___pkvm_host_donate_guest, > __KVM_HOST_SMCCC_FUNC___pkvm_host_share_guest, > __KVM_HOST_SMCCC_FUNC___pkvm_host_unshare_guest, > __KVM_HOST_SMCCC_FUNC___pkvm_host_relax_perms_guest, > diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h > index c201168f2857..b6f7595c4979 100644 > --- a/arch/arm64/include/asm/kvm_pgtable.h > +++ b/arch/arm64/include/asm/kvm_pgtable.h > @@ -100,7 +100,7 @@ typedef u64 kvm_pte_t; > KVM_PTE_LEAF_ATTR_HI_S2_XN) > > #define KVM_INVALID_PTE_OWNER_MASK GENMASK(9, 2) > -#define KVM_MAX_OWNER_ID 1 > +#define KVM_MAX_OWNER_ID 3 > > /* > * Used to indicate a pte for which a 'break-before-make' sequence is in > diff --git a/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h b/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h > index 5f9d56754e39..9c0cc53d1dc9 100644 > --- a/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h > +++ b/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h > @@ -28,6 +28,7 @@ enum pkvm_component_id { > PKVM_ID_HOST, > PKVM_ID_HYP, > PKVM_ID_FFA, > + PKVM_ID_GUEST, Is KVM_MAX_OWNER_ID being set to 3 related to PKVM_ID_GUEST being introduced? If so, wouldn't it be better to define one in terms of the other? Also, this includes PKVM_ID_FFA as a valid ID, while it wasn't included until now. Is that expected? Thanks, M. -- Without deviation from the norm, progress is not possible.