summary refs log tree commit diff stats
path: root/hw/intc/loongarch_ipi.c
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2025-06-06 14:30:30 +0800
committerSong Gao <gaosong@loongson.cn>2025-06-19 15:52:35 +0800
commitc642ddf19b248bb668e40a8d15089b877e4057fa (patch)
treee6df9db7b9b7f819cb83ba8512fe515fb03d1c62 /hw/intc/loongarch_ipi.c
parent0dd6798a1adda03dcfa6304437faa8e62a193d9c (diff)
downloadfocaccia-qemu-c642ddf19b248bb668e40a8d15089b877e4057fa.tar.gz
focaccia-qemu-c642ddf19b248bb668e40a8d15089b877e4057fa.zip
hw/loongarch/virt: Add reset support for kernel irqchip
When system reboot, interrupt controller is restored to initial
state. However if interrupt controller extioi/ipi/pch_pic is
emulated in kernel, it should notify kvm to do so. Here suspend
and restore API is used for reset, set initial state in qemu user
space and restore API is used to notify kvm to reload register
state.

Reviewed-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Message-ID: <20250606063033.2557365-11-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
Diffstat (limited to 'hw/intc/loongarch_ipi.c')
-rw-r--r--hw/intc/loongarch_ipi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/intc/loongarch_ipi.c b/hw/intc/loongarch_ipi.c
index 0ea91ea054..fc8005c944 100644
--- a/hw/intc/loongarch_ipi.c
+++ b/hw/intc/loongarch_ipi.c
@@ -122,6 +122,10 @@ static void loongarch_ipi_reset_hold(Object *obj, ResetType type)
         core->clear = 0;
         memset(core->buf, 0, sizeof(core->buf));
     }
+
+    if (kvm_irqchip_in_kernel()) {
+        kvm_ipi_put(obj, 0);
+    }
 }
 
 static void loongarch_ipi_cpu_plug(HotplugHandler *hotplug_dev,