在 2025/6/6 下午2:30, Bibo Mao 写道:
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. With reset function, register and software state is initialized
      in qemu user space and set to KVM kernel with ioctl command.
   4. 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().

---
v2 ... v3:
   1. Implement reset function with kernel irqchip device, initialize the
      registers and set to KVM kernel.
   2. Use register offset address rather base address in function
      kvm_pch_pic_save_load().
   3. Rename kvm_xxx_save_load() with kvm_xxx_access().
   4. Rename kvm_xxx_pre_save() with kvm_xxx_get(), kvm_xxx_post_load()
      with kvm_xxx_put().
   5. Macro KVM_IRQCHIP_NUM_PINS defined in UAPI header file is used
      kvm_loongarch_init_irq_routing(), which means the maxinium irq line
      number.

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 (13):
   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
   hw/intc/loongarch_pch: Add kernel irqchip save and restore function
   hw/intc/loongarch_pch: Inject irq line interrupt to kernel
   hw/loongarch/virt: Add reset support for kernel irqchip
   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
hi,

This series looks good to me. I will apply to loongarch.nexts
Reviewed-by: Song Gao <gaos...@loongson.cn>

Thanks.
Son Gao
  hw/intc/loongarch_extioi.c             |  49 ++++++---
  hw/intc/loongarch_extioi_kvm.c         | 140 +++++++++++++++++++++++++
  hw/intc/loongarch_ipi.c                |  29 +++++
  hw/intc/loongarch_ipi_kvm.c            |  85 +++++++++++++++
  hw/intc/loongarch_pch_msi.c            |  10 ++
  hw/intc/loongarch_pch_pic.c            |  45 +++++++-
  hw/intc/loongarch_pic_kvm.c            |  89 ++++++++++++++++
  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, 552 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: 09be8a511a2e278b45729d7b065d30c68dd699d0


Reply via email to