]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
LoongArch: KVM: Move host CSR_GSTAT save and restore in context switch
authorBibo Mao <maobibo@loongson.cn>
Thu, 9 Apr 2026 10:56:36 +0000 (18:56 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Thu, 9 Apr 2026 10:56:36 +0000 (18:56 +0800)
commitaac656857e9f008a014ac9d58aab66e8fc803604
tree8f3dd6e5a90ba7dcdbc822c6fb142f6d52e34e26
parentf62eb9ca8def410bcef39e8909945409d0968473
LoongArch: KVM: Move host CSR_GSTAT save and restore in context switch

CSR register LOONGARCH_CSR_GSTAT stores guest VMID information. With
existing implementation method, VMID is per vCPU, similar with ASID in
kernel. LOONGARCH_CSR_GSTAT is written at VM entry even if VMID is not
changed.

Here move LOONGARCH_CSR_GSTAT save/restore in vCPU context switch, and
update LOONGARCH_CSR_GSTAT only when VMID is updated at VM entry. At
most time VM enter/exit is much more frequent than vCPU thread context
switch.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/kvm/main.c
arch/loongarch/kvm/vcpu.c