KVM: arm64: nv: Implement FEAT_HAFDBS, FEAT_HAFT
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest28 patches 23 repliesIn review
- v122 patches 54 repliesSuperseded
Changes in v2 from the cover letter
- 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.
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/28 | KVM: arm64: nv: Introduce struct for stage-2 walk steparch/ | +57 | 0 replies | |
| 2/28 | KVM: arm64: nv: Consolidate computation of stage-2 permissionsarch/ arch/ arch/ | +45 | 0 replies | |
| 3/28 | KVM: arm64: nv: Get rid of kvm_s2_trans*() accessorsarch/ arch/ arch/ +1 more | +17 | 0 replies | |
| 4/28 | KVM: arm64: nv: Only shadow writable-dirty guest descs as writablearch/ arch/ arch/ +1 more | +16 | 2 replies | |
| 5/28 | KVM: arm64: nv: Pass an access descriptor for stage-2 walksarch/ arch/ arch/ +2 more | +57 | 1 reply | |
| 6/28 | KVM: arm64: nv: Use a helper for stage-2 descriptor updatesarch/ | +26 | 1 reply | |
| 7/28 | KVM: arm64: nv: Set dirty state at stage-2arch/ | +39 | 1 reply | |
| 8/28 | KVM: arm64: nv: Treat DBM as writable at stage-2arch/ arch/ | +12 | 0 replies | |
| 9/28 | KVM: arm64: Compute S1 permissions as part of s1_walk()arch/ | +20 | 0 replies | |
| 10/28 | KVM: arm64: Plumb through access descriptor for stage-1arch/ arch/ arch/ | +35 | 1 reply | |
| 11/28 | KVM: arm64: Use a struct for stage-1 walk contextarch/ | +51 | 0 replies | |
| 12/28 | KVM: arm64: Create helper for stage-1 descriptor updatesarch/ | +31 | 0 replies | |
| 13/28 | KVM: arm64: Set dirty state at stage-1arch/ arch/ arch/ | +33 | 0 replies | |
| 14/28 | KVM: arm64: nv: Respect HA when computing translated TCRarch/ | +2 | 1 reply | |
| 15/28 | KVM: arm64: nv: Respect HD when computing translated TCRarch/ | +2 | 1 reply | |
| 16/28 | KVM: arm64: Grant write permission when DBM is set at S1arch/ | +14 | 0 replies | |
| 17/28 | KVM: arm64: Don't update descriptors for "non-arch" accessarch/ arch/ | +25 | 0 replies | |
| 18/28 | KVM: arm64: nv: Emulate CMOs via writable-clean translations as NOPsarch/ arch/ | +24 | 9 replies | |
| 19/28 | arm64: Add command line switch to disable FEAT_S2FWBDocumentation/ arch/ | +6 | 1 reply | |
| 20/28 | KVM: arm64: Reject non-coherent DMA when using forced writebackarch/ arch/ | +16 | 1 reply | |
| 21/28 | KVM: arm64: nv: Expose FEAT_HAFDBSarch/ | +6 | 1 reply | |
| 22/28 | KVM: arm64: Set Access flag on table descriptors at stage-1arch/ arch/ arch/ +1 more | +28 | 1 reply | |
| 23/28 | KVM: arm64: nv: Set access flag on table descriptors at stage-2arch/ | +10 | 0 replies | |
| 24/28 | KVM: arm64: nv: Expose FEAT_HAFTarch/ | +1 | 0 replies | |
| 25/28 | KVM: arm64: selftests: Only test AF behavior for emulated AT insnstools/ | +24 | 0 replies | |
| 26/28 | KVM: arm64: selftests: Test AT emulation for FEAT_HAFTtools/ | +66 | 0 replies | |
| 27/28 | KVM: arm64: Add tracepoints for S1 page table walkarch/ arch/ arch/ | +68 | 1 reply | |
| 28/28 | KVM: arm64: Add tracepoints for S2 page table walkarch/ arch/ arch/ | +59 | 1 reply |
Reviews trailers per patch
26 of 28 patches have a Reviewed-by or Acked-by.
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 00/28] KVM: arm64: nv: Implement FEAT_HAFDBS, FEAT_HAFT
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
Signature · 1 line
2.47.3