mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/3] KVM: arm64: nv: VNCR page in read-only and cacheable PFNMAP memory
@ 2026-11-25  2:44 Jia He
  2026-11-25  2:44 ` [PATCH v2 1/3] KVM: arm64: nv: Inject an SEA when the VNCR walk cannot set the AF Jia He
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jia He @ 2026-11-25  2:44 UTC (permalink / raw)
  To: maz, oupton
  Cc: fuad.tabba, joey.gouly, seiden, suzuki.poulose, yuzenghui,
	catalin.marinas, will, mark.rutland, pbonzini, seanjc, shuah,
	linux-arm-kernel, kvmarm, linux-kernel, kvm, linux-kselftest,
	Jia He

On a VNCR abort, KVM walks the guest hypervisor's EL2 stage-1 tables
and maps the page that VNCR_EL2 points to. This series fixes two cases
where that fails.

Patch 1 fixes a bug that predates this series. If TCR_EL2.HA is set and
the descriptor that maps VNCR_EL2 is in a read-only memslot, KVM cannot
set the AF and the walk returns -EPERM. kvm_handle_vncr_abort() has no
case for -EPERM, so the vCPU takes the same abort forever. Patch 1
injects the SEA that the walk recorded.

Patch 2 adds a selftest for this case.

Patch 3 allows the VNCR page in a cacheable VM_PFNMAP or VM_MIXEDMAP
VMA. The stage-2 fault path already maps such memory as cacheable, but
kvm_translate_vncr() rejects it and injects an SEA.

Patch 1 can be applied on its own.

Based on v7.4-rc3.

Changes since v1:
- New patches 1 and 2, for the -EPERM issue found by Sashiko.
- Patch 3: get the HVA with gfn_to_hva_memslot_prot() so that a VNCR
  page in a read-only memslot is not rejected (Sashiko).
- Patch 3: limit the stage-2 comparison in the commit message to
  VM_PFNMAP and VM_MIXEDMAP VMAs.

v1: https://lore.kernel.org/r/20261124025336.4107575-1-justin.he@arm.com

Jia He (3):
  KVM: arm64: nv: Inject an SEA when the VNCR walk cannot set the AF
  KVM: arm64: selftests: Add a test for VNCR_EL2 translation faults
  KVM: arm64: nv: Allow the L1 VNCR page in cacheable PFNMAP memory

 arch/arm64/include/asm/kvm_mmu.h              |   2 +
 arch/arm64/kvm/mmu.c                          |   2 +-
 arch/arm64/kvm/nested.c                       |  39 +++-
 tools/testing/selftests/kvm/Makefile.kvm      |   1 +
 .../selftests/kvm/arm64/nv_vncr_abort.c       | 211 ++++++++++++++++++
 5 files changed, 248 insertions(+), 7 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/arm64/nv_vncr_abort.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-25  2:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25  2:44 [PATCH v2 0/3] KVM: arm64: nv: VNCR page in read-only and cacheable PFNMAP memory Jia He
2026-11-25  2:44 ` [PATCH v2 1/3] KVM: arm64: nv: Inject an SEA when the VNCR walk cannot set the AF Jia He
2026-11-25  2:44 ` [PATCH v2 2/3] KVM: arm64: selftests: Add a test for VNCR_EL2 translation faults Jia He
2026-11-25  2:44 ` [PATCH v2 3/3] KVM: arm64: nv: Allow the L1 VNCR page in cacheable PFNMAP memory Jia He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®