[PATCH v2 10/10] KVM: arm64: Convert MDCR_EL2 RES0 handling to compute_reg_res0_bits()

Ben Horgan ben.horgan at arm.com
Fri Sep 19 03:53:54 PDT 2025


Hi Marc,

On 9/18/25 16:14, Marc Zyngier wrote:
> While MDCR_EL2 cannot be RES0, convert it to the same infrastructure
> anyway, as it make things cleaner.
> 
> Signed-off-by: Marc Zyngier <maz at kernel.org>
> ---
>  arch/arm64/kvm/config.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/kvm/config.c b/arch/arm64/kvm/config.c
> index 7b5c5044d4f64..109d1edcd83d4 100644
> --- a/arch/arm64/kvm/config.c
> +++ b/arch/arm64/kvm/config.c
[...]
> @@ -1417,8 +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 = compute_reg_res0_bits(kvm, &mdcr_el2_desc, 0, 0);
>  		*res0 |= MDCR_EL2_RES0;
>  		*res1 = MDCR_EL2_RES1;
>  		break;

The patch itself looks fine to me but I am confused as to why MDCR_EL2
is the only switch case where we have:

*res0 |= <reg>_RES0;

Should this not be present in the other cases?

Thanks,

Ben




More information about the linux-arm-kernel mailing list