]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: arm64: Preserve host MPAM configuration when changing traps
authorBen Horgan <ben.horgan@arm.com>
Fri, 13 Mar 2026 14:45:41 +0000 (14:45 +0000)
committerJames Morse <james.morse@arm.com>
Fri, 27 Mar 2026 15:27:32 +0000 (15:27 +0000)
commiteda1cd1f9d29b382a07d757cf8b29f9ee636355f
tree68423cf034ac478d99be321799b69b0c341e1739
parent29fa1be82b83f87e603ed4c21fe86c6e05fd0282
KVM: arm64: Preserve host MPAM configuration when changing traps

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.

Tested-by: Gavin Shan <gshan@redhat.com>
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Peter Newman <peternewman@google.com>
Tested-by: Zeng Heng <zengheng4@huawei.com>
Tested-by: Punit Agrawal <punit.agrawal@oss.qualcomm.com>
Tested-by: Jesse Chick <jessechick@os.amperecomputing.com>
Reviewed-by: Zeng Heng <zengheng4@huawei.com>
Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
arch/arm64/kvm/hyp/include/hyp/switch.h