Skip to content

Commit ac53365

Browse files
author
Marc Zyngier
committed
KVM: arm64: Convert MDCR_EL2 RES0 handling to compute_reg_res0_bits()
While MDCR_EL2 cannot be RES0, convert it to the same infrastructure anyway, as it make things cleaner. Reviewed-by: Oliver Upton <oliver.upton@linux.dev> Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent d2a1d78 commit ac53365

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
@@ -1162,6 +1162,9 @@ static const struct reg_bits_to_feat_map mdcr_el2_feat_map[] = {
11621162
FEAT_AA64EL1),
11631163
};
11641164

1165+
static const DECLARE_FEAT_MAP(mdcr_el2_desc, MDCR_EL2,
1166+
mdcr_el2_feat_map, FEAT_AA64EL2);
1167+
11651168
static void __init check_feat_map(const struct reg_bits_to_feat_map *map,
11661169
int map_size, u64 res0, const char *str)
11671170
{
@@ -1204,8 +1207,7 @@ void __init check_feature_map(void)
12041207
check_reg_desc(&sctlr2_desc);
12051208
check_reg_desc(&tcr2_el2_desc);
12061209
check_reg_desc(&sctlr_el1_desc);
1207-
check_feat_map(mdcr_el2_feat_map, ARRAY_SIZE(mdcr_el2_feat_map),
1208-
MDCR_EL2_RES0, "MDCR_EL2");
1210+
check_reg_desc(&mdcr_el2_desc);
12091211
}
12101212

12111213
static bool idreg_feat_match(struct kvm *kvm, const struct reg_bits_to_feat_map *map)
@@ -1417,9 +1419,7 @@ void get_reg_fixed_bits(struct kvm *kvm, enum vcpu_sysreg reg, u64 *res0, u64 *r
14171419
*res1 = SCTLR_EL1_RES1;
14181420
break;
14191421
case MDCR_EL2:
1420-
*res0 = compute_res0_bits(kvm, mdcr_el2_feat_map,
1421-
ARRAY_SIZE(mdcr_el2_feat_map), 0, 0);
1422-
*res0 |= MDCR_EL2_RES0;
1422+
*res0 = compute_reg_res0_bits(kvm, &mdcr_el2_desc, 0, 0);
14231423
*res1 = MDCR_EL2_RES1;
14241424
break;
14251425
default:

0 commit comments

Comments
 (0)