Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8444356rwb; Tue, 13 Dec 2022 06:30:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf4vdjWS78hP03FFb4GCTDs2+8d/kpLvOO95D/VRbPLoaeb82cLWqGFrZEps+l5MrreFezCO X-Received: by 2002:aa7:8a02:0:b0:573:846c:b88 with SMTP id m2-20020aa78a02000000b00573846c0b88mr19573586pfa.23.1670941835305; Tue, 13 Dec 2022 06:30:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670941835; cv=none; d=google.com; s=arc-20160816; b=JVj6Rr4J3rjKzb1LzGVGE/A31RHMu+xeOrxiu18AJCvuqbtWlX23LQogGwr2eUlzlY /BZl4z+veJVZbABROSFRZqdnPAPey9vqRdlA34W6xbKp5BNxq+Wqt8gYQt3Hz6LclAmC zoyxQQpQQ7ouPJRJY7U/V+nphAgP45g1PTWrRseOwO+dz6l93NHFloQvZjRInyZJ/ptR 9aZqORke9D2vGhbep+Z+2LQk+E568RgIi4LgHkpvAlgdxQtL7oFGYNDXZqL8T2UAydPT Z0PrxCC8gUFqgdX67ELQJ9tdigwC85YDVa7UZ62Jc/CExM/Mv01P5ivgie/zBUCIiQY1 s5jQ== 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 :dkim-signature; bh=RudMhIKPxrv4knDpqasxIh2kLNuaccIdrQzaqIipi4g=; b=DO/7HyjeV4524qcmGB+GR3AvkcAFX6wc8TE13u7zCz0xEn7DI7twHmSCVG/uysyOSm QiNPX67gmJ0DkAzuUjPORbEy8Hp0b+RPqZr1Gg5Z0pXiPMLkzJAWIN+Zq1As73W3l2it COTcngr06PdON7jQoscQWpGASwXEhDR/6cYggxTbldAaT/TuAtr45+AFuU4uUDgSSjcQ sU0va9gcRIncbBbJsJVFgZ7l299JlHLqE+Q0oeHbXdXrl0bv12/dmnylqCUM6YCb4mHi UMxdTfMsLSBVOMcgSQkg3+WxcPc1zX+mxHFOxqCmocgKft8Pq7dFpDekgPZ/Ze5gXzNm OEPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UxWcVgkZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s8-20020a056a00178800b00565a581ecc0si12403953pfg.11.2022.12.13.06.30.24; Tue, 13 Dec 2022 06:30:35 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UxWcVgkZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235428AbiLMOJ3 (ORCPT + 72 others); Tue, 13 Dec 2022 09:09:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235887AbiLMOI4 (ORCPT ); Tue, 13 Dec 2022 09:08:56 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13CF820F42 for ; Tue, 13 Dec 2022 06:08:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C2E4EB811DA for ; Tue, 13 Dec 2022 14:08:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80A5EC433D2; Tue, 13 Dec 2022 14:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670940521; bh=M2Je/haA40Wu9LCU1PfMEDvXGneFkuJ8iybnSPHk2oI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UxWcVgkZrWmEEJ8Ao51oMyMe+heeIkwUihFgxIgb0XlgHRs/hGIVJLR2uV9H8XQDz 6UqQMpJIgarzttGleoBAESwIMUpxmpUdiwD6CYSZA0XgMAM5o6AWnP5zwY9HrrcaAG wWstqE9uA1p3UZGVG5jzl3t3kDy4xsUkllpUnKSmYQFxKeFhogvbNQruMP5TqX9dd6 DJ8nI6WYU66GdYR24n4yaKBP8bEbuEA2eYhAgLxujnmsKl++3Cg/hIop0ZBS75cQKC dHxcoyVPrNAaQXGTYvnLo3raoDCUFQcRVlcCWWPfv3fSuw8xHje3l4aQTt7G8mxAmJ TlgBjeRHXMwaQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1p55xz-00042N-Hl; Tue, 13 Dec 2022 15:09:07 +0100 From: Johan Hovold To: Thomas Gleixner , Marc Zyngier Cc: Hector Martin , Sven Peter , Alyssa Rosenzweig , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, Johan Hovold Subject: [PATCH 2/2] genirq/irqdomain/msi: Add irq_domain_alloc_irqs_affinity() wrapper Date: Tue, 13 Dec 2022 15:08:44 +0100 Message-Id: <20221213140844.15470-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221213140844.15470-1-johan+linaro@kernel.org> References: <20221213140844.15470-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 The full __irq_domain_alloc_irqs() interface was initially only intended for some legacy (x86) use cases while most callers should use the irq_domain_alloc_irqs() wrapper. Add a matching irq_domain_alloc_irqs_affinity() wrapper that can be used when an affinity hint needs to be provided and use it for MSI allocations. Signed-off-by: Johan Hovold --- include/linux/irqdomain.h | 15 +++++++++++++++ kernel/irq/msi.c | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index cad47737a052..b1b06d75d31a 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -507,6 +507,14 @@ static inline int irq_domain_alloc_irqs(struct irq_domain *domain, NULL); } +static inline int irq_domain_alloc_irqs_affinity(struct irq_domain *domain, + unsigned int nr_irqs, int node, void *arg, + const struct irq_affinity_desc *affinity) +{ + return __irq_domain_alloc_irqs(domain, -1, nr_irqs, node, arg, false, + affinity); +} + extern int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain, unsigned int irq_base, unsigned int nr_irqs, void *arg); @@ -585,6 +593,13 @@ static inline int irq_domain_alloc_irqs(struct irq_domain *domain, return -1; } +static inline int irq_domain_alloc_irqs_affinity(struct irq_domain *domain, + unsigned int nr_irqs, int node, void *arg, + const struct irq_affinity_desc *affinity) +{ + return -1; +} + static inline void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs) { } diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index bd4d4dd626b4..01f7f3c8d77a 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -1272,9 +1272,9 @@ static int __msi_domain_alloc_irqs(struct device *dev, struct irq_domain *domain ops->set_desc(&arg, desc); - virq = __irq_domain_alloc_irqs(domain, -1, desc->nvec_used, - dev_to_node(dev), &arg, false, - desc->affinity); + virq = irq_domain_alloc_irqs_affinity(domain, desc->nvec_used, + dev_to_node(dev), &arg, + desc->affinity); if (virq < 0) return msi_handle_pci_fail(domain, desc, allocated); -- 2.37.4