Skip to content

KVM: arm64: emulation for CTR_EL0

Sebastian Ott kvmarm linux-arm-kernel lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest6 patches 6 repliesIn review
  2. v36 patches 17 repliesSuperseded
  3. v26 patches 11 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches5 repliesSuperseded

Changes in v4 from the cover letter

* incorporated feedback from Shaoqin and Eric

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6KVM: arm64: unify code to prepare trapsarch/arm64/include/asm/kvm_emulate.h arch/arm64/include/asm/kvm_host.h arch/arm64/kvm/arm.c +1 more+43 -350 replies
2/6KVM: arm64: maintain per VM value for CTR_EL0arch/arm64/include/asm/kvm_host.h arch/arm64/kvm/sys_regs.c+16 -70 replies
3/6KVM: arm64: add emulation for CTR_EL0 registerarch/arm64/kvm/sys_regs.c+118 -165 replies
4/6KVM: arm64: show writable masks for feature registersarch/arm64/kvm/sys_regs.c+5 -140 replies
5/6KVM: arm64: rename functions for invariant sys regsarch/arm64/kvm/sys_regs.c+5 -50 replies
6/6KVM: selftests: arm64: Test writes to CTR_EL0tools/testing/selftests/kvm/aarch64/set_id_regs.c+16 -00 replies

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchEric AugerShaoqin Huang
1/6R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6R-b

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

Read the v4 thread

Cover letter [PATCH v4 0/6] KVM: arm64: emulation for CTR_EL0

Hej folks,

I'm looking into supporting migration between 2 Ampere Altra (Max) machines (using Neoverse-N1). They are almost identical regarding their feature id register state except for CTR_EL0.DIC which is set on one machine but not the other.

CTR_EL0 is currently marked as invariant and migrating a VM between those 2 machines using qemu fails.

Changes RFC [0] -> V1 [1]:
* store the emulated value per VM and not per VCPU
* allow to change more values than just the DIC bit
* only trap guest access to that reg when needed
* make sure to not present the guest with an inconsistent register set
Changes V1 -> V2 [2]:
* implemented Marc's suggestion for keeping registers consistent while not breaking userspace ABI / expectations (I hope correctly this time)
* keep the shadowed value valid at all time
* unify the code to setup traps
Changes V2 -> V3 [3]:
* rebased to kvm-arm-next (to include Olivers idreg fixes)
* fixed VM ops trapping for non-FWB CPUs
* fixed writable mask for CLIDR_EL1
* re-added manual ctr validation (using arm64_check_features() had a side effect with the way .reset is working for these registers)
* added a testcase
Changes V3 -> V4:
* incorporated feedback from Shaoqin and Eric

Thanks,
Sebastian

[0]: https://lore.kernel.org/all/[email protected]/T/
[1]: https://lore.kernel.org/lkml/[email protected]/T/
[2]: https://lore.kernel.org/lkml/[email protected]/T/
[3]: https://lore.kernel.org/lkml/[email protected]/T/

Sebastian Ott (6):
KVM: arm64: unify code to prepare traps
KVM: arm64: maintain per VM value for CTR_EL0
KVM: arm64: add emulation for CTR_EL0 register
KVM: arm64: show writable masks for feature registers
KVM: arm64: rename functions for invariant sys regs
KVM: selftests: arm64: Test writes to CTR_EL0

 arch/arm64/include/asm/kvm_emulate.h          |  40 +---
 arch/arm64/include/asm/kvm_host.h             |   4 +-
 arch/arm64/kvm/arm.c                          |   2 +-
 arch/arm64/kvm/sys_regs.c                     | 214 ++++++++++++++----
 .../selftests/kvm/aarch64/set_id_regs.c       |  16 ++
 5 files changed, 201 insertions(+), 75 deletions(-)
Signature · 1 line
2.42.0