diff options
| author | Colton Lewis <coltonlewis@google.com> | 2026-11-18 20:36:24 +0000 |
|---|---|---|
| committer | Marc Zyngier <maz@kernel.org> | 2026-11-19 10:31:23 +0000 |
| commit | 0f1bdabb82be5d1b5401364cd828caf0985dad48 (patch) | |
| tree | dca1ab8817edee3e826ec374cdc579ba36de310d /tools/perf/scripts/python/bin | |
| parent | 50e9e6b6eb3d9b2c318babce60abdf3b300cfb35 (diff) | |
KVM: arm64: Force HCR_EL2.NV1 to RES0 unconditionally
ID_AA64MMFR4_EL1.E2H0 is a signed 4-bit field where:
- 0b0000 (IMP, 0): FEAT_E2H0 is implemented.
- 0b1111 (NI, -1): FEAT_E2H0 is not implemented, except HCR_EL2.NV1
is implemented.
- 0b1110 (NI_NV1, -2): Neither HCR_EL2.E2H == 0 nor HCR_EL2.NV1 is
implemented, and HCR_EL2.NV1 is RES0.
When commit b2a324ff01fe ("KVM: arm64: Use HCR_EL2 feature map to drive
fixed-value bits") converted HCR_EL2 to hcr_feat_map[], feat_nv2_e2h0_ni()
was written as !kvm_has_feat(kvm, FEAT_E2H0), where FEAT_E2H0 checks
E2H0 >= IMP (0). This inverted the condition: feat_nv2_e2h0_ni() evaluates
to true when E2H0 < 0 (including NI_NV1), leaving HCR_EL2.NV1 writable
instead of RES0 for VHE-only nested guests where KVM advertises
ID_AA64MMFR4_EL1.E2H0 = NI_NV1.
In practice, KVM cannot handle HCR_EL2.NV1 being non-RES0 in any
configuration: limit_nv_id_reg() exposes either VHE-only EL2 with
ID_AA64MMFR4_EL1.E2H0 = NI_NV1 (and E2H0 is not userspace-writable), or
FEAT_E2H0 without FEAT_VHE or FEAT_NV. Checking E2H0 in a feature helper
is therefore unnecessary.
Drop feat_nv2_e2h0_ni() and mark HCR_EL2_NV1 as an unconditional RES0 bit
using NEEDS_FEAT_FLAG(HCR_EL2_NV1, FORCE_RESx) in hcr_feat_map[] (shared
by HCR_EL2 and NVHCR_EL2). Because HCR_EL2_NV1 is not part of the
architectural HCR_EL2_RES0 mask, check_feat_map() accounts for it as an
implementation-defined FORCE_RESx bit.
Fixes: b2a324ff01fe ("KVM: arm64: Use HCR_EL2 feature map to drive fixed-value bits")
Suggested-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Colton Lewis <coltonlewis@google.com>
Link: https://patch.msgid.link/20261118203625.743428-2-coltonlewis@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions
