qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH V2 0/5] Added Interrupt controller emulation for loongarch kvm
@ 2024-09-10 12:18 Xianglai Li
  2024-09-10 12:18 ` [RFC PATCH V2 1/5] include: Add macro definitions needed for interrupt controller kvm emulation Xianglai Li
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Xianglai Li @ 2024-09-10 12:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Song Gao, Jiaxun Yang, Huacai Chen,
	Michael S. Tsirkin, Cornelia Huck, kvm, Bibo Mao

Before this, the interrupt controller simulation has been completed
in the user mode program. In order to reduce the loss caused by frequent
switching of the virtual machine monitor from kernel mode to user mode
when the guest accesses the interrupt controller, we add the interrupt
controller simulation in kvm.

In qemu side implementation is simple, just make a new IPI EXTIOI PCH KVM
related several classes, And the interface to access kvm related data is
implemented.

Most of the simulation work of the interrupt controller is done in kvm.
Because KVM the changes have not been the Linux community acceptance,
the patches of this series will have RFC label until KVM patch into the community.

For the implementation of kvm simulation, refer to the following documents.

IPI simulation implementation reference:
https://github.com/loongson/LoongArch-Documentation/tree/main/docs/Loongson-3A5000-usermanual-EN/inter-processor-interrupts-and-communication

EXTIOI simulation implementation reference:
https://github.com/loongson/LoongArch-Documentation/tree/main/docs/Loongson-3A5000-usermanual-EN/io-interrupts/extended-io-interrupts

PCH-PIC simulation implementation reference:
https://github.com/loongson/LoongArch-Documentation/blob/main/docs/Loongson-7A1000-usermanual-EN/interrupt-controller.adoc

For PCH-MSI, we used irqfd mechanism to send the interrupt signal
generated by user state to kernel state and then to EXTIOI without
maintaining PCH-MSI state in kernel state.

You can easily get the code from the link below:
the kernel:
https://github.com/lixianglai/linux
the branch is: interrupt

the qemu:
https://github.com/lixianglai/qemu
the branch is: interrupt

Please note that the code above is regularly updated based on community
reviews.

changelog:
V1->V2
1.Make changes involving header files a separate patch
2.rebase based on the latest qemu code
3.Optimize the kvm ipi class into the ipi common class and the ipi kvm
class.
4.Optimized the interface for kernel reading and writing data on ipi
extioi pch_pic device.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Song Gao <gaosong@loongson.cn>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: kvm@vger.kernel.org
Cc: Bibo Mao <maobibo@loongson.cn>
Cc: Xianglai Li <lixianglai@loongson.cn>

Xianglai Li (5):
  include: Add macro definitions needed for interrupt controller kvm
    emulation
  hw/loongarch: Add KVM IPI device support
  hw/loongarch: Add KVM extioi device support
  hw/loongarch: Add KVM pch pic device support
  hw/loongarch: Add KVM pch msi device support

 hw/intc/Kconfig                       |   9 +
 hw/intc/loongarch_extioi_kvm.c        | 250 ++++++++++++++++++++++++++
 hw/intc/loongarch_ipi_kvm.c           | 128 +++++++++++++
 hw/intc/loongarch_pch_msi.c           |  42 +++--
 hw/intc/loongarch_pch_pic.c           |  40 +++--
 hw/intc/loongarch_pch_pic_kvm.c       | 180 +++++++++++++++++++
 hw/intc/loongson_ipi_common.c         |  28 +++
 hw/intc/meson.build                   |   3 +
 hw/loongarch/Kconfig                  |   3 +
 hw/loongarch/virt.c                   | 138 ++++++++------
 include/hw/intc/loongarch_extioi.h    |  38 +++-
 include/hw/intc/loongarch_ipi.h       |  15 ++
 include/hw/intc/loongarch_pch_pic.h   |  58 +++++-
 include/hw/intc/loongson_ipi.h        |   1 -
 include/hw/intc/loongson_ipi_common.h |   2 +
 include/hw/loongarch/virt.h           |  15 ++
 linux-headers/asm-loongarch/kvm.h     |  18 ++
 linux-headers/linux/kvm.h             |   6 +
 18 files changed, 891 insertions(+), 83 deletions(-)
 create mode 100644 hw/intc/loongarch_extioi_kvm.c
 create mode 100644 hw/intc/loongarch_ipi_kvm.c
 create mode 100644 hw/intc/loongarch_pch_pic_kvm.c

-- 
2.39.1



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-09-14  7:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-10 12:18 [RFC PATCH V2 0/5] Added Interrupt controller emulation for loongarch kvm Xianglai Li
2024-09-10 12:18 ` [RFC PATCH V2 1/5] include: Add macro definitions needed for interrupt controller kvm emulation Xianglai Li
2024-09-10 13:49   ` Cornelia Huck
2024-09-11  1:16     ` lixianglai
2024-09-12 14:13   ` Jiaxun Yang
2024-09-10 12:18 ` [RFC PATCH V2 2/5] hw/loongarch: Add KVM IPI device support Xianglai Li
2024-09-10 12:18 ` [RFC PATCH V2 3/5] hw/loongarch: Add KVM extioi " Xianglai Li
2024-09-12  3:25   ` maobibo
2024-09-10 12:18 ` [RFC PATCH V2 4/5] hw/loongarch: Add KVM pch pic " Xianglai Li
2024-09-13  9:20   ` maobibo
2024-09-10 12:18 ` [RFC PATCH V2 5/5] hw/loongarch: Add KVM pch msi " Xianglai Li
2024-09-14  7:38   ` maobibo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).