All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/28] KVM: arm64: nv: Implement FEAT_HAFDBS, FEAT_HAFT
@ 2026-10-23 20:55 Oliver Upton
  2026-10-23 20:55 ` [PATCH v2 01/28] KVM: arm64: nv: Introduce struct for stage-2 walk step Oliver Upton
                   ` (27 more replies)
  0 siblings, 28 replies; 35+ messages in thread
From: Oliver Upton @ 2026-10-23 20:55 UTC (permalink / raw)
  To: kvmarm
  Cc: Marc Zyngier, Joey Gouly, Suzuki K Poulose, Zenghui Yu,
	Wei-Lin Chang, Steffen Eiden, Fuad Tabba, Leonardo Bras,
	Oliver Upton

Here's v2 of the series adding dirty state and table access flags to
KVM's table walkers.

I spent quite a lot of time twiddling with CMO emulation to work around
the architecture. But I eventually got pissed at the whole problem and
tore it up. Ultimately, we shouldn't have to handle every ridiculous
hardware permutation in KVM; assuming FEAT_S2FWB is present on a system
with FEAT_NV2 is not a stretch of the imagination.

So I ran with that and decided to just NOP the CMOs when everything is
observable in the VM at the PoC, including instruction fetches and DMA.

Ultimately, the use of noncoherent DMA with forced writeback is
braindead. On top of that, noncoherent DMA isn't worth caring about in
future development of KVM when disabling FWB outright is a perfectly
viable alternative. Patches #19 and #20 enforce this and provide the
necessary escape valve.

v1 -> v2:
 - Limit FEAT_HAFDBS to VMs that are known to be fully coherent
 - Abuse the above dependency to treat CMOs as NOPs that use a
   writable-clean alias to cacheable memory
 - Pick up a fix for programming TCR_EL2.HA when vEL2 is in the EL2
   translation regime
 - Add command line switch for disabling FEAT_S2FWB, aliased in such a
   way that we can select the 'bypass' memory attributes when S2FWB page
   table formats become mandatory
 - Tracepoints for the MMU walk steps at stage-1 and stage-2
 - Address feedback from Leo, Wei-Lin and Sashiko
 - Collect tags
 - Plenty more I'm forgetting.

Oliver Upton (28):
  KVM: arm64: nv: Introduce struct for stage-2 walk step
  KVM: arm64: nv: Consolidate computation of stage-2 permissions
  KVM: arm64: nv: Get rid of kvm_s2_trans*() accessors
  KVM: arm64: nv: Only shadow writable-dirty guest descs as writable
  KVM: arm64: nv: Pass an access descriptor for stage-2 walks
  KVM: arm64: nv: Use a helper for stage-2 descriptor updates
  KVM: arm64: nv: Set dirty state at stage-2
  KVM: arm64: nv: Treat DBM as writable at stage-2
  KVM: arm64: Compute S1 permissions as part of s1_walk()
  KVM: arm64: Plumb through access descriptor for stage-1
  KVM: arm64: Use a struct for stage-1 walk context
  KVM: arm64: Create helper for stage-1 descriptor updates
  KVM: arm64: Set dirty state at stage-1
  KVM: arm64: nv: Respect HA when computing translated TCR
  KVM: arm64: nv: Respect HD when computing translated TCR
  KVM: arm64: Grant write permission when DBM is set at S1
  KVM: arm64: Don't update descriptors for "non-arch" access
  KVM: arm64: nv: Emulate CMOs via writable-clean translations as NOPs
  arm64: Add command line switch to disable FEAT_S2FWB
  KVM: arm64: Reject non-coherent DMA when using forced writeback
  KVM: arm64: nv: Expose FEAT_HAFDBS
  KVM: arm64: Set Access flag on table descriptors at stage-1
  KVM: arm64: nv: Set access flag on table descriptors at stage-2
  KVM: arm64: nv: Expose FEAT_HAFT
  KVM: arm64: selftests: Only test AF behavior for emulated AT insns
  KVM: arm64: selftests: Test AT emulation for FEAT_HAFT
  KVM: arm64: Add tracepoints for S1 page table walk
  KVM: arm64: Add tracepoints for S2 page table walk

 .../admin-guide/kernel-parameters.txt         |   4 +
 arch/arm64/include/asm/kvm_arm.h              |   1 +
 arch/arm64/include/asm/kvm_emulate.h          |   5 +
 arch/arm64/include/asm/kvm_host.h             |   2 +
 arch/arm64/include/asm/kvm_nested.h           | 110 +++----
 arch/arm64/include/asm/kvm_pgtable.h          |  17 +-
 arch/arm64/kernel/pi/idreg-override.c         |   2 +
 arch/arm64/kvm/arm.c                          |  14 +
 arch/arm64/kvm/at.c                           | 277 +++++++++++------
 arch/arm64/kvm/hyp/pgtable.c                  |  11 -
 arch/arm64/kvm/mmu.c                          |  45 ++-
 arch/arm64/kvm/nested.c                       | 288 +++++++++++++-----
 arch/arm64/kvm/trace_arm.h                    |  99 ++++++
 tools/testing/selftests/kvm/arm64/at.c        | 102 +++++--
 14 files changed, 704 insertions(+), 273 deletions(-)


