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 63D6DC88E72 for ; Thu, 17 Sep 2026 11:44:38 +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=e9qhpzkkMBbVAXFsklQI980TtIUfZrl+0QN1jIBTTMY=; b=keJpfzNdvqY7bLdL8SepcdZ+Xw G9zhPc/H2CAMn4E0yW0T2xnjZmTsDIRWz2mFKVF3DA+H/UIdg/XZ27cegBF0pSKbKzyHymErgTzWm 1ifTixJj1zpn+y54UlIcfEaZw2fAlQScDIHiESocz4bkNC4VNU5sFFzpH8AsNJZpPPIExMEDRaewx PQTVDYa41W9ezB6aQvQQMfIYXxPnrOal3loItmSZVT9R1vd/1S8mCHTQ4E2X5+s+kqZYKh8M/KlES yaeP+xRa9S1NC1GvHIpKV4pq4a7vCdKwCFTWUIGbt46wG/sfrt4rLMC4vmGn2NUJbdKPH4BCEmT+x a3QhjE2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x7AXY-0000000BDeG-0p2j; Thu, 17 Sep 2026 11:44:32 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x7AXW-0000000BDe6-2lxX for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2026 11:44:30 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id C3D03601EF; Thu, 17 Sep 2026 11:44:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78F571F000FF; Thu, 17 Sep 2026 11:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789645469; bh=e9qhpzkkMBbVAXFsklQI980TtIUfZrl+0QN1jIBTTMY=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=SJLkhzyBRQ08ZPvr206nCLCuog6/XL+QQ07i0ccbURnOVPFuSkkf7ys6hPVhOyoEd 1+HSWrqiKkPk/Jxf7ID26yYYAXFkudJlqIhf3U0hz92bhcJcRmOHjA5SwnmLMkdJJS G2zgkkkP7r4i87QxQiPnP5nM9HJ/vOx298LIOpDvMBuA8arpELZgDjNd/dlopwfChu 96Rtx5g3a2azPcdzsWzJRDqBRzQonnszEJ4N7A71lhWk65trAv2VkASUQCvVEMnqKc bYTmTDumXjMCNlUvvUhFMFOVM+qjMEe44+RqLtEjAup5u0O5vG/1cMNCi1TzVByUdh mDcH0c9N2cIJQ== 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 1x7AXT-0000000A42P-2EhZ; Thu, 17 Sep 2026 11:44:27 +0000 Date: Thu, 17 Sep 2026 12:44:26 +0100 Message-ID: <8633v85ch1.wl-maz@kernel.org> From: Marc Zyngier To: Suzuki K Poulose Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, will@kernel.org, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, steven.price@arm.com, aneesh.kumar@kernel.org, oupton@kernel.org, gshan@redhat.com, joey.gouly@arm.com, tabba@google.com, yuzenghui@huawei.com, linux-coco@lists.linux.dev, gankulkarni@os.amperecomputing.com, sdonthineni@nvidia.com, alpergun@google.com, fj0570is@fujitsu.com, WeiLin.Chang@arm.com, lpieralisi@kernel.org, enju.kohei@fujitsu.com Subject: Re: [PATCH v18 12/23] KVM: arm64: Widen the scope of "protected" VMs In-Reply-To: <20260915160141.3543048-13-suzuki.poulose@arm.com> References: <20260915160141.3543048-1-suzuki.poulose@arm.com> <20260915160141.3543048-13-suzuki.poulose@arm.com> 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: suzuki.poulose@arm.com, kvm@vger.kernel.org, kvmarm@lists.linux.dev, will@kernel.org, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, steven.price@arm.com, aneesh.kumar@kernel.org, oupton@kernel.org, gshan@redhat.com, joey.gouly@arm.com, tabba@google.com, yuzenghui@huawei.com, linux-coco@lists.linux.dev, gankulkarni@os.amperecomputing.com, sdonthineni@nvidia.com, alpergun@google.com, fj0570is@fujitsu.com, WeiLin.Chang@arm.com, lpieralisi@kernel.org, enju.kohei@fujitsu.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false 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 Tue, 15 Sep 2026 17:01:30 +0100, Suzuki K Poulose wrote: > > On arm64 we have "protected" VMs that run on PKVM as a confidential compute > guest. Given we already have the construct of "kvm_vm_is_protected" in the core > KVM code, use that for all confidential compute guests including Realms that > we are about to add. > > Use the VM flavor to detect the "protected" VMs by introducing a marker. > Add explicit helper to detect if a given VM is a "protected" VM under PKVM. > Change the existing users that precisely want to check the VM type. These > include : > - kvm_arch_prepare_memory_region - For preventing memslot changes after pVM > creation. > > All the others are retained as a wider check for confidential guest VMs. > These are: > - kvm_vm_ioctl_set_counter_offset - For disallowing timer offset configuration > - io_mem_abort for dabt handling without valid syndrome information > > Both of which are true for Realms too. > > Realms support is restricted to VHE host and thus "kvm_vm_is_protected()" > checks in the pkvm hyp specific code doesn't need to change, as the only > protected guests it deals with is "protected PKVM" guests. > > Signed-off-by: Suzuki K Poulose > --- > arch/arm64/include/asm/kvm_host.h | 4 +++- > arch/arm64/kvm/mmu.c | 2 +- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index 7ce46d853c47e..1bb43c57fb0f0 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -329,6 +329,7 @@ enum kvm_arm_vm_flavor { > VM_NVHE, > VM_VHE, > VM_PKVM, /* Normal guests on pKVM */ > + MARKER(__VM_PROTECTED), > VM_PROTECTED_PKVM, /* Protected VM */ > VM_FLAVOR_MAX, > }; > @@ -1535,7 +1536,8 @@ struct kvm *kvm_arch_alloc_vm(void); > > #define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS_RANGE > > -#define kvm_vm_is_protected(kvm) ((kvm)->arch.vm_flavor == VM_PROTECTED_PKVM) > +#define kvm_vm_is_protected(kvm) ((kvm)->arch.vm_flavor >= __VM_PROTECTED) > +#define kvm_vm_is_protected_pkvm(kvm) ((kvm)->arch.vm_flavor == VM_PROTECTED_PKVM) > #define kvm_vm_is_unprotected_pkvm(kvm) ((kvm)->arch.vm_flavor == VM_PKVM) > This really should be added from where you introduce the enumeration, as my original patch did. Otherwise, this is pure churn for no benefit. Thanks, M. -- Without deviation from the norm, progress is not possible.