[PATCH v3 13/47] KVM: arm64: Use kernel-space partid configuration for hypercalls
Marc Zyngier
maz at kernel.org
Wed Jan 14 04:09:14 PST 2026
On Mon, 12 Jan 2026 16:58:40 +0000,
Ben Horgan <ben.horgan at arm.com> wrote:
>
> On nVHE systems whether or not MPAM is enabled, EL2 continues to use
> partid-0 for hypercalls, even when the host may have configured its kernel
> threads to use a different partid. 0 may have been assigned to another
> task. Copy the EL1 MPAM register to EL2. This ensures hypercalls use the
> same partid as the kernel thread does on the host.
>
> Signed-off-by: Ben Horgan <ben.horgan at arm.com>
> ---
> Changes since v2:
> Use mask
> Use read_sysreg_el1 to cope with hvhe
> ---
> arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
> index a7c689152f68..ad99d8a73a9e 100644
> --- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c
> +++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
> @@ -635,6 +635,14 @@ static void handle_host_hcall(struct kvm_cpu_context *host_ctxt)
> unsigned long hcall_min = 0;
> hcall_t hfn;
>
> + if (system_supports_mpam()) {
> + u64 mask = MPAM1_EL1_PARTID_D | MPAM1_EL1_PARTID_I |
> + MPAM1_EL1_PMG_D | MPAM1_EL1_PMG_I;
> +
> + write_sysreg_s(read_sysreg_el1(SYS_MPAM1) & mask, SYS_MPAM2_EL2);
> + isb();
> + }
Is it really OK to not preserve the rest of MPAM2_EL2? This explicitly
clears MPAM2_EL2.MPAMEN, which feels counter-productive.
M.
--
Without deviation from the norm, progress is not possible.
More information about the linux-arm-kernel
mailing list