LoongArch: KVM: Remove kvm_acquire_timer() before entering guest
authorBibo Mao <maobibo@loongson.cn>
Tue, 19 Dec 2023 02:48:28 +0000 (10:48 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Tue, 19 Dec 2023 02:48:28 +0000 (10:48 +0800)
commit1ab9c6099495f79bfbcd6058d02d7556034a89b0
tree14e7f88e5d27e2cb1e221650393e80bb9d63c4a0
parent0d2abe67029644741bf7400b0d00c2faa3e1c455
LoongArch: KVM: Remove kvm_acquire_timer() before entering guest

Timer emulation method in VM is switch to SW timer, there are two
places where timer emulation is needed. One is during vcpu thread
context switch, the other is halt-polling with idle instruction
emulation. SW timer switching is removed during halt-polling mode,
so it is not necessary to disable SW timer before entering to guest.

This patch removes SW timer handling before entering guest mode, and
put it in HW timer restoring flow when vcpu thread is sched-in. With
this patch, vm timer emulation is simpler, there is SW/HW timer
switch only in vcpu thread context switch scenario.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/include/asm/kvm_vcpu.h
arch/loongarch/kvm/timer.c
arch/loongarch/kvm/vcpu.c