]> www.infradead.org Git - users/jedix/linux-maple.git/commit
LoongArch: KVM: Fully clear some CSRs when VM reboot
authorBibo Mao <maobibo@loongson.cn>
Thu, 24 Apr 2025 12:15:52 +0000 (20:15 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Sat, 26 Apr 2025 01:58:13 +0000 (09:58 +0800)
commit9ea86232a5520d9d21832d06031ea80f055a6ff8
tree9ba8eda88f60d8dacea3dff6dd7f53bbb2f8351d
parent8b2d01fec800081dd68271c01e4d239ef4d7115e
LoongArch: KVM: Fully clear some CSRs when VM reboot

Some registers such as LOONGARCH_CSR_ESTAT and LOONGARCH_CSR_GINTC are
partly cleared with function _kvm_setcsr(). This comes from the hardware
specification, some bits are read only in VM mode, and however they can
be written in host mode. So they are partly cleared in VM mode, and can
be fully cleared in host mode.

These read only bits show pending interrupt or exception status. When VM
reset, the read-only bits should be cleared, otherwise vCPU will receive
unknown interrupts in boot stage.

Here registers LOONGARCH_CSR_ESTAT/LOONGARCH_CSR_GINTC are fully cleared
in ioctl KVM_REG_LOONGARCH_VCPU_RESET vCPU reset path.

Cc: stable@vger.kernel.org
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/kvm/vcpu.c