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 94DEEC982FA for ; Wed, 23 Sep 2026 13:26:46 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From: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=DpBDbIP8yvq+Fmf2FciZjevO7LeQexU7dyJwxxAp6co=; b=c5pW6e/yhbspBweIh3SfRy2vsp F/UwHIS8gnG3s88EehHl8vE2KxEse5zz3l1+EOZfyWaQVOSvjVDOB7MX8xlEHqN1+zwUbqeCoP9d9 5MgO1i/62bIT6p0DKaWAWidcZ7YsgLuMVOa/tx8lhnbEA5hilKFTY2fe49fWY26W7RyZSfE9rtzxM D1VmeTD1BBMZu9/l6LumPJJBeIvDsHnkSv04WOLa/P8EYUxLPjs/OKxkyeOfUwSgl/WH2xzGEB+lK /QapOsPVK5iIESp9sL2OVj5rzbbM3wAn7MnvwqmAvYcnYjlWcERwMAAKXYNy5GsbmT5mwi/5W4TKo 9+LMtsaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x9Mzf-00000008O2B-2F0x; Wed, 23 Sep 2026 13:26:39 +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 1x9Mze-00000008O1y-07ag for linux-arm-kernel@lists.infradead.org; Wed, 23 Sep 2026 13:26:38 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 37EC6600AA; Wed, 23 Sep 2026 13:26:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7690C1F000FF; Wed, 23 Sep 2026 13:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790169996; bh=DpBDbIP8yvq+Fmf2FciZjevO7LeQexU7dyJwxxAp6co=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=HcljQSRZTXKzCzv23eDmZBXttSKnJHWt75BS8zBW7Dn+gQ/EsaHyv/vAdAU1yxgF9 v7o+8DfaKQtuEMMP9qnWhtLIIYxEQNCdV2LAqJVTwpcRmwz/QHcq01BSoYaN7JVGrY 2t4NCRUHgdviRapBHeY1O+/BvNkTCH4B1mJA1wxn9UbZE1gVIq58CiLcL9g0zoQqdz 4zKMdnUQVLjYRbg77a+bFzT6NjfP58YiyVBXuNJsnaYo2mgIHmYcUakuRA7o5XRPMQ 3erdKXC5v48l2BEy0MRZu0Oj8s8W29nkdgG18lVsJmypxt+8Wh5uHb+Yp0u3aOK4X/ oBVZEWQxsAq5w== Date: Wed, 23 Sep 2026 14:26:27 +0100 From: "Lorenzo Stoakes (ARM)" To: Fuad Tabba Cc: Oliver Upton , Sean Christopherson , Catalin Marinas , Will Deacon , Marc Zyngier , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Paolo Bonzini , Jonathan Corbet , Mark Rutland , Randy Dunlap , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Jack Thomson , Jack Thomson , Alexandru Elisei , Vincent Donnefort , "Aneesh Kumar K.V" , Claudio Imbrenda , Leo Soares Passos , Wei-Lin Chang Subject: Re: [PATCH v3 01/14] KVM: Allow architectures to disallow pre-fault Message-ID: References: <20260922-kvm-arm-prefault-v3-0-787bd3bc7e3f@kernel.org> <20260922-kvm-arm-prefault-v3-1-787bd3bc7e3f@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Wed, Sep 23, 2026 at 11:54:15AM +0100, Fuad Tabba wrote: > Hi Lorenzo, > > On Tue, 22 Sep 2026 19:07:53 +0100, Oliver Upton wrote: > [...] > > I'd favor doing something like below and sticking the comment inline in > > the ioctl handler. Unless I'm missing something blatantly obvious, I > > don't see why the x86 or s390 pre-conditions can't be tested early too. > [...] > > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > [...] > > +int kvm_arch_pre_fault_allowed(struct kvm_vcpu *vcpu) > > +{ > > + if (!kvm_vcpu_initialized(vcpu)) > > + return -ENOEXEC; > > + > > + return 0; > > +} > > The same goes for arm64's pKVM check: kvm_arch_vcpu_pre_fault_memory() > returns -EOPNOTSUPP for is_protected_kvm_enabled() only after > vcpu_load(), so on a pKVM host the ioctl loads a vCPU the hypervisor > may not have created yet before rejecting it. Could that check move > into kvm_arch_pre_fault_allowed() as well? Ack yeah that sounds good, will do for v4! > > Cheers, > /fuad -- Cheers, Lorenzo