LoongArch: KVM: Reload guest CSR registers after sleep

On host, the HW guest CSR registers are lost after suspend and resume
operation. Since last_vcpu of boot CPU still records latest vCPU pointer
so that the guest CSR register skips to reload when boot CPU resumes and
vCPU is scheduled.

Here last_vcpu is cleared so that guest CSR registers will reload from
scheduled vCPU context after suspend and resume.

Cc: stable@vger.kernel.org
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>

authored by Bibo Mao and committed by Huacai Chen 78d7bc5a 6fb1867d

+7
+7
arch/loongarch/kvm/main.c
··· 317 kvm_debug("GCFG:%lx GSTAT:%lx GINTC:%lx GTLBC:%lx", 318 read_csr_gcfg(), read_csr_gstat(), read_csr_gintc(), read_csr_gtlbc()); 319 320 return 0; 321 } 322
··· 317 kvm_debug("GCFG:%lx GSTAT:%lx GINTC:%lx GTLBC:%lx", 318 read_csr_gcfg(), read_csr_gstat(), read_csr_gintc(), read_csr_gtlbc()); 319 320 + /* 321 + * HW Guest CSR registers are lost after CPU suspend and resume. 322 + * Clear last_vcpu so that Guest CSR registers forced to reload 323 + * from vCPU SW state. 324 + */ 325 + this_cpu_ptr(vmcs)->last_vcpu = NULL; 326 + 327 return 0; 328 } 329