Skip to content

Commit bf48040

Browse files
akihikodakioupton
authored andcommitted
KVM: arm64: Mask FEAT_CCIDX
The CCSIDR access handler masks the associativity bits according to the bit layout for processors without FEAT_CCIDX. KVM also assumes CCSIDR is 32-bit where it will be 64-bit if FEAT_CCIDX is enabled. Mask FEAT_CCIDX so that these assumptions hold. Suggested-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Link: https://lore.kernel.org/r/20230112023852.42012-7-akihiko.odaki@daynix.com Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent 8cc6ded commit bf48040

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,12 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu, struct sys_reg_desc const *r
11551155
val |= FIELD_PREP(ARM64_FEATURE_MASK(ID_DFR0_EL1_PerfMon),
11561156
pmuver_to_perfmon(vcpu_pmuver(vcpu)));
11571157
break;
1158+
case SYS_ID_AA64MMFR2_EL1:
1159+
val &= ~ID_AA64MMFR2_EL1_CCIDX_MASK;
1160+
break;
1161+
case SYS_ID_MMFR4_EL1:
1162+
val &= ~ARM64_FEATURE_MASK(ID_MMFR4_EL1_CCIDX);
1163+
break;
11581164
}
11591165

11601166
return val;
@@ -1718,6 +1724,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
17181724

17191725
{ SYS_DESC(SYS_CCSIDR_EL1), access_ccsidr },
17201726
{ SYS_DESC(SYS_CLIDR_EL1), access_clidr },
1727+
{ SYS_DESC(SYS_CCSIDR2_EL1), undef_access },
17211728
{ SYS_DESC(SYS_SMIDR_EL1), undef_access },
17221729
{ SYS_DESC(SYS_CSSELR_EL1), access_csselr, reset_unknown, CSSELR_EL1 },
17231730
{ SYS_DESC(SYS_CTR_EL0), access_ctr },
@@ -2219,6 +2226,10 @@ static const struct sys_reg_desc cp15_regs[] = {
22192226

22202227
{ Op1(1), CRn( 0), CRm( 0), Op2(0), access_ccsidr },
22212228
{ Op1(1), CRn( 0), CRm( 0), Op2(1), access_clidr },
2229+
2230+
/* CCSIDR2 */
2231+
{ Op1(1), CRn( 0), CRm( 0), Op2(2), undef_access },
2232+
22222233
{ Op1(2), CRn( 0), CRm( 0), Op2(0), access_csselr, NULL, CSSELR_EL1 },
22232234
};
22242235

0 commit comments

Comments
 (0)