summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2025-02-13 12:02:56 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-22 12:56:47 -0700
commitc43d5c749836d8f9ec98662202982131aabaa248 (patch)
tree7fb41c092a0abcbe2c1916b119a2d0012d3bfc66 /arch
parent03fa04cffc3bca565371067db90f513f7149b9c7 (diff)
downloadlinux-c43d5c749836d8f9ec98662202982131aabaa248.tar.gz
linux-c43d5c749836d8f9ec98662202982131aabaa248.tar.bz2
linux-c43d5c749836d8f9ec98662202982131aabaa248.zip
LoongArch: KVM: Set host with kernel mode when switch to VM mode
[ Upstream commit 3011b29ec5a33ec16502e687c4264d57416a8b1f ] PRMD register is only meaningful on the beginning stage of exception entry, and it is overwritten with nested irq or exception. When CPU runs in VM mode, interrupt need be enabled on host. And the mode for host had better be kernel mode rather than random or user mode. When VM is running, the running mode with top command comes from CRMD register, and running mode should be kernel mode since kernel function is executing with perf command. It needs be consistent with both top and perf command. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/loongarch/kvm/switch.S2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/loongarch/kvm/switch.S b/arch/loongarch/kvm/switch.S
index 0c292f818492..1be185e94807 100644
--- a/arch/loongarch/kvm/switch.S
+++ b/arch/loongarch/kvm/switch.S
@@ -85,7 +85,7 @@
* Guest CRMD comes from separate GCSR_CRMD register
*/
ori t0, zero, CSR_PRMD_PIE
- csrxchg t0, t0, LOONGARCH_CSR_PRMD
+ csrwr t0, LOONGARCH_CSR_PRMD
/* Set PVM bit to setup ertn to guest context */
ori t0, zero, CSR_GSTAT_PVM