Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3375984imw; Mon, 18 Jul 2022 07:05:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t/cBpF0Bu/okqwbIKqmw5FqzfAAXXrp/ZA8R2k5BVcFUlln/mSp2BXssnlLD8QY6XtN/jx X-Received: by 2002:a17:907:7255:b0:72b:50b8:82d6 with SMTP id ds21-20020a170907725500b0072b50b882d6mr1614076ejc.677.1658153122704; Mon, 18 Jul 2022 07:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658153122; cv=none; d=google.com; s=arc-20160816; b=XuhdBsTMG0zHv8/6vn8WUqyeQEE0L9+sNkXRcOcl6870YhYO442NcCojoVFzN3iyCA 9DJrqhzNVcUu1OcU7pF4g+BwvuYMurC8eJa3kfv4L2euqG7kho1EErww759gAO5uePOR g81CheGSJfwVeeFARnbBJ63h3cLmaiXgn3LBYP9t/IqnRMw5PAD2UlgEf5+YwwTY8zCx tFMGHqHhJOxv4tgELN0/a3CoPt3/U9oQca9PGNVRm45kItFJrsb6+9vZ/bJHtGRUmehv LEJdL1MQ9e9kjYlTOnYCfg3bbxQB/whQJEX84JiBD43qKe9nW0lUAMh1l10obYKDrWrV b7Ng== 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=jN2r1QmZ1RvOkD5Og2z4gpg5J2F6ulCPtb11JvizFfg=; b=V+0Qgg19Mi6phr4rRA+h9ep1+9c0OcGdss/ITxHfOI13V7Tf7onmBmuYGCQmzbXwkb zzc9CZTSnSXFk9f1wZwIe+ZGS76qDpLGXCHX8hXkjBHseldFAh80hi6uB9o7jSMETNkX jTPmDWX9pTW61YMGgJlSVbi20QNLr9xXX+Cn0Klnkf9y/yOZH21n4yh8JUzy6obOegp7 JSWoD0YzNSmtnEi7u/LzpV+bZ6pHdxmXPRGOkbzPgxBaYAIibsXgHsSpXPbHbn0f8JsT UGDJZdKVqvvyZfDWPnnUw6Ozqi+znMeR4Z3lidrHfBhpzjgV64udcBscbHGXAKFNgLXF RsVw== 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 dn7-20020a17090794c700b0072b69650f7esi14167489ejc.719.2022.07.18.07.04.58; Mon, 18 Jul 2022 07:05:22 -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 S235480AbiGRNKk (ORCPT + 99 others); Mon, 18 Jul 2022 09:10:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235481AbiGRNKa (ORCPT ); Mon, 18 Jul 2022 09:10:30 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4709F1D31F for ; Mon, 18 Jul 2022 06:10:29 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Lmj2l1f92zlVr8; Mon, 18 Jul 2022 21:08:47 +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; Mon, 18 Jul 2022 21:10:26 +0800 From: Xu Qiang To: , CC: , , Subject: [PATCH -next 2/2] irqdomain: Replace revmap_direct_max_irq field with hwirq_max field Date: Mon, 18 Jul 2022 13:07:59 +0000 Message-ID: <20220718130759.67777-3-xuqiang36@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220718130759.67777-1-xuqiang36@huawei.com> References: <20220718130759.67777-1-xuqiang36@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 481abb885d61..384eb9166804 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) { + if (virq >= domain->hwirq_max) { pr_err("ERROR: no free irqs available below %i maximum\n", - domain->revmap_size); + 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