Commit 689cbe75 authored by James Morse's avatar James Morse Committed by Zeng Heng
Browse files

untested: KVM: arm64: Force guest EL1 to use user-space's partid configuration

maillist inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8T2RT

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git/log/?h=mpam/snapshot/v6.7-rc2



---------------------------

While we trap the guest's attempts to read/write the MPAM control registers,
these remain in effect. guest-EL0 uses KVM's user-space's configuration,
as the value is left in the register, and guest-EL1 uses either the host
kernel's configuration, or in the case of VHE, the unknown reset value of
MPAM1_EL1.

On nVHE systems, EL2 continues to use partid-0 for world-switch, even
when the host may have configured its kernel threads to use a different
partid. 0 may have been assigned to another task.

We want to force the guest-EL1 to use KVM's user-space's MPAM configuration.

On a nVHE system, copy the EL1 MPAM register to EL2. This ensures
world-switch uses the same partid as the kernel thread does on the host.

When loading the guests EL1 registers, copy the VMM's EL0 partid to
the EL1 register. When restoring the hosts registers, the partid
previously copied to EL2 can be used to restore EL1.

For VHE systems, we can skip restoring the EL1 register for the host,
as it is out-of-context once HCR_EL2.TGE is set.

This is done outside the usual sysreg save/restore as the values can
change behind KVMs back, so should not be stored in the guest context.

Signed-off-by: default avatarJames Morse <james.morse@arm.com>
Signed-off-by: default avatarZeng Heng <zengheng4@huawei.com>
parent 5cd0dad6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment