From nobody Sat Apr 11 17:09:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF90DC19F2D for ; Tue, 9 Aug 2022 07:45:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239651AbiHIHpw (ORCPT ); Tue, 9 Aug 2022 03:45:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240009AbiHIHpk (ORCPT ); Tue, 9 Aug 2022 03:45:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD16EB481; Tue, 9 Aug 2022 00:45:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 82119B811C0; Tue, 9 Aug 2022 07:45:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B18DBC433D6; Tue, 9 Aug 2022 07:45:33 +0000 (UTC) From: Huacai Chen To: Huacai Chen Cc: Thomas Gleixner , Marc Zyngier , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Xuerui Wang , Xuefeng Li , Jiaxun Yang , Huacai Chen Subject: [PATCH] LoongArch: Don't disable EIOINTC master core Date: Tue, 9 Aug 2022 15:45:22 +0800 Message-Id: <20220809074522.2444672-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- 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) =20 static bool io_master(int cpu) { + int i, node, master; + if (cpu =3D=3D 0) return true; =20 + for (i =3D 1; i < loongson_sysconf.nr_io_pics; i++) { + node =3D eiointc_get_node(i); + master =3D cpu_number_map(node * CORES_PER_EIO_NODE); + if (cpu =3D=3D master) + return true; + } + return false; } =20 diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-l= oongson-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); } =20 +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; --=20 2.31.1