KVM: arm64: nv: Fix sysreg RESx-ication
Status from this message: Applied to next, thanks!
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | KVM: arm64: nv: Always evaluate HCR_EL2 using sanitising accessorsarch/ arch/ | +17 | 0 replies | |
| 2/2 | KVM: arm64: nv: Apply RESx settings to sysreg reset valuesarch/ arch/ arch/ | +12 | 0 replies |
Reviews trailers per patch
None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Joey Gouly |
|---|---|
| Series | T-b R-b |
| 1/2 | |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/2] KVM: arm64: nv: Fix sysreg RESx-ication
Joey recently reported that some rather basic tests were failing on NV, and managed to track it down to critical register fields (such as HCR_EL2.E2H) not having their expect value.
Further investigation has outlined a couple of critical issues:
- Evaluating HCR_EL2.E2H must always be done with a sanitising accessor, no ifs, no buts. Given that KVM assumes a fixed value for this bit, we cannot leave it to the guest to mess with.
- Resetting the sysreg file must result in the RESx bits taking effect. Otherwise, we may end-up making the wrong decision (see above), and we definitely expose invalid values to the guest. Note that because we compute the RESx masks very late in the VM setup, we need to apply these masks at that particular point as well.
The two patches in this series are enough to fix the current set of issues, but __vcpu_sys_reg() needs some extra work as it is doing the wrong thing when used as a lvalue. I'll post a separate series for that, as the two problems are fairly orthogonal, and this results in a significant amount of churn.
All kudos to Joey for patiently tracking that one down. This was hidden behind a myriad of other issues, and nailing this sucker down is nothing short of a debugging lesson. Drinks on me next time.
Unless someone shouts, I'll take this in for 6.14.
Marc Zyngier (2):
KVM: arm64: nv: Always evaluate HCR_EL2 using sanitising accessors
KVM: arm64: nv: Apply RESx settings to sysreg reset values
arch/arm64/include/asm/kvm_emulate.h | 36 ++++++++++++---------------- arch/arm64/include/asm/kvm_nested.h | 2 +- arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 4 ++-- arch/arm64/kvm/nested.c | 9 +++++-- arch/arm64/kvm/sys_regs.c | 5 +++- 5 files changed, 29 insertions(+), 27 deletions(-)
Signature · 1 line
2.39.2