Re: [PATCH v3 04/47] KVM: arm64: Preserve host MPAM configuration when changing traps

Gavin Shan
2026-01-15T02:33:50Z

On 1/13/26 12:58 AM, Ben Horgan wrote:
> When kvm enables or disables MPAM traps to EL2 it clears all other bits in
> MPAM2_EL2. Notably, it clears the partition ids (PARTIDs) and performance
> monitoring groups (PMGs). Avoid changing these bits in anticipation of
> adding support for MPAM in the kernel. Otherwise, on a VHE system with the
> host running at EL2 where MPAM2_EL2 and MPAM1_EL1 access the same register,
> any attempt to use MPAM to monitor or partition resources for kernel space
> would be foiled by running a KVM guest. Additionally, MPAM2_EL2.EnMPAMSM is
> always set to 0 which causes MPAMSM_EL1 to always trap. Keep EnMPAMSM set
> to 1 when not in a guest so that the kernel can use MPAMSM_EL1.
>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
> ---
> arch/arm64/kvm/hyp/include/hyp/switch.h | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>

Reviewed-by: Gavin Shan <gshan@redhat.com>