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 77A13D4660A for ; Thu, 15 Jan 2026 18:03:59 +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=QL/FA85K8sSYHfJRl3fg2QgT24vQ3vJqCT+7fJqpI7w=; b=wKF9Mt7lIHmz57mVHgtQEb3F6K DbUnWJ7WI+gJ0ARKm21xJ8KE7QRfeKlaRX/qcf0iz9wUL7C5S8/yeXrGBZYPfnrGH7z/gbVIkhT74 LwVAJLfb6gLsppgcwQgIdb8wDC217BmezntkwHnLHaUNPWbM4V53huFftguep2/8lHbCTiL0gVYPT GPlLe66MMpBHx3N7fyKs2tSNXqlfUAu+1fqoM88OyuBN0YOac8Cn+Cs/Lgwx3hpoLNH+Ws90GkfC9 vkLzY2W5pJLdGO9uiifrLMMCfsQK4+ofndVVmyFr09W4QXLuOpTKI3yQVIeXpW+Tt7cA3VU8OWthy 8wITQIAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vgRhD-0000000CvdJ-23LX; Thu, 15 Jan 2026 18:03:47 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vgRh1-0000000CvcN-05zm for linux-arm-kernel@lists.infradead.org; Thu, 15 Jan 2026 18:03:45 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 71DB0601BC; Thu, 15 Jan 2026 18:03:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23B77C16AAE; Thu, 15 Jan 2026 18:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768500214; bh=jsOCVRbDYK9JC0QzEE3fZQhFzKNeuG1HxlOeYltavZU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TpvAZTz0D6AvekolmeASjyDdjp3fxMuAvqjOFCgZ2Pbq117gVPwnk9tG9Cl007zaO ey/tbk145Xi7BzZ3Zl6G2nkvzkAlhPhfyL/fFjAS2RwEkh+7SLvZjODzKE+Bl2kl80 KnE2+KEtwVQ0wFOeDHdA1lhBxV6uzT/549OnIsybPFLnS8bcbOLxGJGWPiWkhuumq4 KGPKrZ/7vNVh/bZbiJX2GZa7U2uU8oEexKsJRMm0/IWrukPaiwxgtEHRLpw2An0gCu u/nUn5pw9oTfjBPsbKaZUDlveyxUXyXU48/d2aj7gZq2Bmp1Q2xSI2fIJ29j8KebuS d6LpHGl4DEFow== 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 1vgRgx-00000002cUt-3lXd; Thu, 15 Jan 2026 18:03:32 +0000 Date: Thu, 15 Jan 2026 18:03:27 +0000 Message-ID: <86bjiuda8g.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, oliver.upton@linux.dev, will@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, vladimir.murzin@arm.com Subject: Re: [PATCH v6 8/9] KVM: arm64: Check whether a VM IOCTL is allowed in pKVM In-Reply-To: References: <20251211104710.151771-1-tabba@google.com> <20251211104710.151771-9-tabba@google.com> <86h5smlxyo.wl-maz@kernel.org> <86fr86lv3d.wl-maz@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: tabba@google.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, oliver.upton@linux.dev, will@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, vladimir.murzin@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-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, 15 Jan 2026 16:14:39 +0000, Fuad Tabba wrote: > > On Thu, 15 Jan 2026 at 16:05, Marc Zyngier wrote: > > > > On Thu, 15 Jan 2026 15:19:48 +0000, > > Fuad Tabba wrote: > > > > > > Hi Marc, > > > > > > On Thu, 15 Jan 2026 at 15:03, Marc Zyngier wrote: > > > > > > > > On Thu, 11 Dec 2025 10:47:08 +0000, > > > > Fuad Tabba wrote: > > > > > > > > > > Certain VM IOCTLs are tied to specific VM features. Since pKVM does not > > > > > support all features, restrict which IOCTLs are allowed depending on > > > > > whether the associated feature is supported. > > > > > > > > > > Use the existing VM capability check as the source of truth to whether > > > > > an IOCTL is allowed for a particular VM by mapping the IOCTLs with their > > > > > associated capabilities. > > > > > > > > > > Suggested-by: Oliver Upton > > > > > Signed-off-by: Fuad Tabba > > > > > --- > > > > > arch/arm64/include/asm/kvm_pkvm.h | 21 +++++++++++++++++++++ > > > > > arch/arm64/kvm/arm.c | 3 +++ > > > > > 2 files changed, 24 insertions(+) > > > > > > > > > > diff --git a/arch/arm64/include/asm/kvm_pkvm.h b/arch/arm64/include/asm/kvm_pkvm.h > > > > > index 5b564576160d..0fa8c84816fd 100644 > > > > > --- a/arch/arm64/include/asm/kvm_pkvm.h > > > > > +++ b/arch/arm64/include/asm/kvm_pkvm.h > > > > > @@ -9,6 +9,7 @@ > > > > > #include > > > > > #include > > > > > #include > > > > > +#include > > > > > #include > > > > > > > > > > /* Maximum number of VMs that can co-exist under pKVM. */ > > > > > @@ -43,6 +44,7 @@ static inline bool kvm_pkvm_ext_allowed(struct kvm *kvm, long ext) > > > > > case KVM_CAP_ARM_SVE: > > > > > case KVM_CAP_ARM_PTRAUTH_ADDRESS: > > > > > case KVM_CAP_ARM_PTRAUTH_GENERIC: > > > > > + case KVM_CAP_ARM_BASIC: > > > > > > > > Can we instead rely on an existing VM capability? I'm not overly keen > > > > exposing something new to userspace (KVM_CAP_ARM_BASIC) for something > > > > that really is KVM's own internal problems. > > > > > > > > Looking at the history, a bunch of things have always been present: > > > > KVM_CAP_NR_VCPUS, for example. You could even #define > > > > KVM_CAP_ARM_BASIC to that if you want. > > > > > > I wasn't too crazy about that either. I like the idea of defining it > > > as an alias of KVM_CAP_NR_VCPUS. I'll do that when I respin. > > > > I've done something [1]. If that works for you, let me know and I'll > > just merge that. > > That works for the previous patch (7/9), which is where you've made > the change. But since the alias is defined in `arm.c` it wouldn't work > in this patch (8/9), because the function kvm_pkvm_ext_allowed() is > defined in `asm/kvm_pkvm.h`. I dropped it from patch 8/9 for the reason below. > Defining the alias in `asm/kvm_pkvm.h` > or in `asm/kvm_host.h` should solve this, since both files are visible > in arm.c (and in kvm_pkvm.h in both cases). Nope. The compiler spots that this is the same value twice in the switch, and compile fails. I only kept it as syntactic sugar in arm.c, but I could otherwise drop it entirely. Thanks, M. -- Without deviation from the norm, progress is not possible.