[PATCH v4 4/7] KVM: arm64: Fix missing traps of guest accesses to the MPAM registers

Marc Zyngier maz at kernel.org
Mon Oct 7 04:05:31 PDT 2024


On Fri, 04 Oct 2024 12:07:11 +0100,
Joey Gouly <joey.gouly at arm.com> wrote:
> 
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index dad88e31f953..8b1a6cedc49e 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -544,6 +544,14 @@ static bool trap_oslar_el1(struct kvm_vcpu *vcpu,
>  	return true;
>  }
>  
> +static bool trap_mpam(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
> +		      const struct sys_reg_desc *r)
> +{
> +	kvm_inject_undefined(vcpu);
> +
> +	return false;
> +}
> +

I have recently been hunting down re-implementations of undef_access()
(see commit cd08d3216fc4), and this another case of such duplication.
Can we stick to this one, given that we have no plan to expose MPAM to
guests in the foreseeable future?

>  static bool trap_oslsr_el1(struct kvm_vcpu *vcpu,
>  			   struct sys_reg_params *p,
>  			   const struct sys_reg_desc *r)
> @@ -2517,8 +2525,11 @@ static const struct sys_reg_desc sys_reg_descs[] = {
>  	{ SYS_DESC(SYS_LOREA_EL1), trap_loregion },
>  	{ SYS_DESC(SYS_LORN_EL1), trap_loregion },
>  	{ SYS_DESC(SYS_LORC_EL1), trap_loregion },
> +	{ SYS_DESC(SYS_MPAMIDR_EL1), trap_mpam },
>  	{ SYS_DESC(SYS_LORID_EL1), trap_loregion },
>  
> +	{ SYS_DESC(SYS_MPAM1_EL1), trap_mpam },
> +	{ SYS_DESC(SYS_MPAM0_EL1), trap_mpam },
>  	{ SYS_DESC(SYS_VBAR_EL1), access_rw, reset_val, VBAR_EL1, 0 },
>  	{ SYS_DESC(SYS_DISR_EL1), NULL, reset_val, DISR_EL1, 0 },
>  

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list