aboutsummaryrefslogtreecommitdiff
path: root/hw/intc
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2025-06-06 14:30:26 +0800
committerSong Gao <gaosong@loongson.cn>2025-06-19 15:48:22 +0800
commit5b0e05b9023793197b82fd6feb275459adc9e10c (patch)
tree201c9b46ad1f87ad4ec2630d83df838d45352f02 /hw/intc
parentf936caa315750406f50feb1ac9c93770b47ebe96 (diff)
downloadqemu-5b0e05b9023793197b82fd6feb275459adc9e10c.zip
qemu-5b0e05b9023793197b82fd6feb275459adc9e10c.tar.gz
qemu-5b0e05b9023793197b82fd6feb275459adc9e10c.tar.bz2
hw/intc/loongarch_pch_msi: Inject MSI interrupt to kernel
If kvm_irqchip_in_kernel() return true, MSI interrupt can be injected with API kvm_irqchip_send_msi() to KVM. Reviewed-by: Song Gao <gaosong@loongson.cn> Signed-off-by: Bibo Mao <maobibo@loongson.cn> Message-ID: <20250606063033.2557365-7-maobibo@loongson.cn> Signed-off-by: Song Gao <gaosong@loongson.cn>
Diffstat (limited to 'hw/intc')
-rw-r--r--hw/intc/loongarch_pch_msi.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/intc/loongarch_pch_msi.c b/hw/intc/loongarch_pch_msi.c
index 06eb944..f6d1631 100644
--- a/hw/intc/loongarch_pch_msi.c
+++ b/hw/intc/loongarch_pch_msi.c
@@ -13,6 +13,7 @@
#include "hw/pci/msi.h"
#include "hw/misc/unimp.h"
#include "migration/vmstate.h"
+#include "system/kvm.h"
#include "trace.h"
static uint64_t loongarch_msi_mem_read(void *opaque, hwaddr addr, unsigned size)
@@ -26,6 +27,15 @@ static void loongarch_msi_mem_write(void *opaque, hwaddr addr,
LoongArchPCHMSI *s = (LoongArchPCHMSI *)opaque;
int irq_num;
+ if (kvm_irqchip_in_kernel()) {
+ MSIMessage msg;
+
+ msg.address = addr;
+ msg.data = val;
+ kvm_irqchip_send_msi(kvm_state, msg);
+ return;
+ }
+
/*
* vector number is irq number from upper extioi intc
* need subtract irq base to get msi vector offset