• Bibo Mao's avatar
    LoongArch: KVM: Add PV IPI support on host side · e33bda7e
    Bibo Mao authored
    On LoongArch system, IPI hw uses iocsr registers. There are one iocsr
    register access on IPI sending, and two iocsr access on IPI receiving
    for the IPI interrupt handler. In VM mode all iocsr accessing will cause
    VM to trap into hypervisor. So with one IPI hw notification there will
    be three times of trap.
    
    In this patch PV IPI is added for VM, hypercall instruction is used for
    IPI sender, and hypervisor will inject an SWI to the destination vcpu.
    During the SWI interrupt handler, only CSR.ESTAT register is written to
    clear irq. CSR.ESTAT register access will not trap into hypervisor, so
    with PV IPI supported, there is one trap with IPI sender, and no trap
    with IPI receiver, there is only one trap with IPI notification.
    
    Also this patch adds IPI multicast support, the method is similar with
    x86. With IPI multicast support, IPI notification can be sent to at
    most 128 vcpus at one time. It greatly reduces the times of trapping
    into hypervisor.
    Signed-off-by: default avatarBibo Mao <maobibo@loongson.cn>
    Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
    e33bda7e
loongarch.h 54.4 KB