From patchwork Fri Mar 31 11:38:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5ZCV5bu65rCR?= X-Patchwork-Id: 77755 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp498893vqo; Fri, 31 Mar 2023 04:46:59 -0700 (PDT) X-Google-Smtp-Source: AKy350YuqmonlBT0gFWdoZ332Q1wl6wchQUwIkqHAn5kv5mGdF9Vrf1kaKVE+VBRNMpAtnpCvuR/ X-Received: by 2002:a05:6402:4c:b0:4c0:1120:a15d with SMTP id f12-20020a056402004c00b004c01120a15dmr23779358edu.5.1680263218848; Fri, 31 Mar 2023 04:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680263218; cv=none; d=google.com; s=arc-20160816; b=NLW0cUSp3cGIh37iT1c2sZHfVLg100qVk/WwHbycHfn4VUrnNpn44N4JEHSnfFbRMx QBVKz+iGnxbW4co+bVcjTOeXtjGG6kh/Tz/rM6tHWtVopjkjjvYgqCbzZs77sKCIHtZh kdpc0vFlpuvkDxy/+qu8TCVr2e7k36fOOMBzeWieeQfZSYRxYWbiMUcSBIjSUeE576PK ViWM6J8nAhfSp9oXoPE/1lXJ0Q7IEkhya4h9CDrUJ3qztJ9x0iwOBkytB30AuIUIKiUH HQ5o93lKO6SUpK1BV7kxAXwCuNvRCTaYiki7QHj+ua0FRyW5aQUCqw/Q8h6+nZF4cWC4 3lxw== 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=pl//GWMEqKKziotV1+vGSG+ouIA0dfstyGcUNRMDCX4=; b=SmocwxfgvIwyGbtXWysAwvj/JnrYJGjjpc0c3BGm/gzrE6roxiYVcJp9qE3l70FF4y iYC8cGQRStvMLV4RrQ0Xz7sOVY1Ub+bizInLBv2tiev8ibbxHSvnBRYOVIjMqRw4SsoJ t+SvzC5wJvVK5wFX54ns8hP4dx63NFiBl7L18tDHetBCB7oHe8gGv2i7/A68U8payBH8 Pyh2ajKh2VecMfzUm8Fi+8FyH+M/KzGXFOoymPYqDWQTtfdvk9DD4HT59LWJfjDK5HA4 O726dFPg8YKcDEWKrgkTYrJjewX/Ie/qmsTX/iXUt1USlj/S8W3go+X48rn+UDTtx5/e keYg== 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 x26-20020aa7cd9a000000b0050270e743d4si1953352edv.590.2023.03.31.04.46.30; Fri, 31 Mar 2023 04:46:58 -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 S231976AbjCaLjM (ORCPT + 99 others); Fri, 31 Mar 2023 07:39:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231666AbjCaLjE (ORCPT ); Fri, 31 Mar 2023 07:39:04 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E32FC191FB; Fri, 31 Mar 2023 04:39:01 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.153]) by gateway (Coremail) with SMTP id _____8BxIk5UxiZkKe0UAA--.32039S3; Fri, 31 Mar 2023 19:39:00 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.42.153]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx57xUxiZkmwASAA--.12675S3; Fri, 31 Mar 2023 19:39:00 +0800 (CST) From: Jianmin Lv To: Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Lorenzo Pieralisi , Jiaxun Yang , Huacai Chen , loongson-kernel@lists.loongnix.cn, stable@vger.kernel.org Subject: [PATCH V2 1/5] irqchip/loongson-eiointc: Fix returned value on parsing MADT Date: Fri, 31 Mar 2023 19:38:56 +0800 Message-Id: <20230331113900.9105-2-lvjianmin@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230331113900.9105-1-lvjianmin@loongson.cn> References: <20230331113900.9105-1-lvjianmin@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Bx57xUxiZkmwASAA--.12675S3 X-CM-SenderInfo: 5oymxthqpl0qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBjvJXoW7trWkZF45Kw48uF4rtFWkJFb_yoW8WFW7pa y7ArZ8tr4Yy3yxCr4kt3s8X345A39xuayxtFWrG3yFvr4qkrWDXF4fA3Wj9rn2yFWUG3Wj vF4Fqa15uw45A3DanT9S1TB71UUUUjDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bS8YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JF0_JFyl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26F4UJVW0owAa w2AFwI0_JF0_Jw1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44 I27wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jw0_WrylYx0Ex4A2 jsIE14v26r4j6F4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY1x0262 kKe7AKxVWUAVWUtwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwCFI7km 07C267AKxVWUAVWUtwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r 1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVW8 JVW5JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r 1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1U YxBIdaVFxhVjvjDU0xZFpf9x07jr6p9UUUUU= 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761883685062723030?= X-GMAIL-MSGID: =?utf-8?q?1761883685062723030?= 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. Signed-off-by: Jianmin Lv --- 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; } 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) From patchwork Fri Mar 31 11:38:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5ZCV5bu65rCR?= X-Patchwork-Id: 77758 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp499283vqo; Fri, 31 Mar 2023 04:47:46 -0700 (PDT) X-Google-Smtp-Source: AKy350arQ5UZ6gJ+LIsxVekRR4QMoZgcWToGnw6dHVAw36cATq84hbPSHO6lf4PVTJpUh1Ueigo7 X-Received: by 2002:a05:6402:5213:b0:502:50b0:a879 with SMTP id s19-20020a056402521300b0050250b0a879mr9372780edd.5.1680263265943; Fri, 31 Mar 2023 04:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680263265; cv=none; d=google.com; s=arc-20160816; b=PlpiLqlhFlzR3IfkAUTI1eR5JMRCA7CImsIIP2l+pL4SDoPDA20PQUXvfBsiDVaggt B+rMjAqkhiiKIVDUbCMWhKE5VSf0taHQOt8D77OJhvJ2+ZOfQkEq+QF+V/4pu1yuCC+1 lFX/3svv6Em/JgXOBgBNT+eD8jeQa82mBzgj/PCf9vYI8XXAZPXrdGI43BaQZRkQ+cF6 /YFDbJj4s2iqk8Zg3IuLx9ZOSNWR/iKMnoBE97KD0H04rJ9TAySWQSy8zeLf4YDxXl69 gnEd9MRZazm34PkIpdzaMCjKUR6GaaILgcsmay/zWa9/qinDuvhUgIoS8fIV3i/Lju+B r71Q== 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=VyPwMaFUCgQ0djSXeHiEzXolAjerDnNSgoJXPNieqNA=; b=Wr81AuwY4wBJeb7EpRvSyAuK/jjpDI/uA7mrS/Rl+NJPmv+v3NDgb5xMA/WA0DUQwe +VIGiflCbc/QwAcKUKePqZNldm4svoiSY+tAARGU5hU6Eyckk8USQ5g6honKIzAGGWz5 LIUTpqrcgRKZv07w6CpAFQq6pNezPMrA5ouksoX7witi0uY1Ff2O8lpuaor231hb98kn sDaBAxYoPKCHkCAASBNi2sZwcwjpLZIzw6bgRyldoCqbhoBjP9ln2k0gu0aJgrHhuiAE Spew98wKxDTUhknEbzWCEtTqz37rjyypwJTMwdTYgDTcNcLwOOmfk5T70GW1/YShKYJj j99g== 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 gf23-20020a170906e21700b00925f618e1e6si395872ejb.174.2023.03.31.04.47.20; Fri, 31 Mar 2023 04:47:45 -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 S231934AbjCaLjJ (ORCPT + 99 others); Fri, 31 Mar 2023 07:39:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231562AbjCaLjE (ORCPT ); Fri, 31 Mar 2023 07:39:04 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E28D5191FA; Fri, 31 Mar 2023 04:39:01 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.153]) by gateway (Coremail) with SMTP id _____8AxbdpVxiZkNO0UAA--.32098S3; Fri, 31 Mar 2023 19:39:01 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.42.153]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx57xUxiZkmwASAA--.12675S4; Fri, 31 Mar 2023 19:39:00 +0800 (CST) From: Jianmin Lv To: Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Lorenzo Pieralisi , Jiaxun Yang , Huacai Chen , loongson-kernel@lists.loongnix.cn, stable@vger.kernel.org Subject: [PATCH V2 2/5] irqchip/loongson-eiointc: Fix incorrect use of acpi_get_vec_parent Date: Fri, 31 Mar 2023 19:38:57 +0800 Message-Id: <20230331113900.9105-3-lvjianmin@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230331113900.9105-1-lvjianmin@loongson.cn> References: <20230331113900.9105-1-lvjianmin@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Bx57xUxiZkmwASAA--.12675S4 X-CM-SenderInfo: 5oymxthqpl0qxorr0wxvrqhubq/ X-Co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xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1U YxBIdaVFxhVjvjDU0xZFpf9x07UAKsUUUUUU= 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761883734258759266?= X-GMAIL-MSGID: =?utf-8?q?1761883734258759266?= 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. Signed-off-by: Jianmin Lv --- drivers/irqchip/irq-loongson-eiointc.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c index 62a632d73991..d16ed64feb3d 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,16 @@ 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; + + if (cpu_has_flatmode) + node = cpu_to_node(eiointc_priv[nr_pics - 1]->node * CORES_PER_EIO_NODE); + else + node = eiointc_priv[nr_pics - 1]->node; + + parent = acpi_get_vec_parent(node, msi_group); if (parent) return pch_msi_acpi_init(parent, pchmsi_entry); @@ -379,6 +384,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; priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) @@ -421,8 +427,12 @@ 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(acpi_eiointc->node * CORES_PER_EIO_NODE); + else + node = acpi_eiointc->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; From patchwork Fri Mar 31 11:38:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5ZCV5bu65rCR?= X-Patchwork-Id: 77756 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp498896vqo; Fri, 31 Mar 2023 04:46:59 -0700 (PDT) X-Google-Smtp-Source: AKy350Y6FrjxdIKuqn5xCrK6QnkE3WrCpKOBjDb9yzHf5395aMpMKfK+bLoCc5nU4aq9Kk7NQFIk X-Received: by 2002:a17:906:a04b:b0:93e:2a40:316f with SMTP id bg11-20020a170906a04b00b0093e2a40316fmr8446280ejb.28.1680263219084; Fri, 31 Mar 2023 04:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680263219; cv=none; d=google.com; s=arc-20160816; b=NOdhCGCXRvaWUNs1jEYgSfbFusEvhdUP6g9S4wLVasZg89wGgMNEGe0it3SYuAvxEb xE0FXyGAw4KOPpnN9t8I3/A/tzBuNIq9a3Z36FvUgZ6y22GgaOt8LTin2UpzbCaGbbum 3ot2rrqWOFqF1Fb9XUMHVVPOgQsr1Zu2ToF1RIIvZILTzSts5rH/zxmFWFv4DepIFYBC wXmh45q9iwC4jc1Ti/V4KUxNRH9v8glsLfhkkPKx5FiujNQASgHffAsJNboqrNXnk7Zg EFBj8UWnjjwPFEJsUSvDAa35gXoB6G8uC+uGj5DFDJJSmvsHjonC3aXegSutuWY2R6yZ n8MA== 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=Jsq+vqgduoBWf2u/BFOdXMIDPJ/2EhAAYLY5eCCDcvQ=; b=GZDisEUbtO8TD1iKKlS9IztiGsx33SpqscwWdaAropf8p6O1DmrjtzNMXaCRg7vl5I CXlvo2SBkeKn4tyVXoTM3hlKNjYj6XcQm82+zk21FUiOx/yf0DFsiBuNL5n5w944+GpB 9NvNChLUsfA9bJfPypDRnYhNIdjPg0enM3dQRrv3+ECaIWNVI/o9uIMKgSyHVqyrU/Hs VcsZeyiKXlc8X949aPxB/SMigATE47BfghmWScLi87/OJO0+o9n0inM3jSvtSrOxaR8S /8LYan4GhZJZea7GaKwJMr93FPMt6ZDmHUx7bTsGXeOeC17GkHLUSR6dRKrMXqK02Dgi 9LNA== 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 qx26-20020a170906fcda00b0093c09a76ac9si1879797ejb.481.2023.03.31.04.46.34; Fri, 31 Mar 2023 04:46:59 -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 S230456AbjCaLjH (ORCPT + 99 others); Fri, 31 Mar 2023 07:39:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231628AbjCaLjE (ORCPT ); Fri, 31 Mar 2023 07:39:04 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 002201A442; Fri, 31 Mar 2023 04:39:01 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.153]) by gateway (Coremail) with SMTP id _____8BxEJVVxiZkOO0UAA--.32362S3; Fri, 31 Mar 2023 19:39:01 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.42.153]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx57xUxiZkmwASAA--.12675S5; Fri, 31 Mar 2023 19:39:00 +0800 (CST) From: Jianmin Lv To: Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Lorenzo Pieralisi , Jiaxun Yang , Huacai Chen , loongson-kernel@lists.loongnix.cn, stable@vger.kernel.org Subject: [PATCH V2 3/5] irqchip/loongson-eiointc: Fix registration of syscore_ops Date: Fri, 31 Mar 2023 19:38:58 +0800 Message-Id: <20230331113900.9105-4-lvjianmin@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230331113900.9105-1-lvjianmin@loongson.cn> References: <20230331113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7IYx2IY67AKxVW5 JVW7JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r 1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1U YxBIdaVFxhVjvjDU0xZFpf9x07jr6p9UUUUU= 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761883685320908902?= X-GMAIL-MSGID: =?utf-8?q?1761883685320908902?= When support suspend/resume for loongson-eiointc, the syscore_ops is registered twice in dual-bridges machines where there are two eiointc IRQ domains. Repeated registration of an same syscore_ops broke syscore_ops_list. Also, cpuhp_setup_state_nocalls is only needed to call for once. So the patch will corret them. Fixes: a90335c2dfb4 ("irqchip/loongson-eiointc: Add suspend/resume support") Signed-off-by: Jianmin Lv --- drivers/irqchip/irq-loongson-eiointc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c index d16ed64feb3d..90181c42840b 100644 --- a/drivers/irqchip/irq-loongson-eiointc.c +++ b/drivers/irqchip/irq-loongson-eiointc.c @@ -422,10 +422,12 @@ int __init eiointc_acpi_init(struct irq_domain *parent, parent_irq = irq_create_mapping(parent, acpi_eiointc->cascade); irq_set_chained_handler_and_data(parent_irq, eiointc_irq_dispatch, priv); - register_syscore_ops(&eiointc_syscore_ops); - cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_LOONGARCH_STARTING, + if (nr_pics == 1) { + register_syscore_ops(&eiointc_syscore_ops); + cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_LOONGARCH_STARTING, "irqchip/loongarch/intc:starting", eiointc_router_init, NULL); + } if (cpu_has_flatmode) node = cpu_to_node(acpi_eiointc->node * CORES_PER_EIO_NODE); From patchwork Fri Mar 31 11:38:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5ZCV5bu65rCR?= X-Patchwork-Id: 77753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp496115vqo; Fri, 31 Mar 2023 04:41:31 -0700 (PDT) X-Google-Smtp-Source: AKy350aJFR6PhcrWMeur9OQg2Ov4GtkDfkotL9k85szutdEa5RPdLYReCm9S088teIDc6JfjEAPm X-Received: by 2002:a17:90b:4d0d:b0:23d:1948:667d with SMTP id mw13-20020a17090b4d0d00b0023d1948667dmr27960606pjb.35.1680262891442; Fri, 31 Mar 2023 04:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680262891; cv=none; d=google.com; s=arc-20160816; b=p5NhlwjvVM91pnO0LtMG9pVZ7wyE/jlbwjh1U0BnbUyrr8krBLkdPu8eG68tHocqSt 8msubAxvV8zlUC3qr3H1Or63WSgT46Ret8F60gl2NyXELY0yHCNU6bUTkNkh5v1AnM2e nQ+UfgD7Mn/a7oyJIRkvcwvuFWb7e+OZc5cLRQqQIWzyFhZcOcbbkt2o3Y+A5HW7Lm+w lAzyjBGNmyds4ckr3basp6+XDTZo/qRbRE8gNZgFQygnGPU7tigXobsArCfeKPgAZe1A kKgY/moEX/IyZoa6FFUhmdP+yMvWyRzKYX3OpOiabO5zYksI6202I8v8WpK1VF0IWM3+ zR4w== 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=iOvlDZHlAzMjvwBqyJ2YfXfaeUut/3zr5NKLadv0jyQ=; b=JAL9LcUMFVUDNffaCyyY0xu/z6AR0EmdepXXksXLNkiQB7yhBT0nci8Ad7+ucaInYx 0W9EXTfs1qqgbsjZalYHAViQCNjLe5vvMvH3BlHnA6ThuTqVgXUNAbR09fAk4o80Cha+ MOa4CiCMWMJV2O/EO1DDYYw/7iZ4CxRPT3jnYlW/i1d6DAPDogS6nG9Q/yKqeXlwNVBe RRP+04TsKdba4udMsiMA1XG8MLyL9GEztgpzRMGYlG3+xYGiCCcLTnSVZYbm+U7nxmNv AA/T2s5VSq6pxFhClr2+oS5qGXKUpEfrgbr+9mBP0iIL1LdvOKjIyd4VOp/ouQlfujYB Ab3Q== 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 l13-20020a17090a660d00b0023fd2862be5si1870583pjj.65.2023.03.31.04.41.18; Fri, 31 Mar 2023 04:41:31 -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 S231952AbjCaLjQ (ORCPT + 99 others); Fri, 31 Mar 2023 07:39:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231685AbjCaLjE (ORCPT ); Fri, 31 Mar 2023 07:39:04 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3AB951A453; Fri, 31 Mar 2023 04:39:02 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.153]) by gateway (Coremail) with SMTP id _____8DxAf9VxiZkP+0UAA--.32481S3; Fri, 31 Mar 2023 19:39:01 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.42.153]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx57xUxiZkmwASAA--.12675S6; Fri, 31 Mar 2023 19:39:00 +0800 (CST) From: Jianmin Lv To: Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Lorenzo Pieralisi , Jiaxun Yang , Huacai Chen , loongson-kernel@lists.loongnix.cn, stable@vger.kernel.org Subject: [PATCH V2 4/5] irqchip/loongson-pch-pic: Fix registration of syscore_ops Date: Fri, 31 Mar 2023 19:38:59 +0800 Message-Id: <20230331113900.9105-5-lvjianmin@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230331113900.9105-1-lvjianmin@loongson.cn> References: <20230331113900.9105-1-lvjianmin@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Bx57xUxiZkmwASAA--.12675S6 X-CM-SenderInfo: 5oymxthqpl0qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBjvdXoW7Xr43Xr4UCFyUAryDuFy8Zrb_yoWkJrbEgr yIqFsrJw18Zr1Uu3y3Zr15XF43ta1UWFn5uFZ8KF9xJ3yrX34fJr12yrn8Cw47Ga48AFnx G398WrnakryxCjkaLaAFLSUrUUUUnb8apTn2vfkv8UJUUUU8wcxFpf9Il3svdxBIdaVrn0 xqx4xG64xvF2IEw4CE5I8CrVC2j2Jv73VFW2AGmfu7bjvjm3AaLaJ3UjIYCTnIWjp_UUUY A7kC6x804xWl14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3w AFIxvE14AKwVWUAVWUZwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK 6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j6F4UM28EF7 xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Cr1j6rxdM2kK e7AKxVWUAVWUtwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI 0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWrXVW3AwAv7VC2z280 aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxkF7I0En4 kS14v26r126r1DMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI 1I0E14v26r126r1DMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_Jr Wlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26ryj 6F1UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr 0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUv cSsGvfC2KfnxnUUI43ZEXa7IU0XzstUUUUU== 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761883341418330750?= X-GMAIL-MSGID: =?utf-8?q?1761883341418330750?= When support suspend/resume for loongson-pch-pic, the syscore_ops is registered twice in dual-bridges machines where there are two pch-pic IRQ domains. Repeated registration of an same syscore_ops broke syscore_ops_list, so the patch will corret it. Fixes: 1ed008a2c331 ("irqchip/loongson-pch-pic: Add suspend/resume support") Signed-off-by: Jianmin Lv --- drivers/irqchip/irq-loongson-pch-pic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c index 437f1af693d0..64fa67d4ee7a 100644 --- a/drivers/irqchip/irq-loongson-pch-pic.c +++ b/drivers/irqchip/irq-loongson-pch-pic.c @@ -311,7 +311,8 @@ static int pch_pic_init(phys_addr_t addr, unsigned long size, int vec_base, pch_pic_handle[nr_pics] = domain_handle; pch_pic_priv[nr_pics++] = priv; - register_syscore_ops(&pch_pic_syscore_ops); + if (nr_pics == 1) + register_syscore_ops(&pch_pic_syscore_ops); return 0; From patchwork Fri Mar 31 11:39:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5ZCV5bu65rCR?= X-Patchwork-Id: 77757 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp498898vqo; Fri, 31 Mar 2023 04:46:59 -0700 (PDT) X-Google-Smtp-Source: AKy350b17tgFBjBnI3TUUhiV7jgOEbl4AWHWC7Mm5jfQES2QYgr3zHh6IMfjonTJh98lGNX3X4ew X-Received: by 2002:aa7:d14e:0:b0:4fa:3b3:c867 with SMTP id r14-20020aa7d14e000000b004fa03b3c867mr22296981edo.17.1680263219100; Fri, 31 Mar 2023 04:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680263219; cv=none; d=google.com; s=arc-20160816; b=Aw5a/rW07WIKlgPIjqwxX3V12oAj/l+2dVXmSsoP6E1GqLyDc+hqt6zdENUr4agE9N 1Sa5FLBxTGsd3MNZ1d4egYKk1B37MkEfrMfqDb1iDJ0Pb+PoWebCnNbXkxqYpVNW8fdn D3fUfS73W18YmxRWUrnbOXWn+kfaTHbHuFBJw06otzTwrGgkZqPTtvvmdw+F/Wo1AdkQ DbxGkM9LDBKS64JN0jD7LldLhAcnMS73OrNNdMHi6kj0agkh+84e9n3WelH5n+eCAaKe gE4LG07Ot1mSn9m9MZ6pcqnjVEwmDIWifUi7S1VNCxGK/SKwhv0FEl44erjF6m23KAwl t8Ig== 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=JH3vzSId4DOr2PrqSk1DMZFNbz/Q/vq8Fgz8K+jYIEo=; b=O40MwpqviKLfgPupvtu1tqB0+JUgPVBy2ipZwlZJV3LxrvCLxVmqQp6OM2yXO0LjFQ k54ku//lmwj77kpOVA4fgEpNZ0NzNpNlOifik95wqrP0+tIxqvNc6oGb3bgSpSfSJJpT p7URvGRO9vDkIGAzxyAYZHJhORCqFbZ3d4TlIF/GpQpSIjotJY4gxu7HvPeGG2kjs9iz 943pMJLUc2F3WqzMgUHqEHyZBtmaoV+886TI8ngbwmk8bXvFxE1I4vVputmPiaGl1t0i Qcu/eiRGbw67HQUhwFMx/GQeluJSVd1gP0jm3ixHbxPGuwmpqiCngHmLghl6N26n0Ns5 K/oQ== 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 v9-20020aa7d649000000b004af6a815065si2027510edr.592.2023.03.31.04.46.34; Fri, 31 Mar 2023 04:46:59 -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 S232069AbjCaLjT (ORCPT + 99 others); Fri, 31 Mar 2023 07:39:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231722AbjCaLjE (ORCPT ); Fri, 31 Mar 2023 07:39:04 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ADB351A454; Fri, 31 Mar 2023 04:39:02 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.153]) by gateway (Coremail) with SMTP id _____8BxMMxVxiZkRu0UAA--.32260S3; Fri, 31 Mar 2023 19:39:01 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.42.153]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx57xUxiZkmwASAA--.12675S7; Fri, 31 Mar 2023 19:39:01 +0800 (CST) From: Jianmin Lv To: Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Lorenzo Pieralisi , Jiaxun Yang , Huacai Chen , loongson-kernel@lists.loongnix.cn, stable@vger.kernel.org Subject: [PATCH V2 5/5] irqchip/loongson-pch-pic: Fix pch_pic_acpi_init calling Date: Fri, 31 Mar 2023 19:39:00 +0800 Message-Id: <20230331113900.9105-6-lvjianmin@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230331113900.9105-1-lvjianmin@loongson.cn> References: <20230331113900.9105-1-lvjianmin@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Bx57xUxiZkmwASAA--.12675S7 X-CM-SenderInfo: 5oymxthqpl0qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBjvJXoW7tw17uw1xJw4DGF1UCFy7Awb_yoW8Zw1kpF Waq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ZFpf9x07j6rWOUUUUU= 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761883685158929801?= X-GMAIL-MSGID: =?utf-8?q?1761883685158929801?= For dual-bridges scenario, pch_pic_acpi_init() will be called in following path: 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 correspondingto parsing two eiointc entries in MADT under dual-bridges scenario*/ acpi_cascade_irqdomain_init(in eiointc driver) acpi_table_parse_madt pch_pic_parse_madt pch_pic_acpi_init /* this will be called depend on valid parent IRQ domain handle for one or two times corresponding to parsing two pchpic entries in MADT druring calling eiointc_acpi_init() under dual-bridges scenario*/ During the first eiointc_acpi_init() calling, the pch_pic_acpi_init() will be called just one time since only one valid parent IRQ domain handle will be found for current eiointc IRQ domain. During the second eiointc_acpi_init() calling, the pch_pic_acpi_init() will be called two times since two valid parent IRQ domain handles will be found. So in pch_pic_acpi_init(), we must have a reasonable way to prevent from creating second same pch_pic IRQ domain. The patch matches gsi base information in created pch_pic IRQ domains to check if the target domain has been created to avoid the bug mentioned above. Signed-off-by: Jianmin Lv --- drivers/irqchip/irq-loongson-pch-pic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c index 64fa67d4ee7a..e5fe4d50be05 100644 --- a/drivers/irqchip/irq-loongson-pch-pic.c +++ b/drivers/irqchip/irq-loongson-pch-pic.c @@ -404,6 +404,9 @@ int __init pch_pic_acpi_init(struct irq_domain *parent, int ret, vec_base; struct fwnode_handle *domain_handle; + if (find_pch_pic(acpi_pchpic->gsi_base) >= 0) + return 0; + vec_base = acpi_pchpic->gsi_base - GSI_MIN_PCH_IRQ; domain_handle = irq_domain_alloc_fwnode(&acpi_pchpic->address);