linux/arch/arm64/kvm
Will Deacon 19cffd16ed KVM: arm64: Invert KVM_PGTABLE_WALK_HANDLE_FAULT to fix pKVM walkers
Commit ddcadb297c ("KVM: arm64: Ignore EAGAIN for walks outside of a
fault") introduced a new walker flag ('KVM_PGTABLE_WALK_HANDLE_FAULT')
to KVM's page-table code. When set, the walk logic maintains its
previous behaviour of terminating a walk as soon as the visitor callback
returns an error. However, when the flag is clear, the walk will
continue if the visitor returns -EAGAIN and the error is then suppressed
and returned as zero to the caller.

Clearing the flag is beneficial when write-protecting a range of IPAs
with kvm_pgtable_stage2_wrprotect() but is not useful in any other
cases, either because we are operating on a single page (e.g.
kvm_pgtable_stage2_mkyoung() or kvm_phys_addr_ioremap()) or because the
early termination is desirable (e.g. when mapping pages from a fault in
user_mem_abort()).

Subsequently, commit e912efed48 ("KVM: arm64: Introduce the EL1 pKVM
MMU") hooked up pKVM's hypercall interface to the MMU code at EL1 but
failed to propagate any of the walker flags. As a result, page-table
walks at EL2 fail to set KVM_PGTABLE_WALK_HANDLE_FAULT even when the
early termination semantics are desirable on the fault handling path.

Rather than complicate the pKVM hypercall interface, invert the flag so
that the whole thing can be simplified and only pass the new flag
('KVM_PGTABLE_WALK_IGNORE_EAGAIN') from the wrprotect code.

Cc: Fuad Tabba <tabba@google.com>
Cc: Quentin Perret <qperret@google.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Oliver Upton <oupton@kernel.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Fixes: fce886a602 ("KVM: arm64: Plumb the pKVM MMU in KVM")
Signed-off-by: Will Deacon <will@kernel.org>
Reviewed-by: Quentin Perret <qperret@google.com>
Link: https://msgid.link/20260105154939.11041-2-will@kernel.org
Signed-off-by: Oliver Upton <oupton@kernel.org>
History 2026-01-10 02:19:52 -08:00
..
hyp KVM: arm64: Invert KVM_PGTABLE_WALK_HANDLE_FAULT to fix pKVM walkers 2026-01-10 02:19:52 -08:00
vgic KVM/arm64 updates for 6.19 2025-12-02 18:36:26 +01:00
.gitignore KVM: arm64: Generate hyp_constants.h for the host 2021-12-06 08:37:03 +00:00
arch_timer.c arm64 updates for 6.19: 2025-12-02 17:03:55 -08:00
arm.c KVM: arm64: gic: Check for vGICv3 when clearing TWI 2026-01-08 12:49:21 -08:00
at.c KVM: arm64: nv: Respect stage-2 write permssion when setting stage-1 AF 2026-01-09 15:40:34 -08:00
config.c KVM: arm64: nv: Use FGT write trap of MDSCR_EL1 when available 2025-10-13 14:44:37 +01:00
debug.c KVM: arm64: Guard PMSCR_EL1 initialization with SPE presence check 2025-10-13 14:26:36 +01:00
emulate-nested.c Merge branch kvm-arm64/misc-6.18 into kvmarm-master/next 2025-09-20 12:26:29 +01:00
fpsimd.c KVM: arm64: Remove kvm_arch_vcpu_run_map_fp() 2025-07-03 10:39:24 +01:00
guest.c KVM: arm64: Kill leftovers of ad-hoc timer userspace access 2025-10-13 14:42:41 +01:00
handle_exit.c KVM: arm64: Fix WFxT handling of nested virt 2025-10-13 14:42:41 +01:00
hypercalls.c arm64: kvm, smccc: Introduce and use API for getting hypervisor UUID 2025-05-23 16:30:55 +00:00
inject_fault.c KVM: arm64: Populate level on S1PTW SEA injection 2025-09-20 11:05:14 +01:00
Kconfig hyperv-next for v6.18 2025-10-07 08:40:15 -07:00
Makefile KVM: arm64: gic-v5: Probe for GICv5 2025-07-08 14:41:06 -07:00
mmio.c KVM: arm64: Don't retire MMIO instruction w/ pending (emulated) SError 2025-07-08 11:36:36 -07:00
mmu.c KVM: arm64: Invert KVM_PGTABLE_WALK_HANDLE_FAULT to fix pKVM walkers 2026-01-10 02:19:52 -08:00
nested.c ARM: 2025-12-05 17:01:20 -08:00
pauth.c KVM: arm64: nv: Work around lack of pauth support in old toolchains 2024-04-23 19:27:11 +01:00
pkvm.c KVM: arm64: Split kvm_pgtable_stage2_destroy() 2025-11-19 14:11:57 -08:00
pmu-emul.c KVM: arm64: Add RMW specific sysreg accessor 2025-06-05 14:18:01 +01:00
pmu.c KVM: arm64: Use a cpucap to determine if system supports FEAT_PMUv3 2025-03-11 12:54:23 -07:00
psci.c KVM: arm64: Add support for PSCI v1.2 and v1.3 2024-10-24 16:38:07 -07:00
ptdump.c KVM: arm64: Teach ptdump about FEAT_XNX permissions 2025-12-01 00:43:47 -08:00
pvtime.c KVM: MMU: Make the definition of 'INVALID_GPA' common 2023-01-19 21:48:38 +00:00
reset.c KVM: arm64: nv: Add pseudo-TLB backing VNCR_EL2 2025-05-19 07:59:46 +01:00
stacktrace.c arm64: kvm: Introduce nvhe stack size constants 2025-01-08 11:25:28 +00:00
sys_regs.c KVM: arm64: Inject UNDEF for a register trap without accessor 2026-01-08 12:56:17 -08:00
sys_regs.h KVM: arm64: Add timer UAPI workaround to sysreg infrastructure 2025-10-13 14:42:40 +01:00
trace.h KVM: arm64: Move virt/kvm/arm to arch/arm64 2020-05-16 15:03:59 +01:00
trace_arm.h KVM: arm64: Replace ternary flags with str_on_off() helper 2025-05-06 09:38:37 +01:00
trace_handle_exit.h arm64: kvm: trace_handle_exit: use string choices helper 2025-07-23 23:36:55 -07:00
trng.c KVM: arm64: Implement the TRNG hypervisor call 2021-01-25 22:19:31 +00:00
va_layout.c KVM: arm64: Don't blindly set set PSTATE.PAN on guest exit 2026-01-09 15:43:14 -08:00
vgic-sys-reg-v3.c KVM: arm64: Enforce the sorting of the GICv3 system register table 2025-07-26 08:36:58 -07:00
vmid.c KVM: arm64: Ensure a VMID is allocated before programming VTTBR_EL2 2025-02-20 16:29:28 +00:00