* [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement
@ 2025-02-10 9:36 Bibo Mao
2025-02-10 9:36 ` [PATCH v2 1/7] hw/intc/loongarch_ipi: Add basic hotplug framework Bibo Mao
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Bibo Mao @ 2025-02-10 9:36 UTC (permalink / raw)
To: Song Gao; +Cc: Jiaxun Yang, qemu-devel
Interrupt controller ipi and extioi on LoongArch system can send
intterrupt to multiple CPUs, physical cpu id is used to route interrupt
for CPUs.
With cpu hotplug feature in future, notification with ipi and extioi
interrupt controller is required. Since there is common Notifier API for
CPU hotplug, cpu hotplug interface is added on ipi and extioi class for
notification usage.
With CPU hotplug event notfication, gpio irq line is connected to cpu irq
line, and irq routing for irqchip is setup.
---
v1 .. v2:
1. Combine patchset ipi and extioi irq routing enhancement together
2. Rebase patch based on latest version
---
Bibo Mao (7):
hw/intc/loongarch_ipi: Add basic hotplug framework
hw/intc/loongarch_ipi: Implment cpu hotplug interface
hw/intc/loongarch_ipi: Notify ipi object when cpu is plugged
hw/intc/loongarch_extioi: Move gpio irq initial to common code
hw/intc/loongarch_extioi: Add basic hotplug framework
hw/intc/loongarch_extioi: Implment cpu hotplug interface
hw/intc/loongarch_extioi: Use cpu plug notification
hw/intc/loongarch_extioi.c | 8 +--
hw/intc/loongarch_extioi_common.c | 84 ++++++++++++++++++++++++++++++-
hw/intc/loongarch_ipi.c | 71 ++++++++++++++++++++++++++
hw/loongarch/virt.c | 17 ++-----
4 files changed, 159 insertions(+), 21 deletions(-)
--
2.39.3
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/7] hw/intc/loongarch_ipi: Add basic hotplug framework
2025-02-10 9:36 [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement Bibo Mao
@ 2025-02-10 9:36 ` Bibo Mao
2025-02-10 9:36 ` [PATCH v2 2/7] hw/intc/loongarch_ipi: Implment cpu hotplug interface Bibo Mao
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Bibo Mao @ 2025-02-10 9:36 UTC (permalink / raw)
To: Song Gao; +Cc: Jiaxun Yang, qemu-devel
LoongArch ipi can send interrupt to multiple CPUs, interrupt routing
to CPU comes from destination physical cpu id. Here hotplug interface
is added for IPI object, so that parent irq line can be connected, and
routing table can be added for new created cpu.
Here only basic hotplug framework is added, it is stub function.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
hw/intc/loongarch_ipi.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/hw/intc/loongarch_ipi.c b/hw/intc/loongarch_ipi.c
index 5376f1e084..90bbb7ac6e 100644
--- a/hw/intc/loongarch_ipi.c
+++ b/hw/intc/loongarch_ipi.c
@@ -6,6 +6,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "hw/boards.h"
#include "qapi/error.h"
#include "hw/intc/loongarch_ipi.h"
@@ -76,9 +77,34 @@ static void loongarch_ipi_realize(DeviceState *dev, Error **errp)
}
}
+static void loongarch_ipi_cpu_plug(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ Object *obj = OBJECT(dev);
+
+ if (!object_dynamic_cast(obj, TYPE_LOONGARCH_CPU)) {
+ warn_report("LoongArch extioi: Invalid %s device type",
+ object_get_typename(obj));
+ return;
+ }
+}
+
+static void loongarch_ipi_cpu_unplug(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ Object *obj = OBJECT(dev);
+
+ if (!object_dynamic_cast(obj, TYPE_LOONGARCH_CPU)) {
+ warn_report("LoongArch extioi: Invalid %s device type",
+ object_get_typename(obj));
+ return;
+ }
+}
+
static void loongarch_ipi_class_init(ObjectClass *klass, void *data)
{
LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_CLASS(klass);
+ HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
LoongarchIPIClass *lic = LOONGARCH_IPI_CLASS(klass);
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -86,6 +112,8 @@ static void loongarch_ipi_class_init(ObjectClass *klass, void *data)
&lic->parent_realize);
licc->get_iocsr_as = get_iocsr_as;
licc->cpu_by_arch_id = loongarch_cpu_by_arch_id;
+ hc->plug = loongarch_ipi_cpu_plug;
+ hc->unplug = loongarch_ipi_cpu_unplug;
}
static const TypeInfo loongarch_ipi_types[] = {
@@ -95,6 +123,10 @@ static const TypeInfo loongarch_ipi_types[] = {
.instance_size = sizeof(LoongarchIPIState),
.class_size = sizeof(LoongarchIPIClass),
.class_init = loongarch_ipi_class_init,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_HOTPLUG_HANDLER },
+ { }
+ },
}
};
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/7] hw/intc/loongarch_ipi: Implment cpu hotplug interface
2025-02-10 9:36 [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement Bibo Mao
2025-02-10 9:36 ` [PATCH v2 1/7] hw/intc/loongarch_ipi: Add basic hotplug framework Bibo Mao
@ 2025-02-10 9:36 ` Bibo Mao
2025-02-10 9:36 ` [PATCH v2 3/7] hw/intc/loongarch_ipi: Notify ipi object when cpu is plugged Bibo Mao
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Bibo Mao @ 2025-02-10 9:36 UTC (permalink / raw)
To: Song Gao; +Cc: Jiaxun Yang, qemu-devel
Add logic cpu allocation and cpu mapping with cpu hotplug interface.
When cpu is added, connect ipi gpio irq to CPU IRQ_IPI irq pin.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
hw/intc/loongarch_ipi.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/hw/intc/loongarch_ipi.c b/hw/intc/loongarch_ipi.c
index 90bbb7ac6e..b10641dd03 100644
--- a/hw/intc/loongarch_ipi.c
+++ b/hw/intc/loongarch_ipi.c
@@ -49,6 +49,22 @@ static int loongarch_cpu_by_arch_id(LoongsonIPICommonState *lics,
return MEMTX_ERROR;
}
+static IPICore *loongarch_ipi_get_cpu(LoongsonIPICommonState *lics,
+ DeviceState *dev)
+{
+ CPUClass *k = CPU_GET_CLASS(dev);
+ uint64_t arch_id = k->get_arch_id(CPU(dev));
+ int i;
+
+ for (i = 0; i < lics->num_cpu; i++) {
+ if (lics->cpu[i].arch_id == arch_id) {
+ return &lics->cpu[i];
+ }
+ }
+
+ return NULL;
+}
+
static void loongarch_ipi_realize(DeviceState *dev, Error **errp)
{
LoongsonIPICommonState *lics = LOONGSON_IPI_COMMON(dev);
@@ -80,25 +96,48 @@ static void loongarch_ipi_realize(DeviceState *dev, Error **errp)
static void loongarch_ipi_cpu_plug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
+ LoongsonIPICommonState *lics = LOONGSON_IPI_COMMON(hotplug_dev);
Object *obj = OBJECT(dev);
+ IPICore *core;
+ int index;
if (!object_dynamic_cast(obj, TYPE_LOONGARCH_CPU)) {
warn_report("LoongArch extioi: Invalid %s device type",
object_get_typename(obj));
return;
}
+
+ core = loongarch_ipi_get_cpu(lics, dev);
+ if (!core) {
+ return;
+ }
+
+ core->cpu = CPU(dev);
+ index = core - lics->cpu;
+
+ /* connect ipi irq to cpu irq */
+ qdev_connect_gpio_out(DEVICE(lics), index, qdev_get_gpio_in(dev, IRQ_IPI));
}
static void loongarch_ipi_cpu_unplug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
+ LoongsonIPICommonState *lics = LOONGSON_IPI_COMMON(hotplug_dev);
Object *obj = OBJECT(dev);
+ IPICore *core;
if (!object_dynamic_cast(obj, TYPE_LOONGARCH_CPU)) {
warn_report("LoongArch extioi: Invalid %s device type",
object_get_typename(obj));
return;
}
+
+ core = loongarch_ipi_get_cpu(lics, dev);
+ if (!core) {
+ return;
+ }
+
+ core->cpu = NULL;
}
static void loongarch_ipi_class_init(ObjectClass *klass, void *data)
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 3/7] hw/intc/loongarch_ipi: Notify ipi object when cpu is plugged
2025-02-10 9:36 [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement Bibo Mao
2025-02-10 9:36 ` [PATCH v2 1/7] hw/intc/loongarch_ipi: Add basic hotplug framework Bibo Mao
2025-02-10 9:36 ` [PATCH v2 2/7] hw/intc/loongarch_ipi: Implment cpu hotplug interface Bibo Mao
@ 2025-02-10 9:36 ` Bibo Mao
2025-02-10 9:36 ` [PATCH v2 4/7] hw/intc/loongarch_extioi: Move gpio irq initial to common code Bibo Mao
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Bibo Mao @ 2025-02-10 9:36 UTC (permalink / raw)
To: Song Gao; +Cc: Jiaxun Yang, qemu-devel
Use hotplug_handler_plug() to nofity ipi object when cold-plug
cpu is created, so that ipi can set and configure irq routing
to new cpu.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
hw/loongarch/virt.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index f2aa0a9782..ad1467c6f8 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -325,6 +325,7 @@ static void virt_cpu_irq_init(LoongArchVirtMachineState *lvms)
MachineClass *mc = MACHINE_GET_CLASS(ms);
const CPUArchIdList *possible_cpus;
CPUState *cs;
+ Error *err = NULL;
/* cpu nodes */
possible_cpus = mc->possible_cpu_arch_ids(ms);
@@ -334,9 +335,7 @@ static void virt_cpu_irq_init(LoongArchVirtMachineState *lvms)
continue;
}
- /* connect ipi irq to cpu irq */
- qdev_connect_gpio_out(lvms->ipi, num,
- qdev_get_gpio_in(DEVICE(cs), IRQ_IPI));
+ hotplug_handler_plug(HOTPLUG_HANDLER(lvms->ipi), DEVICE(cs), &err);
/*
* connect ext irq to the cpu irq
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 4/7] hw/intc/loongarch_extioi: Move gpio irq initial to common code
2025-02-10 9:36 [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement Bibo Mao
` (2 preceding siblings ...)
2025-02-10 9:36 ` [PATCH v2 3/7] hw/intc/loongarch_ipi: Notify ipi object when cpu is plugged Bibo Mao
@ 2025-02-10 9:36 ` Bibo Mao
2025-02-10 9:36 ` [PATCH v2 5/7] hw/intc/loongarch_extioi: Add basic hotplug framework Bibo Mao
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Bibo Mao @ 2025-02-10 9:36 UTC (permalink / raw)
To: Song Gao; +Cc: Jiaxun Yang, qemu-devel
When cpu is added, it will connect gpio irq line to cpu irq.
And cpu hot-add is put in common code, move gpio irq initial
part into common code.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
hw/intc/loongarch_extioi.c | 8 +-------
hw/intc/loongarch_extioi_common.c | 6 +++++-
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/hw/intc/loongarch_extioi.c b/hw/intc/loongarch_extioi.c
index f3055ec4d2..a51a215e6e 100644
--- a/hw/intc/loongarch_extioi.c
+++ b/hw/intc/loongarch_extioi.c
@@ -343,7 +343,7 @@ static void loongarch_extioi_realize(DeviceState *dev, Error **errp)
LoongArchExtIOIClass *lec = LOONGARCH_EXTIOI_GET_CLASS(dev);
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
Error *local_err = NULL;
- int i, pin;
+ int i;
lec->parent_realize(dev, &local_err);
if (local_err) {
@@ -368,12 +368,6 @@ static void loongarch_extioi_realize(DeviceState *dev, Error **errp)
} else {
s->status |= BIT(EXTIOI_ENABLE);
}
-
- for (i = 0; i < s->num_cpu; i++) {
- for (pin = 0; pin < LS3A_INTC_IP; pin++) {
- qdev_init_gpio_out(dev, &s->cpu[i].parent_irq[pin], 1);
- }
- }
}
static void loongarch_extioi_unrealize(DeviceState *dev)
diff --git a/hw/intc/loongarch_extioi_common.c b/hw/intc/loongarch_extioi_common.c
index fd56253d10..e3a38b318a 100644
--- a/hw/intc/loongarch_extioi_common.c
+++ b/hw/intc/loongarch_extioi_common.c
@@ -16,7 +16,7 @@ static void loongarch_extioi_common_realize(DeviceState *dev, Error **errp)
MachineState *machine = MACHINE(qdev_get_machine());
MachineClass *mc = MACHINE_GET_CLASS(machine);
const CPUArchIdList *id_list;
- int i;
+ int i, pin;
assert(mc->possible_cpu_arch_ids);
id_list = mc->possible_cpu_arch_ids(machine);
@@ -30,6 +30,10 @@ static void loongarch_extioi_common_realize(DeviceState *dev, Error **errp)
for (i = 0; i < s->num_cpu; i++) {
s->cpu[i].arch_id = id_list->cpus[i].arch_id;
s->cpu[i].cpu = CPU(id_list->cpus[i].cpu);
+
+ for (pin = 0; pin < LS3A_INTC_IP; pin++) {
+ qdev_init_gpio_out(dev, &s->cpu[i].parent_irq[pin], 1);
+ }
}
}
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 5/7] hw/intc/loongarch_extioi: Add basic hotplug framework
2025-02-10 9:36 [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement Bibo Mao
` (3 preceding siblings ...)
2025-02-10 9:36 ` [PATCH v2 4/7] hw/intc/loongarch_extioi: Move gpio irq initial to common code Bibo Mao
@ 2025-02-10 9:36 ` Bibo Mao
2025-02-10 9:36 ` [PATCH v2 6/7] hw/intc/loongarch_extioi: Implment cpu hotplug interface Bibo Mao
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Bibo Mao @ 2025-02-10 9:36 UTC (permalink / raw)
To: Song Gao; +Cc: Jiaxun Yang, qemu-devel
LoongArch extioi interrupt controller routes peripheral interrupt
to multiple CPUs, physical cpu id is used in interrupt routing table.
Here hotplug interface is added for extioi object, so that parent irq
line can be connected, and routing table can be added for new created
cpu.
Here only basic hotplug framework is added, it is stub function.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
hw/intc/loongarch_extioi_common.c | 33 +++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/hw/intc/loongarch_extioi_common.c b/hw/intc/loongarch_extioi_common.c
index e3a38b318a..19e19a9f73 100644
--- a/hw/intc/loongarch_extioi_common.c
+++ b/hw/intc/loongarch_extioi_common.c
@@ -4,11 +4,37 @@
* Copyright (C) 2024 Loongson Technology Corporation Limited
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "qemu/module.h"
#include "qapi/error.h"
#include "hw/qdev-properties.h"
#include "hw/intc/loongarch_extioi_common.h"
#include "migration/vmstate.h"
+#include "target/loongarch/cpu.h"
+
+static void loongarch_extioi_cpu_plug(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ Object *obj = OBJECT(dev);
+
+ if (!object_dynamic_cast(obj, TYPE_LOONGARCH_CPU)) {
+ warn_report("LoongArch extioi: Invalid %s device type",
+ object_get_typename(obj));
+ return;
+ }
+}
+
+static void loongarch_extioi_cpu_unplug(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ Object *obj = OBJECT(dev);
+
+ if (!object_dynamic_cast(obj, TYPE_LOONGARCH_CPU)) {
+ warn_report("LoongArch extioi: Invalid %s device type",
+ object_get_typename(obj));
+ return;
+ }
+}
static void loongarch_extioi_common_realize(DeviceState *dev, Error **errp)
{
@@ -107,11 +133,14 @@ static void loongarch_extioi_common_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
LoongArchExtIOICommonClass *lecc = LOONGARCH_EXTIOI_COMMON_CLASS(klass);
+ HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
device_class_set_parent_realize(dc, loongarch_extioi_common_realize,
&lecc->parent_realize);
device_class_set_props(dc, extioi_properties);
dc->vmsd = &vmstate_loongarch_extioi;
+ hc->plug = loongarch_extioi_cpu_plug;
+ hc->unplug = loongarch_extioi_cpu_unplug;
}
static const TypeInfo loongarch_extioi_common_types[] = {
@@ -121,6 +150,10 @@ static const TypeInfo loongarch_extioi_common_types[] = {
.instance_size = sizeof(LoongArchExtIOICommonState),
.class_size = sizeof(LoongArchExtIOICommonClass),
.class_init = loongarch_extioi_common_class_init,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_HOTPLUG_HANDLER },
+ { }
+ },
.abstract = true,
}
};
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 6/7] hw/intc/loongarch_extioi: Implment cpu hotplug interface
2025-02-10 9:36 [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement Bibo Mao
` (4 preceding siblings ...)
2025-02-10 9:36 ` [PATCH v2 5/7] hw/intc/loongarch_extioi: Add basic hotplug framework Bibo Mao
@ 2025-02-10 9:36 ` Bibo Mao
2025-02-10 9:36 ` [PATCH v2 7/7] hw/intc/loongarch_extioi: Use cpu plug notification Bibo Mao
2025-02-10 10:41 ` [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement Philippe Mathieu-Daudé
7 siblings, 0 replies; 9+ messages in thread
From: Bibo Mao @ 2025-02-10 9:36 UTC (permalink / raw)
To: Song Gao; +Cc: Jiaxun Yang, qemu-devel
When cpu is added, connect extioi gpio irq to CPU irq pin.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
hw/intc/loongarch_extioi_common.c | 45 +++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/hw/intc/loongarch_extioi_common.c b/hw/intc/loongarch_extioi_common.c
index 19e19a9f73..ff3974f2a1 100644
--- a/hw/intc/loongarch_extioi_common.c
+++ b/hw/intc/loongarch_extioi_common.c
@@ -12,28 +12,73 @@
#include "migration/vmstate.h"
#include "target/loongarch/cpu.h"
+static ExtIOICore *loongarch_extioi_get_cpu(LoongArchExtIOICommonState *s,
+ DeviceState *dev)
+{
+ CPUClass *k = CPU_GET_CLASS(dev);
+ uint64_t arch_id = k->get_arch_id(CPU(dev));
+ int i;
+
+ for (i = 0; i < s->num_cpu; i++) {
+ if (s->cpu[i].arch_id == arch_id) {
+ return &s->cpu[i];
+ }
+ }
+
+ return NULL;
+}
+
static void loongarch_extioi_cpu_plug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
+ LoongArchExtIOICommonState *s = LOONGARCH_EXTIOI_COMMON(hotplug_dev);
Object *obj = OBJECT(dev);
+ ExtIOICore *core;
+ int pin, index;
if (!object_dynamic_cast(obj, TYPE_LOONGARCH_CPU)) {
warn_report("LoongArch extioi: Invalid %s device type",
object_get_typename(obj));
return;
}
+
+ core = loongarch_extioi_get_cpu(s, dev);
+ if (!core) {
+ return;
+ }
+
+ core->cpu = CPU(dev);
+ index = core - s->cpu;
+
+ /*
+ * connect extioi irq to the cpu irq
+ * cpu_pin[LS3A_INTC_IP + 2 : 2] <= intc_pin[LS3A_INTC_IP : 0]
+ */
+ for (pin = 0; pin < LS3A_INTC_IP; pin++) {
+ qdev_connect_gpio_out(DEVICE(s), index * LS3A_INTC_IP + pin,
+ qdev_get_gpio_in(dev, pin + 2));
+ }
}
static void loongarch_extioi_cpu_unplug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
+ LoongArchExtIOICommonState *s = LOONGARCH_EXTIOI_COMMON(hotplug_dev);
Object *obj = OBJECT(dev);
+ ExtIOICore *core;
if (!object_dynamic_cast(obj, TYPE_LOONGARCH_CPU)) {
warn_report("LoongArch extioi: Invalid %s device type",
object_get_typename(obj));
return;
}
+
+ core = loongarch_extioi_get_cpu(s, dev);
+ if (!core) {
+ return;
+ }
+
+ core->cpu = NULL;
}
static void loongarch_extioi_common_realize(DeviceState *dev, Error **errp)
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 7/7] hw/intc/loongarch_extioi: Use cpu plug notification
2025-02-10 9:36 [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement Bibo Mao
` (5 preceding siblings ...)
2025-02-10 9:36 ` [PATCH v2 6/7] hw/intc/loongarch_extioi: Implment cpu hotplug interface Bibo Mao
@ 2025-02-10 9:36 ` Bibo Mao
2025-02-10 10:41 ` [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement Philippe Mathieu-Daudé
7 siblings, 0 replies; 9+ messages in thread
From: Bibo Mao @ 2025-02-10 9:36 UTC (permalink / raw)
To: Song Gao; +Cc: Jiaxun Yang, qemu-devel
Use hotplug_handler_plug() to nofity extioi object when cold-plug
cpu is created, so that extioi can set and configure irq routing
to new cpu.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
hw/loongarch/virt.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index ad1467c6f8..355be14ccc 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -320,7 +320,7 @@ static void virt_devices_init(DeviceState *pch_pic,
static void virt_cpu_irq_init(LoongArchVirtMachineState *lvms)
{
- int num, pin;
+ int num;
MachineState *ms = MACHINE(lvms);
MachineClass *mc = MACHINE_GET_CLASS(ms);
const CPUArchIdList *possible_cpus;
@@ -336,15 +336,7 @@ static void virt_cpu_irq_init(LoongArchVirtMachineState *lvms)
}
hotplug_handler_plug(HOTPLUG_HANDLER(lvms->ipi), DEVICE(cs), &err);
-
- /*
- * connect ext irq to the cpu irq
- * cpu_pin[9:2] <= intc_pin[7:0]
- */
- for (pin = 0; pin < LS3A_INTC_IP; pin++) {
- qdev_connect_gpio_out(lvms->extioi, (num * LS3A_INTC_IP + pin),
- qdev_get_gpio_in(DEVICE(cs), pin + 2));
- }
+ hotplug_handler_plug(HOTPLUG_HANDLER(lvms->extioi), DEVICE(cs), &err);
}
}
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement
2025-02-10 9:36 [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement Bibo Mao
` (6 preceding siblings ...)
2025-02-10 9:36 ` [PATCH v2 7/7] hw/intc/loongarch_extioi: Use cpu plug notification Bibo Mao
@ 2025-02-10 10:41 ` Philippe Mathieu-Daudé
7 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-02-10 10:41 UTC (permalink / raw)
To: Bibo Mao, Song Gao; +Cc: Jiaxun Yang, qemu-devel, Igor Mammedov
Cc'ing Igor for vCPU hotplugging expertise.
On 10/2/25 10:36, Bibo Mao wrote:
> Interrupt controller ipi and extioi on LoongArch system can send
> intterrupt to multiple CPUs, physical cpu id is used to route interrupt
> for CPUs.
>
> With cpu hotplug feature in future, notification with ipi and extioi
> interrupt controller is required. Since there is common Notifier API for
> CPU hotplug, cpu hotplug interface is added on ipi and extioi class for
> notification usage.
>
> With CPU hotplug event notfication, gpio irq line is connected to cpu irq
> line, and irq routing for irqchip is setup.
>
> ---
> v1 .. v2:
> 1. Combine patchset ipi and extioi irq routing enhancement together
> 2. Rebase patch based on latest version
> ---
> Bibo Mao (7):
> hw/intc/loongarch_ipi: Add basic hotplug framework
> hw/intc/loongarch_ipi: Implment cpu hotplug interface
> hw/intc/loongarch_ipi: Notify ipi object when cpu is plugged
> hw/intc/loongarch_extioi: Move gpio irq initial to common code
> hw/intc/loongarch_extioi: Add basic hotplug framework
> hw/intc/loongarch_extioi: Implment cpu hotplug interface
> hw/intc/loongarch_extioi: Use cpu plug notification
>
> hw/intc/loongarch_extioi.c | 8 +--
> hw/intc/loongarch_extioi_common.c | 84 ++++++++++++++++++++++++++++++-
> hw/intc/loongarch_ipi.c | 71 ++++++++++++++++++++++++++
> hw/loongarch/virt.c | 17 ++-----
> 4 files changed, 159 insertions(+), 21 deletions(-)
>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-02-10 10:41 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10 9:36 [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement Bibo Mao
2025-02-10 9:36 ` [PATCH v2 1/7] hw/intc/loongarch_ipi: Add basic hotplug framework Bibo Mao
2025-02-10 9:36 ` [PATCH v2 2/7] hw/intc/loongarch_ipi: Implment cpu hotplug interface Bibo Mao
2025-02-10 9:36 ` [PATCH v2 3/7] hw/intc/loongarch_ipi: Notify ipi object when cpu is plugged Bibo Mao
2025-02-10 9:36 ` [PATCH v2 4/7] hw/intc/loongarch_extioi: Move gpio irq initial to common code Bibo Mao
2025-02-10 9:36 ` [PATCH v2 5/7] hw/intc/loongarch_extioi: Add basic hotplug framework Bibo Mao
2025-02-10 9:36 ` [PATCH v2 6/7] hw/intc/loongarch_extioi: Implment cpu hotplug interface Bibo Mao
2025-02-10 9:36 ` [PATCH v2 7/7] hw/intc/loongarch_extioi: Use cpu plug notification Bibo Mao
2025-02-10 10:41 ` [PATCH v2 0/7] hw/loongarch/virt: CPU irq routing enhancement Philippe Mathieu-Daudé
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).