Skip to content

KVM: arm64: Use visibility hook to treat ID regs as RAZ

Oliver Upton kvm kvmarm linux-arm-kernel linux-kselftest lkml 3 versions – Applied

Status from this message: Applied to kvm-arm64/next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest7 patches 1 replyApplied
  2. v27 patches 8 repliesSuperseded
  3. v16 patches 9 repliesSuperseded

Changes in v3 from the cover letter

- Collect more of Reiji's r-bs (thanks again!)
- Test the RAZ+invariant registers (AFR0, DFR1, unallocated AA32 ID registers) (Drew)
- Give the selftest a more sensible name

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/7KVM: arm64: Use visibility hook to treat ID regs as RAZarch/arm64/kvm/sys_regs.c+14 -190 replies
2/7KVM: arm64: Remove internal accessor helpers for id regsarch/arm64/kvm/sys_regs.c+12 -340 replies
3/7KVM: arm64: Drop raz parameter from read_id_reg()arch/arm64/kvm/sys_regs.c+6 -130 replies
4/7KVM: arm64: Spin off helper for calling visibility hookarch/arm64/kvm/sys_regs.h+11 -80 replies
5/7KVM: arm64: Add a visibility bit to ignore user writesarch/arm64/kvm/sys_regs.c arch/arm64/kvm/sys_regs.h+10 -00 replies
6/7KVM: arm64: Treat 32bit ID registers as RAZ/WI on 64bit-only systemarch/arm64/kvm/sys_regs.c+43 -200 replies
7/7KVM: selftests: Add test for AArch32 ID registerstools/testing/selftests/kvm/.gitignore tools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/aarch64/aarch32_id_regs.c+171 -00 replies

Reviews trailers per patch

5 of 7 patches have a Reviewed-by or Acked-by.

PatchReiji Watanabe
1/7R-b
2/7R-b
3/7R-b
4/7R-b
5/7R-b
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/7] KVM: arm64: Use visibility hook to treat ID regs as RAZ

For reasons unknown, the Arm architecture defines the 64-bit views of the 32-bit ID registers as UNKNOWN [1]. This combines poorly with the fact that KVM unconditionally exposes these registers to userspace, which could throw a wrench in migration between 64-bit only systems.

This series reworks KVM's definition of these registers to RAZ/WI with the goal of providing consistent register values across 64-bit machines.

Patches 1-3 clean up the ID register accessors, taking advantage of the fact that the generic accessors know how to handle RAZ.

Patches 4-6 start switch the handling of potentially nonzero AArch32 ID registers to RAZ/WI. RAZ covers up the architecturally UNKNOWN values, and WI allows for migration off of kernels that may provide garbage. Note that hidden AArch32 ID registers continue to have RAZ behavior with the additional expectation of invariance.

Lastly, patch 7 includes a small test for the issue.

Applies to 6.0-rc3. Tested with KVM selftests under the fast model w/ asymmetric 32 bit support and no 32 bit support whatsoever.

[1]: DDI0487H.a Table D12-2 'Instruction encodings for non-Debug System Register accesses'

v2: https://lore.kernel.org/kvmarm/[email protected]/

v2 -> v3:
- Collect more of Reiji's r-bs (thanks again!)
- Test the RAZ+invariant registers (AFR0, DFR1, unallocated AA32 ID registers) (Drew)
- Give the selftest a more sensible name

v1 -> v2:
- Collect Reiji's r-b tags (thanks!)
- Call sysreg_visible_as_raz() from read_id_reg() (Reiji)
- Hoist sysreg_user_write_ignore() into kvm_sys_reg_set_user() (Reiji)

Oliver Upton (7):
KVM: arm64: Use visibility hook to treat ID regs as RAZ
KVM: arm64: Remove internal accessor helpers for id regs
KVM: arm64: Drop raz parameter from read_id_reg()
KVM: arm64: Spin off helper for calling visibility hook
KVM: arm64: Add a visibility bit to ignore user writes
KVM: arm64: Treat 32bit ID registers as RAZ/WI on 64bit-only system
KVM: selftests: Add test for AArch32 ID registers

 arch/arm64/kvm/sys_regs.c                     | 150 ++++++++--------
 arch/arm64/kvm/sys_regs.h                     |  24 ++-
 tools/testing/selftests/kvm/.gitignore        |   1 +
 tools/testing/selftests/kvm/Makefile          |   1 +
 .../selftests/kvm/aarch64/aarch32_id_regs.c   | 169 ++++++++++++++++++
 5 files changed, 259 insertions(+), 86 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/aarch64/aarch32_id_regs.c

base-commit: b90cb1053190353cc30f0fef0ef1f378ccc063c5

Signature · 6 lines
2.37.2.789.g6183377224-goog

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm