This patchset adds pv ipi support for VM. On physical machine, ipi HW uses IOCSR registers, however there will be trap into hypervisor with IOCSR registers access. This patch uses SWI interrupt for IPI notification. During ipi sending with hypercall method, there is still one trap; however with SWI interrupt handler there is no trap. This patch passes to runltp testcases, and unixbench score is 99% of that on physical machine on 3C5000 single way machine. Here is unixbench score with 16 cores on 3C5000 single way machine. ----------------UnixBench score on 3C5000 machine with 16 cores -------- Dhrystone 2 using register variables 116700.0 339749961.8 29113.1 Double-Precision Whetstone 55.0 57716.9 10494.0 Execl Throughput 43.0 33563.4 7805.4 File Copy 1024 bufsize 2000 maxblocks 3960.0 1017912.5 2570.5 File Copy 256 bufsize 500 maxblocks 1655.0 260061.4 1571.4 File Copy 4096 bufsize 8000 maxblocks 5800.0 3216109.4 5545.0 Pipe Throughput 12440.0 18404312.0 14794.5 Pipe-based Context Switching 4000.0 3395856.2 8489.6 Process Creation 126.0 55684.8 4419.4 Shell Scripts (1 concurrent) 42.4 55901.8 13184.4 Shell Scripts (8 concurrent) 6.0 7396.5 12327.5 System Call Overhead 15000.0 6997351.4 4664.9 System Benchmarks Index Score 7288.6 ----------------UnixBench score on VM with 16 cores ----------------- Dhrystone 2 using register variables 116700.0 341649555.5 29275.9 Double-Precision Whetstone 55.0 57490.9 10452.9 Execl Throughput 43.0 33663.8 7828.8 File Copy 1024 bufsize 2000 maxblocks 3960.0 1047631.2 2645.5 File Copy 256 bufsize 500 maxblocks 1655.0 286671.0 1732.2 File Copy 4096 bufsize 8000 maxblocks 5800.0 3243588.2 5592.4 Pipe Throughput 12440.0 16353087.8 13145.6 Pipe-based Context Switching 4000.0 3100690.0 7751.7 Process Creation 126.0 51502.1 4087.5 Shell Scripts (1 concurrent) 42.4 56665.3 13364.4 Shell Scripts (8 concurrent) 6.0 7412.1 12353.4 System Call Overhead 15000.0 6962239.6 4641.5 System Benchmarks Index Score 7205.8 Bibo Mao (5): LoongArch: KVM: Add hypercall instruction emulation support LoongArch: KVM: Add cpucfg area for kvm hypervisor LoongArch/smp: Refine ipi ops on LoongArch platform LoongArch: Add paravirt interface for guest kernel LoongArch: Add pv ipi support on LoongArch system arch/loongarch/Kconfig | 7 + arch/loongarch/include/asm/Kbuild | 1 - arch/loongarch/include/asm/hardirq.h | 5 + arch/loongarch/include/asm/inst.h | 1 + arch/loongarch/include/asm/irq.h | 10 +- arch/loongarch/include/asm/kvm_para.h | 157 ++++++++++++++++++ arch/loongarch/include/asm/loongarch.h | 10 ++ arch/loongarch/include/asm/paravirt.h | 27 +++ .../include/asm/paravirt_api_clock.h | 1 + arch/loongarch/include/asm/smp.h | 31 ++-- arch/loongarch/include/uapi/asm/Kbuild | 2 - arch/loongarch/kernel/Makefile | 1 + arch/loongarch/kernel/irq.c | 24 +-- arch/loongarch/kernel/paravirt.c | 144 ++++++++++++++++ arch/loongarch/kernel/perf_event.c | 14 +- arch/loongarch/kernel/setup.c | 2 + arch/loongarch/kernel/smp.c | 61 ++++--- arch/loongarch/kernel/time.c | 12 +- arch/loongarch/kvm/exit.c | 118 +++++++++++-- 19 files changed, 527 insertions(+), 101 deletions(-) create mode 100644 arch/loongarch/include/asm/kvm_para.h create mode 100644 arch/loongarch/include/asm/paravirt.h create mode 100644 arch/loongarch/include/asm/paravirt_api_clock.h delete mode 100644 arch/loongarch/include/uapi/asm/Kbuild create mode 100644 arch/loongarch/kernel/paravirt.c base-commit: 610a9b8f49fbcf1100716370d3b5f6f884a2835a -- 2.39.3