From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 781A7606A32C for ; Fri, 4 Dec 2026 16:27:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ppP3fTzI; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=WVMDpbK2 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-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=DjXJ3/qEEERMPMMoHNamA/MlHqd/eYLRLyVdZEI0CEw=; b=ppP3fTzIhTodH6 ntDBsrpt+bwyqORf3rWdDUs1qPMqhVnii4L19VNfq2uInwjjnuRX8GHeZxdm/0Id8gd0BQGnShYxo NLsuHypX1XlUvQ755NagdamuV9oT/Gh42qT/j75xlndJYorne/ba/wxcMmnPo2d6Yme+7HslBsbm+ eW+G1GCMnZnlBnTBKrhRUCujE5Ijq2dqfPK51gV0nUrIv91cAJ6rn6X4J/bdhyVzzc5qOvugBnyww IT3rMbsl2f9GM6bzFsNhrxcH1ig9+ovb3J4IaWR9A9mzPVWfa1d9pFANA6EU2nSC2Fayn0+pTbebi kP9nj14cclT/svdHukRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZW89-00000000vO4-3tqL; Fri, 04 Dec 2026 16:27:31 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZW7u-00000000vLg-2R8y for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2026 16:27:17 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C910614BF; Fri, 4 Dec 2026 08:27:09 -0800 (PST) Received: from [10.0.128.193] (e122027.cambridge.arm.com [10.0.128.193]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D6E443F632; Fri, 4 Dec 2026 08:27:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796401632; bh=2WIAmtMGnudIuR7/aICmZbndOp5ZCdtE1ltOF8aHMfk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=WVMDpbK2xFjfSth6Mg0/vnD7d+YmrimlD0FpBgsWoGcja0qYcdawsnPzNAednNHU2 bRHEL192qS4aeYfW1mz1qMyRUQ3UMNaGibEwy0MirpJ+skyi5xGR6azYUXv/nyw83q KJcRxVvoVUXGEtU/YxOpvedYJ7zKTKE2gQHO/X/Q= Message-ID: <43120ed4-55de-459d-b860-7e57ac0c3fd5@arm.com> Date: Fri, 4 Dec 2026 16:27:04 +0000 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 10/11] KVM: arm64: CCA: Support runtime faulting of memory To: Kohei Enju Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Gavin Shan , Shanker Donthineni , Alper Gun , "Aneesh Kumar K . V" , Emi Kisanuki , Vishal Annapurve , WeiLin.Chang@arm.com, Lorenzo Pieralisi References: <20261204115725.45272-1-steven.price@arm.com> <20261204115725.45272-11-steven.price@arm.com> From: Steven Price Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261204_082716_420701_35511E2A X-CRM114-Status: GOOD ( 27.02 ) X-Spam-Score: -4.4 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-7.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 04/12/2026 15:32, Kohei Enju wrote: > On 12/04 11:57, Steven Price wrote: >> At runtime, if the realm guest accesses an IPA without a stage-2 >> mapping, then KVM fixes up the stage-2 mapping for the backing memory. >> >> For memory in the lower (protected) region of IPA, verify that the >> corresponding guest_memfd page is private before delegating to the RMM. >> The RMM then maps the delegated page into the Realm. >> >> For memory in the upper (shared) IPA region, map the backing page as >> non-secure memory. Check that a guest_memfd page is shared when the >> fault uses guest_memfd; ordinary userspace-backed memslots can only be >> mapped at unprotected IPAs and follow the normal user memory fault path. >> >> If the fault IPA and guest_memfd attributes disagree then exit to >> userspace with KVM_EXIT_MEMORY_FAULT so the VMM can perform the required >> conversion. If a shared IPA has no memslot, KVM follows the existing >> MMIO or abort-injection path. The latter can result in injecting a SEA >> to the guest. >> >> Realm faults may need to create RTTs, including when updating a >> mapping after a permission fault. Take the write side of mmu_lock >> and top up the MMU cache for these faults. Do not pre-fault Realm >> memory. > > Hello Steve, > > Not a review comment, but just a question for clarification. > > My understanding is that this series and the following ones aim to > provide basic CCA/KVM functionality, leaving out optional features for > the initial upstream support. > > I've been looking into supporting pre-faulting for CCA/KVM in the > future, and I'm not aware of any architectural blockers. > > Are you aware of any potential blockers or limitations that might > prevent us from supporting pre-faulting in the future, or is it simply > being left out for now as an *optional* feature, as I assume? (I assume you mean stage-2 pre-faulting - i.e. populating the guest's IPA-to-PA translations with KVM_PRE_FAULT_MEMORY, pre-faulting the guest_memfd itself isn't specific to CCA.) There's nothing architectural preventing pre-faulting. The host is free to proactively map the protected memory into the guest before the first fault. My reasons for leaving it out now are: * It's obviously an "optional" feature - and I'm trying to focus on getting enough support to boot a guest before looking at more features. * As a feature it could hide bugs - faulting is the more complex path, so I've wanted to focus testing on that path rather than the pre-fault path which is naturally less racy. * It's a performance feature and I'm currently doing most of my testing on a model. So I've no way of meaningfully telling whether it's actually useful in reality. Although my suspicion is that it could turn out to be important. Note that KVM_PRE_FAULT_MEMORY is a VCPU ioctl, but the RMI API executes it on the realm descriptor - so I'm not sure how much benefit there would be to running multiple in parallel. My assumption is that KVM_PRE_FAULT_MEMORY would be treated as a "first VCPU run" and would trigger the realm setup (kvm_activate_realm()), but that's certainly an area of uAPI that needs nailing down. Let me know if you do come up with an implementation - hopefully it won't be too long before we move on past the basic functionality. Thanks, Steve