]> www.infradead.org Git - users/hch/misc.git/commitdiff
KVM: arm64: Convert MDCR_EL2 RES0 handling to compute_reg_res0_bits()
authorMarc Zyngier <maz@kernel.org>
Thu, 18 Sep 2025 15:14:02 +0000 (16:14 +0100)
committerMarc Zyngier <maz@kernel.org>
Fri, 19 Sep 2025 12:45:36 +0000 (13:45 +0100)
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>
arch/arm64/kvm/config.c

index cab28773ef1f70c1c71790b850036d333c0f3fa3..fbd8944a3dea1c93b26cf92731b342b1e67521b2 100644 (file)
@@ -1162,6 +1162,9 @@ static const struct reg_bits_to_feat_map mdcr_el2_feat_map[] = {
                   FEAT_AA64EL1),
 };
 
+static const DECLARE_FEAT_MAP(mdcr_el2_desc, MDCR_EL2,
+                             mdcr_el2_feat_map, FEAT_AA64EL2);
+
 static void __init check_feat_map(const struct reg_bits_to_feat_map *map,
                                  int map_size, u64 res0, const char *str)
 {
@@ -1204,8 +1207,7 @@ void __init check_feature_map(void)
        check_reg_desc(&sctlr2_desc);
        check_reg_desc(&tcr2_el2_desc);
        check_reg_desc(&sctlr_el1_desc);
-       check_feat_map(mdcr_el2_feat_map, ARRAY_SIZE(mdcr_el2_feat_map),
-                      MDCR_EL2_RES0, "MDCR_EL2");
+       check_reg_desc(&mdcr_el2_desc);
 }
 
 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
                *res1 = SCTLR_EL1_RES1;
                break;
        case MDCR_EL2:
-               *res0 = compute_res0_bits(kvm, mdcr_el2_feat_map,
-                                         ARRAY_SIZE(mdcr_el2_feat_map), 0, 0);
-               *res0 |= MDCR_EL2_RES0;
+               *res0 = compute_reg_res0_bits(kvm, &mdcr_el2_desc, 0, 0);
                *res1 = MDCR_EL2_RES1;
                break;
        default: