From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AD0A55409F; Tue, 22 Sep 2026 14:19:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790086765; cv=none; b=asvkhOs5w7DgiS2ZkeyYqn8hVX4jcrJWUPM0eFn9OCj41HdTc8cGnbpEhiaM+L3dU4RLLkoorzApOe4gHjSUfbm6aVEE+96eptlqgNanGXBJhZxnu1MfrhmgkCKrGD25jdF75CQxXFkZqgUiKKH25+SGTpb8T0a5X3VJvhpL/m4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790086765; c=relaxed/simple; bh=cxJF2WPLtBFrXkipzJ9c69Q3Nw2GoUpHKRJk9ftgMbs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eFO+mUM3WEs4+6wOZFQ78Em2j0UeO9XXYkJTD4U5hGs4vaarBz+JESXKOO0RSMYmvbcmRobjNXm4VaGRmDZhqTVZ06TLa93KN5HKhZNQONiGu35ZwWl+fmBleotPEgMb9FCC3V2+GANuLRch1e+DMSgkKFk+WpqKWhlny0S558Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OeXoPtnf; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OeXoPtnf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B9191F00893; Tue, 22 Sep 2026 14:19:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790086763; bh=P9CUd5omhd87YPM7u1PnYBkTZPJVmZ4tG2EXOE3TZ/U=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=OeXoPtnfNsZWcpj5V0Gv70rXU5IRkVNox8+WoQETOaGYDhirRHQn1/jU4eNk28jdy V8u8VMEkvA//outI+ZL0m0LlQ+z7IsG/eJSPYGusUVGOrWT4KFGVIjjCyoO+2HUaJd mYMZvGl6Th/xfdkiIxcMgxQO28r/HodY2l7jNq6XxHIEtVqBHGq5B4sIerGY0kifPC MRxepxXevLonmfAtZRRdY2jD8RDVW1bi2CY9geUshN82hK8MPNeQJeXSGWVekD0g2D bvQwu+uJS6HkAAoB0XgsKqM2Le97Xn8DlYj1ubiHK8Qgk3hC2OPN8YIEjQTSHVnbzP jOTR2Yt6/ZY0Q== From: "Lorenzo Stoakes (ARM)" Date: Tue, 22 Sep 2026 15:18:05 +0100 Subject: [PATCH v3 11/14] Documentation: KVM: document arm64 KVM_PRE_FAULT_MEMORY Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260922-kvm-arm-prefault-v3-11-787bd3bc7e3f@kernel.org> References: <20260922-kvm-arm-prefault-v3-0-787bd3bc7e3f@kernel.org> In-Reply-To: <20260922-kvm-arm-prefault-v3-0-787bd3bc7e3f@kernel.org> To: Catalin Marinas , Will Deacon , Marc Zyngier , Oliver Upton , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Paolo Bonzini , Jonathan Corbet , Mark Rutland , Fuad Tabba , Randy Dunlap , Fuad Tabba Cc: 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" , Sean Christopherson , Claudio Imbrenda , Leo Soares Passos , Wei-Lin Chang , "Lorenzo Stoakes (ARM)" X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3399; i=ljs@kernel.org; h=from:subject:message-id; bh=cxJF2WPLtBFrXkipzJ9c69Q3Nw2GoUpHKRJk9ftgMbs=; b=owGbwMvMwCV2fu7ZrsZH9SKMp9WSGLI29Unmva6WElh08Mjfu3fvGafaT0k82Ry3wFbYKUbj4 MT8uA03OkpZGMS4GGTFFFmefxHfHyQSNq/zgr8bzBxWJpAhDFycAjCRO28YGRa95tEqe7xExXpv hfD7qhstGotDDr5uFY0QqF25904g+wqG//6ejJGlWnNX3HBMLtNLmvuFe3KiQe3j6X/vhPzbf/7 +DCYA X-Developer-Key: i=ljs@kernel.org; a=openpgp; fpr=E7F417BF5214569E89D04F46CF9DCD8A81E27F14 Update the KVM API documentation to reflect the fact that arm64 now supports this functionality. Also document error values and arm64-specific behaviour. Signed-off-by: Lorenzo Stoakes (ARM) --- Documentation/virt/kvm/api.rst | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 1a90598901c5..71b642148b7f 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -6489,7 +6489,7 @@ See KVM_SET_USER_MEMORY_REGION2 for additional details. --------------------------- :Capability: KVM_CAP_PRE_FAULT_MEMORY -:Architectures: none +:Architectures: x86, s390, arm64 :Type: vcpu ioctl :Parameters: struct kvm_pre_fault_memory (in/out) :Returns: 0 if at least one page is processed, < 0 on error @@ -6497,12 +6497,15 @@ See KVM_SET_USER_MEMORY_REGION2 for additional details. Errors: ========== =============================================================== + EAGAIN A race occurred before progress was made, but a retry may succeed. EINVAL The specified `gpa` and `size` were invalid (e.g. not page aligned, causes an overflow, or size is zero), or the VM is UCONTROL (s390). ENOENT The specified `gpa` is outside defined memslots. + ENOEXEC The vCPU has not been initialised (arm64). EINTR An unmasked signal is pending and no page was processed. EFAULT The parameter address was invalid. + EHWPOISON A poisoned host page was encountered. EOPNOTSUPP Mapping memory for a GPA is unsupported by the hypervisor, and/or for the current vCPU state/mode. EIO unexpected error conditions (also causes a WARN) @@ -6522,7 +6525,17 @@ Errors: KVM_PRE_FAULT_MEMORY populates KVM's stage-2 page tables used to map memory for the current vCPU state. KVM maps memory as if the vCPU generated a stage-2 read page fault, e.g. faults in memory as needed, but doesn't break -CoW. On x86, KVM does not mark any newly created stage-2 PTE as Accessed. +CoW. On arm64, KVM marks newly created stage-2 PTEs as Accessed, as it +does for any stage-2 fault, but leaves the Accessed state of existing PTEs +unchanged. On x86, KVM does not mark any newly created stage-2 PTE as +Accessed, and for s390 it is not applicable. + +On arm64, a GPA is interpreted as an IPA, and never interpreted as the IPA +of a nested guest. Pre-faulting only populates canonical stage-2 page +tables. + +The feature is not supported on arm64 if the protected KVM (pKVM) feature +is enabled. In the case of confidential VM types where there is an initial set up of private guest memory before the guest is 'finalized'/measured, this ioctl @@ -6537,7 +6550,7 @@ When the ioctl returns, the input values are updated to point to the remaining range. If `size` > 0 on return, the caller can just issue the ioctl again with the same `struct kvm_map_memory` argument. -Shadow page tables cannot support this ioctl because they +On x86, shadow page tables cannot support this ioctl because they are indexed by virtual address or nested guest physical address. Calling this ioctl when the guest is using shadow page tables (for example because it is running a nested guest with nested page tables) -- 2.55.0