mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 0/2] KVM: arm64: Fix inverted E2H0 check for HCR_EL2.NV1
@ 2026-11-16 20:04 Colton Lewis
  2026-11-16 20:04 ` [PATCH v1 1/2] " Colton Lewis
  2026-11-16 20:04 ` [PATCH v1 2/2] KVM: arm64: selftests: Verify HCR_EL2.NV1 is RES0 when E2H0 is NI_NV1 Colton Lewis
  0 siblings, 2 replies; 3+ messages in thread
From: Colton Lewis @ 2026-11-16 20:04 UTC (permalink / raw)
  To: Marc Zyngier, Oliver Upton
  Cc: Joey Gouly, Suzuki K Poulose, Zenghui Yu, Fuad Tabba, kvmarm,
	linux-arm-kernel, kvm, linux-kernel, Colton Lewis

When commit b2a324ff01fe ("KVM: arm64: Use HCR_EL2 feature map to drive
fixed-value bits") migrated HCR_EL2 fixed-bit masking to hcr_feat_map,
feat_nv2_e2h0_ni() was written as !kvm_has_feat(kvm, FEAT_E2H0). Because
ID_AA64MMFR4_EL1.E2H0 is a signed 4-bit field where IMP is 0, NI is -1,
and NI_NV1 is -2, !kvm_has_feat(kvm, FEAT_E2H0) tests E2H0 < 0 and
returns true for NI_NV1 (-2), leaving HCR_EL2.NV1 writable instead of
RES0 for VHE-only nested guests (and conversely treating HCR_EL2.NV1 as
RES0 when E2H0 is IMP).

Patch 1 restores the check in feat_nv2_e2h0_ni() to
kvm_has_feat(kvm, ID_AA64MMFR4_EL1, E2H0, NI) (E2H0 >= -1) so that
HCR_EL2.NV1 is implemented for IMP and NI and forced to RES0 for NI_NV1.
Patch 2 extends the arm64 hello_el2 selftest to verify that HCR_EL2.E2H
remains RES1 and HCR_EL2.NV1 remains RES0 across both guest EL2 writes
and userspace KVM_SET_ONE_REG writes when E2H0 is NI_NV1.

Colton Lewis (2):
  KVM: arm64: Fix inverted E2H0 check for HCR_EL2.NV1
  KVM: arm64: selftests: Verify HCR_EL2.NV1 is RES0 when E2H0 is NI_NV1

 arch/arm64/kvm/config.c                       |  3 +-
 tools/testing/selftests/kvm/arm64/hello_el2.c | 34 ++++++++++++++++---
 2 files changed, 31 insertions(+), 6 deletions(-)


base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
-- 
2.56.1.750.gf70dc682cf-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-16 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 20:04 [PATCH v1 0/2] KVM: arm64: Fix inverted E2H0 check for HCR_EL2.NV1 Colton Lewis
2026-11-16 20:04 ` [PATCH v1 1/2] " Colton Lewis
2026-11-16 20:04 ` [PATCH v1 2/2] KVM: arm64: selftests: Verify HCR_EL2.NV1 is RES0 when E2H0 is NI_NV1 Colton Lewis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®