From mboxrd@z Thu Jan 1 00:00:00 1970 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 D17B2C6FD20 for ; Fri, 24 Mar 2023 15:34:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232291AbjCXPes (ORCPT ); Fri, 24 Mar 2023 11:34:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232038AbjCXPeV (ORCPT ); Fri, 24 Mar 2023 11:34:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D41591DB9B for ; Fri, 24 Mar 2023 08:34:13 -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 87DB6B82521 for ; Fri, 24 Mar 2023 15:34:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40422C4339E; Fri, 24 Mar 2023 15:34:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679672051; bh=c1GJ178dbtFcDJeY4wYI58g4hBLah/8oQTpGD/PF/+U=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kJu3KeRtRCZTSwAtXO9Sqi2IQG1yh03Evu5bxRfuEGyOUzqdPWhed7oKHkWd3ZOuZ fztqPULouwQCgH5Mn6D1xoKC+Tko80Isj4VcGxRGk2P74o/lUYBDINb9AXbQptmerd kWFmlyH/iqWLgdFe1Cvoy9anAZQ1qTU4xFyA/2YZP4kikW0zjDOfz48hAKOPx7Atkv dwnCCNsUq2o2jLvH7FS/5LZ6ipyZWm4ilNfO3Rwfg03xqHLQGz0b71fNBXtKyHLl/P xl3zcKn7PtJVB31mx8kWrcSRPacs7J/NUwBciku6cxE8675IRaoaXf9Peh8sPcyArF GTowZ3AwMflZQ== Received: from [104.132.96.108] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pfjQe-002rBP-Qd; Fri, 24 Mar 2023 15:34:09 +0000 Date: Fri, 24 Mar 2023 15:34:05 +0000 Message-ID: <87ileqgo42.wl-maz@kernel.org> From: Marc Zyngier To: Jianmin Lv Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Lorenzo Pieralisi , Jiaxun Yang , Huacai Chen , loongson-kernel@lists.loongnix.cn Subject: Re: [PATCH V1 2/5] irqchip/loongson-eiointc: Fix incorrect use of acpi_get_vec_parent In-Reply-To: <20230324060854.29375-3-lvjianmin@loongson.cn> References: <20230324060854.29375-1-lvjianmin@loongson.cn> <20230324060854.29375-3-lvjianmin@loongson.cn> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 104.132.96.108 X-SA-Exim-Rcpt-To: lvjianmin@loongson.cn, tglx@linutronix.de, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, lorenzo.pieralisi@arm.com, jiaxun.yang@flygoat.com, chenhuacai@loongson.cn, loongson-kernel@lists.loongnix.cn X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 24 Mar 2023 06:08:51 +0000, Jianmin Lv wrote: > > In eiointc_acpi_init(), a *eiointc* node is passed into > acpi_get_vec_parent() instead of a required *NUMA* node (on some chip > like 3C5000L, a *NUMA* node means a *eiointc* node, but on some chip > like 3C5000, a *NUMA* node contains 4 *eiointc* nodes), and node in > struct acpi_vector_group is essentially a *NUMA* node, which will > lead to no parent matched for passed *eiointc* node. so the patch > adjusts code to use *NUMA* node for parameter node of > acpi_set_vec_parent/acpi_get_vec_parent. > > Change-Id: Iddd8423f9694cadc1ce28ee290c2e98ca17dfccc > Signed-off-by: Jianmin Lv > --- > drivers/irqchip/irq-loongson-eiointc.c | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c > index 62a632d73991..b165c27a3609 100644 > --- a/drivers/irqchip/irq-loongson-eiointc.c > +++ b/drivers/irqchip/irq-loongson-eiointc.c > @@ -280,9 +280,6 @@ static void acpi_set_vec_parent(int node, struct irq_domain *parent, struct acpi > { > int i; > > - if (cpu_has_flatmode) > - node = cpu_to_node(node * CORES_PER_EIO_NODE); > - > for (i = 0; i < MAX_IO_PICS; i++) { > if (node == vec_group[i].node) { > vec_group[i].parent = parent; > @@ -349,8 +346,13 @@ static int __init pch_pic_parse_madt(union acpi_subtable_headers *header, > static int __init pch_msi_parse_madt(union acpi_subtable_headers *header, > const unsigned long end) > { > + struct irq_domain *parent; > struct acpi_madt_msi_pic *pchmsi_entry = (struct acpi_madt_msi_pic *)header; > - struct irq_domain *parent = acpi_get_vec_parent(eiointc_priv[nr_pics - 1]->node, msi_group); > + int node = eiointc_priv[nr_pics - 1]->node; > + > + if (cpu_has_flatmode) > + node = cpu_to_node(node * CORES_PER_EIO_NODE); This is a bit unreadable. I'd rather see: int node; if (cpu_has_flatmode) node = ....; else node = ....; which makes it easy to detect the use of an uninitialised 'node' rather than using the wrong default variable. > + parent = acpi_get_vec_parent(node, msi_group); > > if (parent) > return pch_msi_acpi_init(parent, pchmsi_entry); > @@ -379,6 +381,7 @@ int __init eiointc_acpi_init(struct irq_domain *parent, > int i, ret, parent_irq; > unsigned long node_map; > struct eiointc_priv *priv; > + int node = acpi_eiointc->node; > > priv = kzalloc(sizeof(*priv), GFP_KERNEL); > if (!priv) > @@ -421,8 +424,10 @@ int __init eiointc_acpi_init(struct irq_domain *parent, > "irqchip/loongarch/intc:starting", > eiointc_router_init, NULL); > > - acpi_set_vec_parent(acpi_eiointc->node, priv->eiointc_domain, pch_group); > - acpi_set_vec_parent(acpi_eiointc->node, priv->eiointc_domain, msi_group); > + if (cpu_has_flatmode) > + node = cpu_to_node(node * CORES_PER_EIO_NODE); > + acpi_set_vec_parent(node, priv->eiointc_domain, pch_group); > + acpi_set_vec_parent(node, priv->eiointc_domain, msi_group); > ret = acpi_cascade_irqdomain_init(); > > return ret; Same thing here. M. -- Without deviation from the norm, progress is not possible.