Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4133308imw; Mon, 18 Jul 2022 23:41:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vcPgsMPQ51RIELMccA+eBsRonmkRf+xYDh1SRCDzPf4FSeujWwZKm1eyulsxAAiGv0Y2O3 X-Received: by 2002:a05:6402:12d8:b0:43a:6a70:9039 with SMTP id k24-20020a05640212d800b0043a6a709039mr41981575edx.379.1658212916890; Mon, 18 Jul 2022 23:41:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658212916; cv=none; d=google.com; s=arc-20160816; b=bxY1OfGUlFeRNj4I+78/YGW+wUqG7rCewDZN9SXlOikE9hBc3zzXSWhWnQl+i7J86y zMczRK/ZM7gkAhFQ4XnB3FPz1z4Tv/oMT2Qps2J8X2GvWwZzOLLn9YnZvZMdAEi7yCNh VWWensDr9+BnV5hMx3ezBdXoPjeNQGYDTzexO1+/yDiW+BRMDUdE3gCA1ObJKTK18F24 6lMWZxWQ13ayIN5UEm5z0E1IIm5bZuU2y4+BzV9XO+w3gTNyyH1AOAZg55e5g0qCg5yS XZu5N+SOWXAUEQMgWMZw5+TzNMYJnCPPNN7LaFaO0iYO0zJkgN50BLSkCS04n9BLl8uQ kg3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=IENd7/6DMOYWRKLr/dg6K1p94G9AgQyUYynZUg9kTfI=; b=WVA2cymEFnmSy1vFs+WvyevaVuj18+/a5nYgqbZTQNwhbLgjxVdvOj0B9upVpLkWe3 nlwg9qLEzGnK1naKhtO/e7NqpoEvvX5dLvpuBVg1vI8Dcnjo/+vxREUGHrdBNiT0cY6W AJUj0Jk5hDu8dAvqPHVCY+v0ImvDwC/2wjBrHC/f2oWOH9US4ZE9taN2U8UeXScMY3f4 4e+VZ7QcGuwTkpo5h97CszbvbzavP8K0MnxszeUzg/6vV8KoX297qfox8T8mIjfNUwf8 KTI/EZ//aCC8j0+U3IbMuk80huXSmBZ0Votde9Sg4mVn3EOAb8GWYcAk7TcQILL4Xctb /iaQ== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i8-20020a1709064fc800b0072b872932d6si24407820ejw.567.2022.07.18.23.41.32; Mon, 18 Jul 2022 23:41:56 -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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237064AbiGSGjQ (ORCPT + 99 others); Tue, 19 Jul 2022 02:39:16 -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 Content-Type: text/plain 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 In commit "4f86a06e2d6e irqdomain: Make normal and nomap irqdomains exclusive", 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 same 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_handle *fwnode, unsigned int s static atomic_t unknown_domains; 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 != hwirq_max)))) return NULL; domain = kzalloc_node(struct_size(domain, revmap, size), @@ -219,7 +220,6 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int s domain->hwirq_max = hwirq_max; if (direct_max) { - size = direct_max; domain->flags |= IRQ_DOMAIN_FLAG_NO_MAP; } @@ -650,9 +650,9 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain) pr_debug("create_direct virq allocation failed\n"); return 0; } - if (virq >= domain->revmap_size) { - pr_err("ERROR: no free irqs available below %i maximum\n", - domain->revmap_size); + if (virq >= 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_domain *domain, return desc; if (irq_domain_is_nomap(domain)) { - if (hwirq < domain->revmap_size) { + if (hwirq < domain->hwirq_max) { data = irq_domain_get_irq_data(domain, hwirq); if (data && data->hwirq == hwirq) desc = irq_data_to_desc(data); -- 2.17.1