[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260203214342.584712-13-ben.horgan@arm.com>
Date: Tue, 3 Feb 2026 21:43:13 +0000
From: Ben Horgan <ben.horgan@....com>
To: ben.horgan@....com
Cc: amitsinght@...vell.com,
baisheng.gao@...soc.com,
baolin.wang@...ux.alibaba.com,
carl@...amperecomputing.com,
dave.martin@....com,
david@...nel.org,
dfustini@...libre.com,
fenghuay@...dia.com,
gshan@...hat.com,
james.morse@....com,
jonathan.cameron@...wei.com,
kobak@...dia.com,
lcherian@...vell.com,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
peternewman@...gle.com,
punit.agrawal@....qualcomm.com,
quic_jiles@...cinc.com,
reinette.chatre@...el.com,
rohit.mathew@....com,
scott@...amperecomputing.com,
sdonthineni@...dia.com,
tan.shaopeng@...itsu.com,
xhao@...ux.alibaba.com,
catalin.marinas@....com,
will@...nel.org,
corbet@....net,
maz@...nel.org,
oupton@...nel.org,
joey.gouly@....com,
suzuki.poulose@....com,
kvmarm@...ts.linux.dev,
zengheng4@...wei.com,
linux-doc@...r.kernel.org,
Shaopeng Tan <tan.shaopeng@...fujitsu.com>
Subject: [PATCH v4 12/41] KVM: arm64: Use kernel-space partid configuration for hypercalls
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.
Tested-by: Gavin Shan <gshan@...hat.com>
Tested-by: Shaopeng Tan <tan.shaopeng@...fujitsu.com>
Tested-by: Peter Newman <peternewman@...gle.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>
Signed-off-by: Ben Horgan <ben.horgan@....com>
---
Changes since v2:
Use mask
Use read_sysreg_el1 to cope with hvhe
Changes since v3:
Set MPAM2_EL2.MPAMEN to 1 as we rely on that before and after
---
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
index a7c689152f68..b25a5ddb9cf0 100644
--- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c
+++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
@@ -635,6 +635,15 @@ 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;
+ u64 val = MPAM2_EL2_MPAMEN | (read_sysreg_el1(SYS_MPAM1) & mask);
+
+ write_sysreg_s(val, SYS_MPAM2_EL2);
+ isb();
+ }
+
/*
* If pKVM has been initialised then reject any calls to the
* early "privileged" hypercalls. Note that we cannot reject
--
2.43.0
Powered by blists - more mailing lists