LoongArch: KVM: Add PV IPI support on guest side
authorBibo Mao <maobibo@loongson.cn>
Mon, 6 May 2024 14:00:47 +0000 (22:00 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Mon, 6 May 2024 14:00:47 +0000 (22:00 +0800)
commit74c16b2e2b0c3b193324f47300fd30cf03a606b7
treed44f09842b78696110c39849488eb5a4adf2e8d9
parente33bda7ee50c3c20d80f5ca6dc5ca2cd37863518
LoongArch: KVM: Add PV IPI support on guest side

PARAVIRT config option and PV IPI is added for the guest side, function
pv_ipi_init() is used to add IPI sending and IPI receiving hooks. This
function firstly checks whether system runs in VM mode, and if kernel
runs in VM mode, it will call function kvm_para_available() to detect
the current hypervirsor type (now only KVM type detection is supported).
The paravirt functions can work only if current hypervisor type is KVM,
since there is only KVM supported on LoongArch now.

PV IPI uses virtual IPI sender and virtual IPI receiver functions. With
virtual IPI sender, IPI message is stored in memory rather than emulated
HW. IPI multicast is also supported, and 128 vcpus can received IPIs
at the same time like X86 KVM method. Hypercall method is used for IPI
sending.

With virtual IPI receiver, HW SWI0 is used rather than real IPI HW.
Since VCPU has separate HW SWI0 like HW timer, there is no trap in IPI
interrupt acknowledge. Since IPI message is stored in memory, there is
no trap in getting IPI message.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/Kconfig
arch/loongarch/include/asm/hardirq.h
arch/loongarch/include/asm/paravirt.h [new file with mode: 0644]
arch/loongarch/include/asm/paravirt_api_clock.h [new file with mode: 0644]
arch/loongarch/kernel/Makefile
arch/loongarch/kernel/irq.c
arch/loongarch/kernel/paravirt.c [new file with mode: 0644]
arch/loongarch/kernel/smp.c