Skip to content

Commit 8b0b98e

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: Advertise FEAT_ECV when possible
We can advertise support for FEAT_ECV if supported on the HW as long as we limit it to the basic trap bits, and not advertise CNTPOFF_EL2 support, even if the host has it (the short story being that CNTPOFF_EL2 is not virtualisable). Signed-off-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Joey Gouly <joey.gouly@arm.com> Link: https://lore.kernel.org/r/20250220134907.554085-13-maz@kernel.org Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent 642c23e commit 8b0b98e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

arch/arm64/kvm/nested.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -848,14 +848,16 @@ u64 limit_nv_id_reg(struct kvm *kvm, u32 reg, u64 val)
848848
break;
849849

850850
case SYS_ID_AA64MMFR0_EL1:
851-
/* Hide ECV, ExS, Secure Memory */
852-
val &= ~(ID_AA64MMFR0_EL1_ECV |
853-
ID_AA64MMFR0_EL1_EXS |
851+
/* Hide ExS, Secure Memory */
852+
val &= ~(ID_AA64MMFR0_EL1_EXS |
854853
ID_AA64MMFR0_EL1_TGRAN4_2 |
855854
ID_AA64MMFR0_EL1_TGRAN16_2 |
856855
ID_AA64MMFR0_EL1_TGRAN64_2 |
857856
ID_AA64MMFR0_EL1_SNSMEM);
858857

858+
/* Hide CNTPOFF if present */
859+
val = ID_REG_LIMIT_FIELD_ENUM(val, ID_AA64MMFR0_EL1, ECV, IMP);
860+
859861
/* Disallow unsupported S2 page sizes */
860862
switch (PAGE_SIZE) {
861863
case SZ_64K:

0 commit comments

Comments
 (0)