[PATCH v2 00/12] hw/loongarch/virt: Add kernel irqchip support

Bibo Mao posted 12 patches 5 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250527084430.3468174-1-maobibo@loongson.cn
Maintainers: Song Gao <gaosong@loongson.cn>, Bibo Mao <maobibo@loongson.cn>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Huacai Chen <chenhuacai@kernel.org>
hw/intc/loongarch_extioi.c             |  45 ++++++--
hw/intc/loongarch_extioi_kvm.c         | 146 +++++++++++++++++++++++++
hw/intc/loongarch_ipi.c                |  25 +++++
hw/intc/loongarch_ipi_kvm.c            |  83 ++++++++++++++
hw/intc/loongarch_pch_msi.c            |  10 ++
hw/intc/loongarch_pch_pic.c            |  41 ++++++-
hw/intc/loongarch_pic_kvm.c            |  96 ++++++++++++++++
hw/intc/loongson_ipi_common.c          |  33 ++++++
hw/intc/meson.build                    |   6 +
hw/loongarch/virt.c                    |  65 +++++++----
include/hw/intc/loongarch_extioi.h     |   5 +
include/hw/intc/loongarch_ipi.h        |   5 +
include/hw/intc/loongarch_pch_pic.h    |   5 +
include/hw/intc/loongarch_pic_common.h |   1 +
include/hw/intc/loongson_ipi_common.h  |   2 +
target/loongarch/cpu.h                 |   1 +
target/loongarch/kvm/kvm.c             |  23 +++-
17 files changed, 551 insertions(+), 41 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_pic_kvm.c
[PATCH v2 00/12] hw/loongarch/virt: Add kernel irqchip support
Posted by Bibo Mao 5 months, 3 weeks ago
If kernel irqchip is set such as kvm_irqchip_in_kernel() return true, there
is special operations with irqchips in such fields:
  1. During irqchip object realization, kvm_create_device() is used here
     to create irqchip in KVM kernel.
  2. Add pre_save and post_load function, where register states can be
     get and set from KVM kernel.
  3. Interrupt injection to kernel, IRQ line interrupt is injected with
     API kvm_set_irq() and MSI interrupt is injected with API
     kvm_irqchip_send_msi().

---
v1 ... v2:
  1. Remove property irqchip-in-kernel with irqchip device driver, use
     global API kvm_irqchip_in_kernel() directly.
  2. Do not create memory map region if kernel irqchip is set.
  3. Modify copy and paste typo issue in kvm_arch_irqchip_create().
  4. Do not emulate MISC_FUNC_REG IOCSR register if kernel irqchip is
     set since it access EXTIOI memory region, this register need be
     emulated in kernel.
---
Bibo Mao (12):
  hw/intc/loongarch_extioi: Add kernel irqchip realize function
  hw/intc/loongarch_extioi: Add kernel irqchip save and restore function
  hw/intc/loongarch_ipi: Add kernel irqchip realize function
  hw/intc/loongson_ipi: Add load and save interface with ipi_common
    class
  hw/intc/loongarch_ipi: Add kernel irqchip save and restore function
  hw/intc/loongarch_pch_msi: Inject MSI interrupt to kernel
  hw/intc/loongarch_pch: Add kernel irqchip realize function
  ihw/intc/loongarch_pch: Add kernel irqchip save and restore function
  hw/intc/loongarch_pch: Inject irq line interrupt to kernel
  target/loongarch: Report error with split kernel_irqchip option
  hw/loongarch/virt: Disable emulation with IOCSR misc register
  hw/loongarch/virt: Add kernel irqchip support

 hw/intc/loongarch_extioi.c             |  45 ++++++--
 hw/intc/loongarch_extioi_kvm.c         | 146 +++++++++++++++++++++++++
 hw/intc/loongarch_ipi.c                |  25 +++++
 hw/intc/loongarch_ipi_kvm.c            |  83 ++++++++++++++
 hw/intc/loongarch_pch_msi.c            |  10 ++
 hw/intc/loongarch_pch_pic.c            |  41 ++++++-
 hw/intc/loongarch_pic_kvm.c            |  96 ++++++++++++++++
 hw/intc/loongson_ipi_common.c          |  33 ++++++
 hw/intc/meson.build                    |   6 +
 hw/loongarch/virt.c                    |  65 +++++++----
 include/hw/intc/loongarch_extioi.h     |   5 +
 include/hw/intc/loongarch_ipi.h        |   5 +
 include/hw/intc/loongarch_pch_pic.h    |   5 +
 include/hw/intc/loongarch_pic_common.h |   1 +
 include/hw/intc/loongson_ipi_common.h  |   2 +
 target/loongarch/cpu.h                 |   1 +
 target/loongarch/kvm/kvm.c             |  23 +++-
 17 files changed, 551 insertions(+), 41 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_pic_kvm.c


base-commit: 3c5a5e213e5f08fbfe70728237f7799ac70f5b99
-- 
2.39.3