base-commit: dd0bc00e3e9201fd49b62ff9cc07890c89003afe
-- 
2.47.3


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

end of thread, other threads:[~2026-10-24  6:27 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-23 20:55 [PATCH v2 00/28] KVM: arm64: nv: Implement FEAT_HAFDBS, FEAT_HAFT Oliver Upton
2026-10-23 20:55 ` [PATCH v2 01/28] KVM: arm64: nv: Introduce struct for stage-2 walk step Oliver Upton
2026-10-23 20:55 ` [PATCH v2 02/28] KVM: arm64: nv: Consolidate computation of stage-2 permissions Oliver Upton
2026-10-23 20:55 ` [PATCH v2 03/28] KVM: arm64: nv: Get rid of kvm_s2_trans*() accessors Oliver Upton
2026-10-23 20:55 ` [PATCH v2 04/28] KVM: arm64: nv: Only shadow writable-dirty guest descs as writable Oliver Upton
2026-10-23 21:25   ` sashiko-bot
2026-10-24  6:26     ` Oliver Upton
2026-10-23 20:55 ` [PATCH v2 05/28] KVM: arm64: nv: Pass an access descriptor for stage-2 walks Oliver Upton
2026-10-23 20:55 ` [PATCH v2 06/28] KVM: arm64: nv: Use a helper for stage-2 descriptor updates Oliver Upton
2026-10-23 20:55 ` [PATCH v2 07/28] KVM: arm64: nv: Set dirty state at stage-2 Oliver Upton
2026-10-23 20:55 ` [PATCH v2 08/28] KVM: arm64: nv: Treat DBM as writable " Oliver Upton
2026-10-23 20:55 ` [PATCH v2 09/28] KVM: arm64: Compute S1 permissions as part of s1_walk() Oliver Upton
2026-10-23 20:55 ` [PATCH v2 10/28] KVM: arm64: Plumb through access descriptor for stage-1 Oliver Upton
2026-10-23 21:06   ` sashiko-bot
2026-10-23 20:55 ` [PATCH v2 11/28] KVM: arm64: Use a struct for stage-1 walk context Oliver Upton
2026-10-23 20:55 ` [PATCH v2 12/28] KVM: arm64: Create helper for stage-1 descriptor updates Oliver Upton
2026-10-23 20:55 ` [PATCH v2 13/28] KVM: arm64: Set dirty state at stage-1 Oliver Upton
2026-10-23 20:55 ` [PATCH v2 14/28] KVM: arm64: nv: Respect HA when computing translated TCR Oliver Upton
2026-10-23 20:55 ` [PATCH v2 15/28] KVM: arm64: nv: Respect HD " Oliver Upton
2026-10-23 20:55 ` [PATCH v2 16/28] KVM: arm64: Grant write permission when DBM is set at S1 Oliver Upton
2026-10-23 20:55 ` [PATCH v2 17/28] KVM: arm64: Don't update descriptors for "non-arch" access Oliver Upton
2026-10-23 20:56 ` [PATCH v2 18/28] KVM: arm64: nv: Emulate CMOs via writable-clean translations as NOPs Oliver Upton
2026-10-23 20:56 ` [PATCH v2 19/28] arm64: Add command line switch to disable FEAT_S2FWB Oliver Upton
2026-10-23 20:56 ` [PATCH v2 20/28] KVM: arm64: Reject non-coherent DMA when using forced writeback Oliver Upton
2026-10-23 21:16   ` sashiko-bot
2026-10-23 20:56 ` [PATCH v2 21/28] KVM: arm64: nv: Expose FEAT_HAFDBS Oliver Upton
2026-10-23 20:56 ` [PATCH v2 22/28] KVM: arm64: Set Access flag on table descriptors at stage-1 Oliver Upton
2026-10-23 21:22   ` sashiko-bot
2026-10-24  6:24     ` Oliver Upton
2026-10-23 20:56 ` [PATCH v2 23/28] KVM: arm64: nv: Set access flag on table descriptors at stage-2 Oliver Upton
2026-10-23 20:56 ` [PATCH v2 24/28] KVM: arm64: nv: Expose FEAT_HAFT Oliver Upton
2026-10-23 20:56 ` [PATCH v2 25/28] KVM: arm64: selftests: Only test AF behavior for emulated AT insns Oliver Upton
2026-10-23 20:56 ` [PATCH v2 26/28] KVM: arm64: selftests: Test AT emulation for FEAT_HAFT Oliver Upton
2026-10-23 20:56 ` [PATCH v2 27/28] KVM: arm64: Add tracepoints for S1 page table walk Oliver Upton
2026-10-23 20:56 ` [PATCH v2 28/28] KVM: arm64: Add tracepoints for S2 " Oliver Upton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.