Skip to content

Commit c21df6e

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: Expose ID_AA64MMFR4_EL1 to guests
We can now expose ID_AA64MMFR4_EL1 to guests, and let NV guests understand that they cannot really switch HCR_EL2.E2H to 0 on some platforms. Reviewed-by: Suzuki K Poulose <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 3944382 commit c21df6e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

arch/arm64/kvm/nested.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ static u64 limit_nv_id_reg(u32 id, u64 val)
133133
val |= FIELD_PREP(NV_FTR(MMFR2, TTL), 0b0001);
134134
break;
135135

136+
case SYS_ID_AA64MMFR4_EL1:
137+
val = 0;
138+
if (!cpus_have_final_cap(ARM64_HAS_HCR_NV1))
139+
val |= FIELD_PREP(NV_FTR(MMFR4, E2H0),
140+
ID_AA64MMFR4_EL1_E2H0_NI_NV1);
141+
break;
142+
136143
case SYS_ID_AA64DFR0_EL1:
137144
/* Only limited support for PMU, Debug, BPs and WPs */
138145
val &= (NV_FTR(DFR0, PMUVer) |

arch/arm64/kvm/sys_regs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2350,7 +2350,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
23502350
ID_AA64MMFR2_EL1_NV |
23512351
ID_AA64MMFR2_EL1_CCIDX)),
23522352
ID_SANITISED(ID_AA64MMFR3_EL1),
2353-
ID_UNALLOCATED(7,4),
2353+
ID_SANITISED(ID_AA64MMFR4_EL1),
23542354
ID_UNALLOCATED(7,5),
23552355
ID_UNALLOCATED(7,6),
23562356
ID_UNALLOCATED(7,7),

0 commit comments

Comments
 (0)