From nobody Sat Apr 18 02:47:56 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 36ED4C43334 for ; Tue, 19 Jul 2022 06:39:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237058AbiGSGjQ (ORCPT ); Tue, 19 Jul 2022 02:39:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235161AbiGSGjN (ORCPT ); Tue, 19 Jul 2022 02:39:13 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96BD8248FC for ; Mon, 18 Jul 2022 23:39:12 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Ln8Hc2j5tz1M7yl; Tue, 19 Jul 2022 14:36:28 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 19 Jul 2022 14:39:10 +0800 From: Xu Qiang To: , CC: , , , Subject: [PATCH v2 -next 1/2] irqdomain: Fix an issue where the Linux IRQ number is not stored Date: Tue, 19 Jul 2022 06:36:40 +0000 Message-ID: <20220719063641.56541-2-xuqiang36@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220719063641.56541-1-xuqiang36@huawei.com> References: <20220719063641.56541-1-xuqiang36@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When using a NOMAP domain, __irq_resolve_mapping() doesn't store the Linux IRQ number at the address optionally provided by the caller. While this isn't a huge deal (the returned value is guaranteed to the hwirq that was passed as a parameter), let's honour the letter of the API by writing the expected value. Fixes: d22558dd0a6c (=E2=80=9Cirqdomain: Introduce irq_resolve_mapping()=E2= =80=9D) Signed-off-by: Xu Qiang --- kernel/irq/irqdomain.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index d5ce96510549..481abb885d61 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -910,6 +910,8 @@ struct irq_desc *__irq_resolve_mapping(struct irq_domai= n *domain, data =3D irq_domain_get_irq_data(domain, hwirq); if (data && data->hwirq =3D=3D hwirq) desc =3D irq_data_to_desc(data); + if (irq && desc) + *irq =3D hwirq; } =20 return desc; --=20 2.17.1 From nobody Sat Apr 18 02:47:56 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 5FED7CCA47F for ; Tue, 19 Jul 2022 06:39:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237066AbiGSGjR (ORCPT ); Tue, 19 Jul 2022 02:39:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235216AbiGSGjN (ORCPT ); Tue, 19 Jul 2022 02:39:13 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0824D27167 for ; Mon, 18 Jul 2022 23:39:13 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Ln8Jp2klZzlVys; Tue, 19 Jul 2022 14:37:30 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 19 Jul 2022 14:39:10 +0800 From: Xu Qiang To: , CC: , , , Subject: [PATCH v2 -next 2/2] irqdomain: Replace revmap_direct_max_irq field with hwirq_max field Date: Tue, 19 Jul 2022 06:36:41 +0000 Message-ID: <20220719063641.56541-3-xuqiang36@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220719063641.56541-1-xuqiang36@huawei.com> References: <20220719063641.56541-1-xuqiang36@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In commit "4f86a06e2d6e irqdomain: Make normal and nomap irqdomains exclusi= ve", use revmap_size field instead of revmap_direct_max_irq. revmap_size field originally indicates the maximum hwirq of linear Mapping. This results in revmap_size having two different layers of meaning that can be confusing. This patch optimization point is to solve this confusion point. During direct mapping, the values of hwirq_max and revmap_direct_max_irq are the s= ame and have the same meanings. They both indicate the maximum hwirq supported = by direct Mapping. The optimization method is to delete revmap_direct_max_irq field and use hwirq_max instead of revmap_direct_max_irq. Signed-off-by: Xu Qiang --- kernel/irq/irqdomain.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 481abb885d61..8fe1da9614ee 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -147,7 +147,8 @@ struct irq_domain *__irq_domain_add(struct fwnode_handl= e *fwnode, unsigned int s static atomic_t unknown_domains; =20 if (WARN_ON((size && direct_max) || - (!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && direct_max))) + (!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && direct_max) || + (direct_max && (direct_max !=3D hwirq_max)))) return NULL; =20 domain =3D kzalloc_node(struct_size(domain, revmap, size), @@ -219,7 +220,6 @@ struct irq_domain *__irq_domain_add(struct fwnode_handl= e *fwnode, unsigned int s domain->hwirq_max =3D hwirq_max; =20 if (direct_max) { - size =3D direct_max; domain->flags |=3D IRQ_DOMAIN_FLAG_NO_MAP; } =20 @@ -650,9 +650,9 @@ unsigned int irq_create_direct_mapping(struct irq_domai= n *domain) pr_debug("create_direct virq allocation failed\n"); return 0; } - if (virq >=3D domain->revmap_size) { - pr_err("ERROR: no free irqs available below %i maximum\n", - domain->revmap_size); + if (virq >=3D domain->hwirq_max) { + pr_err("ERROR: no free irqs available below %lu maximum\n", + domain->hwirq_max); irq_free_desc(virq); return 0; } @@ -906,7 +906,7 @@ struct irq_desc *__irq_resolve_mapping(struct irq_domai= n *domain, return desc; =20 if (irq_domain_is_nomap(domain)) { - if (hwirq < domain->revmap_size) { + if (hwirq < domain->hwirq_max) { data =3D irq_domain_get_irq_data(domain, hwirq); if (data && data->hwirq =3D=3D hwirq) desc =3D irq_data_to_desc(data); --=20 2.17.1