Message ID | 20230324060854.29375-2-lvjianmin@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp405498vqo; Thu, 23 Mar 2023 23:13:29 -0700 (PDT) X-Google-Smtp-Source: AK7set8L83Hy+I/P+rF9ywODLutx56pigmjoAvWAmE1odwrasWDoKidVJgrARYYzksT48lkHr7Pg X-Received: by 2002:a05:6402:22eb:b0:4ea:a9b0:a518 with SMTP id dn11-20020a05640222eb00b004eaa9b0a518mr7812020edb.17.1679638409073; Thu, 23 Mar 2023 23:13:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679638409; cv=none; d=google.com; s=arc-20160816; b=d3rgki30VXKR1S3dwy5dPXnSUZ8XWb9C5AjW6e8IeLJoJtIZcogPtUpoUEk/+3f9/N p9n1P/3kewnGfRur8TGfVlQUv1gTnuRuKAeBNnJDOd8vlQUDLyHozXYSOiq7BdXLABGm E7unko1vEGQK1GhjHyi+QXNJO2PugpeupJaKBto02gDlS00yKXkgeIkdBWfe1/1386Vw W2XkLGM7Sz2tGIoPGAeU1RUerV6C8xyw2QWvjiJ+dv1iieYnZhdQcedQDBX6szUeViEO FfXjXDQP3vKGPqql4e+Y1mMofgq0o/KHDQKGyeMZrCJLSfoGobDcQOO+hOIgEEUClg41 7FxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=do/dQZUYtoPT2DIcsi1g1Nwcuh6fVqSgymoYxirmU5U=; b=y6QZYokIHvBiPIR8BmsROQSbVyqePfyAhNtoKoG9DulabEQw14ldFFou09EqUmnt/i 2Xhk8IZuvZ9QmZ3sRIMalCbdtPfNfb+a1NCovluhTuvlPe/EEINHGsSzeYZKnJjnfBTb xbewMSvT6q46elV+S7TCtyBIgIiH2Kct99DlBDpnQOkoE3wLXyUhsJSU+p7BKvQgKFf+ 8xJrswDa0WAT/LNO87vC/X+OSdaqRs2RseWVExpN70N20n5DSare9lw4vKCxfhynJtMP K6dQ1ncl9AGaJbUg2olw2nHFpKG/ruU31+6iWvDgOohdCzaNs3mdW29CwX+RP9TgrL0Y YyMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t26-20020aa7d4da000000b004acb712d32csi6711196edr.233.2023.03.23.23.13.05; Thu, 23 Mar 2023 23:13:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231580AbjCXGJH (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Fri, 24 Mar 2023 02:09:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231128AbjCXGJB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 24 Mar 2023 02:09:01 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DB5361554F for <linux-kernel@vger.kernel.org>; Thu, 23 Mar 2023 23:08:59 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.153]) by gateway (Coremail) with SMTP id _____8DxUOV6Ph1kQZwQAA--.25232S3; Fri, 24 Mar 2023 14:08:58 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.42.153]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Axmr12Ph1kY_QKAA--.2874S3; Fri, 24 Mar 2023 14:08:58 +0800 (CST) From: Jianmin Lv <lvjianmin@loongson.cn> To: Thomas Gleixner <tglx@linutronix.de>, Marc Zyngier <maz@kernel.org> Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Huacai Chen <chenhuacai@loongson.cn>, loongson-kernel@lists.loongnix.cn Subject: [PATCH V1 1/5] irqchip/loongson-eiointc: Fix returned value on parsing MADT Date: Fri, 24 Mar 2023 14:08:50 +0800 Message-Id: <20230324060854.29375-2-lvjianmin@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230324060854.29375-1-lvjianmin@loongson.cn> References: <20230324060854.29375-1-lvjianmin@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Axmr12Ph1kY_QKAA--.2874S3 X-CM-SenderInfo: 5oymxthqpl0qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBjvJXoW7trWkZF45Kw48uF4rtFWkJFb_yoW8Aryxpa y7ArZ8tr4Yy3yxCr1ktas8Xry5Z39xuayxtFWrG3yFvr1DCrWUJF4fA3Wj9rn2yFWUG3Wj vF4Fqa15ua15A3DanT9S1TB71UUUUjDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bSxYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JFv_Jw1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l n4kS14v26r126r1DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6x ACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E 87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxV Aaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxY O2xFxVAFwI0_JF0_Jw1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGV WUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_ Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rV WUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4U JbIYCTnIWIevJa73UjIFyTuYvjxUFwIDUUUUU X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761228524444107192?= X-GMAIL-MSGID: =?utf-8?q?1761228524444107192?= |
Series |
Fix some issues of irq controllers for dual-bridges scenario
|
|
Commit Message
吕建民
March 24, 2023, 6:08 a.m. UTC
In pch_pic_parse_madt(), a NULL parent pointer will be
returned from acpi_get_vec_parent() for second pch-pic domain
related to second bridge while calling eiointc_acpi_init() at
first time, where the parent of it has not been initialized
yet, and will be initialized during second time calling
eiointc_acpi_init(). So, it's reasonable to return zero so
that failure of acpi_table_parse_madt() will be avoided, or else
acpi_cascade_irqdomain_init() will return and initialization of
followed pch_msi domain will be skipped.
Although it does not matter when pch_msi_parse_madt() returns
-EINVAL if no invalid parent is found, it's also reasonable to
return zero for that.
Change-Id: I4d278534999ec3e5c8db6d40155ba2665d9de86f
Signed-off-by: Jianmin Lv <lvjianmin@loongson.cn>
---
drivers/irqchip/irq-loongson-eiointc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Fri, 24 Mar 2023 06:08:50 +0000, Jianmin Lv <lvjianmin@loongson.cn> wrote: > > In pch_pic_parse_madt(), a NULL parent pointer will be > returned from acpi_get_vec_parent() for second pch-pic domain > related to second bridge while calling eiointc_acpi_init() at > first time, where the parent of it has not been initialized > yet, and will be initialized during second time calling > eiointc_acpi_init(). So, it's reasonable to return zero so > that failure of acpi_table_parse_madt() will be avoided, or else > acpi_cascade_irqdomain_init() will return and initialization of > followed pch_msi domain will be skipped. > > Although it does not matter when pch_msi_parse_madt() returns > -EINVAL if no invalid parent is found, it's also reasonable to > return zero for that. > > Change-Id: I4d278534999ec3e5c8db6d40155ba2665d9de86f > Signed-off-by: Jianmin Lv <lvjianmin@loongson.cn> > --- > drivers/irqchip/irq-loongson-eiointc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c > index d15fd38c1756..62a632d73991 100644 > --- a/drivers/irqchip/irq-loongson-eiointc.c > +++ b/drivers/irqchip/irq-loongson-eiointc.c > @@ -343,7 +343,7 @@ static int __init pch_pic_parse_madt(union acpi_subtable_headers *header, > if (parent) > return pch_pic_acpi_init(parent, pchpic_entry); > > - return -EINVAL; > + return 0; Why can't you detect this particular case instead of blindly suppressing the error? M.
On 2023/3/24 下午11:36, Marc Zyngier wrote: > On Fri, 24 Mar 2023 06:08:50 +0000, > Jianmin Lv <lvjianmin@loongson.cn> wrote: >> >> In pch_pic_parse_madt(), a NULL parent pointer will be >> returned from acpi_get_vec_parent() for second pch-pic domain >> related to second bridge while calling eiointc_acpi_init() at >> first time, where the parent of it has not been initialized >> yet, and will be initialized during second time calling >> eiointc_acpi_init(). So, it's reasonable to return zero so >> that failure of acpi_table_parse_madt() will be avoided, or else >> acpi_cascade_irqdomain_init() will return and initialization of >> followed pch_msi domain will be skipped. >> >> Although it does not matter when pch_msi_parse_madt() returns >> -EINVAL if no invalid parent is found, it's also reasonable to >> return zero for that. >> >> Change-Id: I4d278534999ec3e5c8db6d40155ba2665d9de86f >> Signed-off-by: Jianmin Lv <lvjianmin@loongson.cn> >> --- >> drivers/irqchip/irq-loongson-eiointc.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c >> index d15fd38c1756..62a632d73991 100644 >> --- a/drivers/irqchip/irq-loongson-eiointc.c >> +++ b/drivers/irqchip/irq-loongson-eiointc.c >> @@ -343,7 +343,7 @@ static int __init pch_pic_parse_madt(union acpi_subtable_headers *header, >> if (parent) >> return pch_pic_acpi_init(parent, pchpic_entry); >> >> - return -EINVAL; >> + return 0; > > Why can't you detect this particular case instead of blindly > suppressing the error? > For dual-bridges scenario, parent handle for pch_pic IRQ domain will be set by acpi_set_vec_parent() during each eiointc initialization. And the parent handle for one pch_pic will be set during *first* eiointc entry parsing, and the parent handle for another pch_pic will be set during *second* eiointc entry parsing. But two pch_pic entries will be parsed during each eiointc entry parsing, so a NULL parent pointer must be returned druing first eiointc initialization, which is reasonable and should not be treated as an error. The calling stack of pch_pic_parse_madt (where acpi_get_vec_parent is called to get parent handle) is like this: cpuintc_acpi_init acpi_cascade_irqdomain_init(in cpuintc driver) acpi_table_parse_madt eiointc_parse_madt eiointc_acpi_init /* this will be called two times corresponding to parsing two eiointc entries in MADT under dual-bridges scenario*/ acpi_set_vec_parent /* set parent handle for one pch_pic during first eiointc entry parsing, and set parent handle for another pch_pic during second eiointc entry parsing*/ acpi_cascade_irqdomain_init(in eiointc driver) acpi_table_parse_madt pch_pic_parse_madt /* this will be called twice because of two pchpic entries, and only one valid parent handle will be returned from acpi_get_vec_parent() during first eiointc entry parsing (another parent handle is not set yet), so a NULL parent pointer must be returned during first eiointc entry parsing, which is reasonable and should not be treated as an error.*/ Thanks! > M. >
diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c index d15fd38c1756..62a632d73991 100644 --- a/drivers/irqchip/irq-loongson-eiointc.c +++ b/drivers/irqchip/irq-loongson-eiointc.c @@ -343,7 +343,7 @@ static int __init pch_pic_parse_madt(union acpi_subtable_headers *header, if (parent) return pch_pic_acpi_init(parent, pchpic_entry); - return -EINVAL; + return 0; } static int __init pch_msi_parse_madt(union acpi_subtable_headers *header, @@ -355,7 +355,7 @@ static int __init pch_msi_parse_madt(union acpi_subtable_headers *header, if (parent) return pch_msi_acpi_init(parent, pchmsi_entry); - return -EINVAL; + return 0; } static int __init acpi_cascade_irqdomain_init(void)