Skip to content

Commit 4870a8c

Browse files
author
Marc Zyngier
committed
KVM: arm64: Enforce absence of FEAT_TCR2 on TCR2_EL2
Enforce that TCR2_EL2 are RES0 when FEAT_TCR2 isn't present. Reviewed-by: Oliver Upton <oliver.upton@linux.dev> Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent f89763e commit 4870a8c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

arch/arm64/kvm/config.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,9 @@ static const struct reg_bits_to_feat_map tcr2_el2_feat_map[] = {
10511051
NEEDS_FEAT(TCR2_EL2_PIE, FEAT_S1PIE),
10521052
};
10531053

1054+
static const DECLARE_FEAT_MAP(tcr2_el2_desc, TCR2_EL2,
1055+
tcr2_el2_feat_map, FEAT_TCR2);
1056+
10541057
static const struct reg_bits_to_feat_map sctlr_el1_feat_map[] = {
10551058
NEEDS_FEAT(SCTLR_EL1_CP15BEN |
10561059
SCTLR_EL1_ITD |
@@ -1196,8 +1199,7 @@ void __init check_feature_map(void)
11961199
check_reg_desc(&hcrx_desc);
11971200
check_reg_desc(&hcr_desc);
11981201
check_reg_desc(&sctlr2_desc);
1199-
check_feat_map(tcr2_el2_feat_map, ARRAY_SIZE(tcr2_el2_feat_map),
1200-
TCR2_EL2_RES0, "TCR2_EL2");
1202+
check_reg_desc(&tcr2_el2_desc);
12011203
check_feat_map(sctlr_el1_feat_map, ARRAY_SIZE(sctlr_el1_feat_map),
12021204
SCTLR_EL1_RES0, "SCTLR_EL1");
12031205
check_feat_map(mdcr_el2_feat_map, ARRAY_SIZE(mdcr_el2_feat_map),
@@ -1405,9 +1407,7 @@ void get_reg_fixed_bits(struct kvm *kvm, enum vcpu_sysreg reg, u64 *res0, u64 *r
14051407
*res1 = SCTLR2_EL1_RES1;
14061408
break;
14071409
case TCR2_EL2:
1408-
*res0 = compute_res0_bits(kvm, tcr2_el2_feat_map,
1409-
ARRAY_SIZE(tcr2_el2_feat_map), 0, 0);
1410-
*res0 |= TCR2_EL2_RES0;
1410+
*res0 = compute_reg_res0_bits(kvm, &tcr2_el2_desc, 0, 0);
14111411
*res1 = TCR2_EL2_RES1;
14121412
break;
14131413
case SCTLR_EL1:

0 commit comments

Comments
 (0)