[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220809074522.2444672-1-chenhuacai@loongson.cn>
Date: Tue, 9 Aug 2022 15:45:22 +0800
From: Huacai Chen <chenhuacai@...ngson.cn>
To: Huacai Chen <chenhuacai@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Marc Zyngier <maz@...nel.org>, linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org, Xuerui Wang <kernel@...0n.name>,
Xuefeng Li <lixuefeng@...ngson.cn>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
Huacai Chen <chenhuacai@...ngson.cn>
Subject: [PATCH] LoongArch: Don't disable EIOINTC master core
This patch fix a CPU hotplug issue. The EIOINTC master core (the first
core of an EIOINTC node) should not be disabled at runtime, since it has
the responsibility of dispatching I/O interrupts.
Signed-off-by: Huacai Chen <chenhuacai@...ngson.cn>
---
arch/loongarch/kernel/smp.c | 9 +++++++++
drivers/irqchip/irq-loongson-eiointc.c | 5 +++++
2 files changed, 14 insertions(+)
diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c
index 09743103d9b3..54901716f8de 100644
--- a/arch/loongarch/kernel/smp.c
+++ b/arch/loongarch/kernel/smp.c
@@ -242,9 +242,18 @@ void loongson3_smp_finish(void)
static bool io_master(int cpu)
{
+ int i, node, master;
+
if (cpu == 0)
return true;
+ for (i = 1; i < loongson_sysconf.nr_io_pics; i++) {
+ node = eiointc_get_node(i);
+ master = cpu_number_map(node * CORES_PER_EIO_NODE);
+ if (cpu == master)
+ return true;
+ }
+
return false;
}
diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c
index 170dbc96c7d3..6c99a2ff95f5 100644
--- a/drivers/irqchip/irq-loongson-eiointc.c
+++ b/drivers/irqchip/irq-loongson-eiointc.c
@@ -56,6 +56,11 @@ static void eiointc_enable(void)
iocsr_write64(misc, LOONGARCH_IOCSR_MISC_FUNC);
}
+int eiointc_get_node(int id)
+{
+ return eiointc_priv[id]->node;
+}
+
static int cpu_to_eio_node(int cpu)
{
return cpu_logical_map(cpu) / CORES_PER_EIO_NODE;
--
2.31.1
Powered by blists - more mailing lists