KVM: arm64: De-specialise the timer UAPI
Status from this message: Applied to fixes, thanks!
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/13 | KVM: arm64: Hide CNTHV_*_EL2 from userspace for nVHE guestsarch/ | +13 | 2 replies | |
| 2/13 | KVM: arm64: Introduce timer_context_to_vcpu() helperarch/ include/ | +14 | 0 replies | |
| 3/13 | KVM: arm64: Replace timer context vcpu pointer with timer_idarch/ include/ | +8 | 1 reply | |
| 4/13 | KVM: arm64: Make timer_set_offset() generally accessiblearch/ include/ | +10 | 0 replies | |
| 5/13 | KVM: arm64: Add timer UAPI workaround to sysreg infrastructurearch/ arch/ | +36 | 2 replies | |
| 6/13 | KVM: arm64: Move CNT*_CTL_EL0 userspace accessors to generic infrastructurearch/ arch/ | +31 | 0 replies | |
| 7/13 | KVM: arm64: Move CNT*_CVAL_EL0 userspace accessors to generic infrastructurearch/ arch/ | +4 | 0 replies | |
| 8/13 | KVM: arm64: Move CNT*CT_EL0 userspace accessors to generic infrastructurearch/ arch/ | +31 | 3 replies | |
| 9/13 | KVM: arm64: Fix WFxT handling of nested virtarch/ | +6 | 0 replies | |
| 10/13 | KVM: arm64: Kill leftovers of ad-hoc timer userspace accessarch/ arch/ include/ | +0 | 0 replies | |
| 11/13 | KVM: arm64: selftests: Make dependencies on VHE-specific registers explicittools/ | +3 | 0 replies | |
| 12/13 | KVM: arm64: selftests: Add an E2H=0-specific configuration to get_reg_listtools/ | +79 | 0 replies | |
| 13/13 | KVM: arm64: selftest: Fix misleading comment about virtual timer encodingtools/ | +14 | 0 replies |
Reviews trailers per patch
2 of 13 patches have a Reviewed-by or Acked-by.
| Patch | Joey Gouly |
|---|---|
| 1/13 | |
| 2/13 | |
| 3/13 | R-b |
| 4/13 | |
| 5/13 | |
| 6/13 | |
| 7/13 | |
| 8/13 | R-b |
| 9/13 | |
| 10/13 | |
| 11/13 | |
| 12/13 | |
| 13/13 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 00/13] KVM: arm64: De-specialise the timer UAPI
Since the beginning of the KVM/arm64 port, the timer registers were handled out of the normal sysreg flow when it came to userspace access, leading to extra complexity and a bit of code duplication.
When NV was introduced, the decision was made early to handle the new timer registers as part of the generic infrastructure. However, the EL0 timers were left behind until someone could be bothered to entangle that mess.
Said mess is more complicated than it looks, due to a nasty bug documented in 290a6bb06de9e ("arm64: KVM: Add UAPI notes for swapped registers"), where it was realised that CNTV_CVAL_EL0 and CNTVCT_EL0 have had their encoding swapped at the user interface level. Handling of this issue is spread all over the place instead of being contained in a single location, and it needs to be contained.
Finally, it was noticed that we expose the CNTHV_*_EL2 registers to userspace for nVHE guest, while the architecture is clear that they do not exist in that configuration.
This series aims at fixing all of the above, moving the handling of the timer sysregs to sys_regs.c, fix a corner case with WFxT, handle the nVHE issue described above, and finally improve the testing by introducing an E2H==0 configuration.
If excluding the selftests, this is a net deletion of code. What's not to like?
Marc Zyngier (13):
KVM: arm64: Hide CNTHV_*_EL2 from userspace for nVHE guests
KVM: arm64: Introduce timer_context_to_vcpu() helper
KVM: arm64: Replace timer context vcpu pointer with timer_id
KVM: arm64: Make timer_set_offset() generally accessible
KVM: arm64: Add timer UAPI workaround to sysreg infrastructure
KVM: arm64: Move CNT*_CTL_EL0 userspace accessors to generic
infrastructure
KVM: arm64: Move CNT*_CVAL_EL0 userspace accessors to generic
infrastructure
KVM: arm64: Move CNT*CT_EL0 userspace accessors to generic
infrastructure
KVM: arm64: Fix WFxT handling of nested virt
KVM: arm64: Kill leftovers of ad-hoc timer userspace access
KVM: arm64: selftests: Make dependencies on VHE-specific registers
explicit
KVM: arm64: selftests: Add an E2H=0-specific configuration to
get_reg_list
KVM: arm64: selftest: Fix misleading comment about virtual timer
encoding
arch/arm64/kvm/arch_timer.c | 105 ++------------- arch/arm64/kvm/guest.c | 70 ---------- arch/arm64/kvm/handle_exit.c | 7 +- arch/arm64/kvm/sys_regs.c | 123 +++++++++++++++--- arch/arm64/kvm/sys_regs.h | 6 + include/kvm/arm_arch_timer.h | 24 ++-- .../selftests/kvm/arm64/get-reg-list.c | 99 +++++++++++++- 7 files changed, 240 insertions(+), 194 deletions(-)
Signature · 1 line
2.47.3