Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6363874rwb; Mon, 5 Dec 2022 11:12:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf6yL3f3Xxb7Vvkfw69t2FsV058mg0r7EzUHnPp1HLfRWoT2LNrPnwdPMN0a9aTC3T3T0kXe X-Received: by 2002:a17:902:e550:b0:184:dc59:cc9f with SMTP id n16-20020a170902e55000b00184dc59cc9fmr68789741plf.89.1670267562627; Mon, 05 Dec 2022 11:12:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670267562; cv=none; d=google.com; s=arc-20160816; b=n37xGKxxOjxCTtCzsHpEW4JZb64ybpKBXwKlN1CHI1inphYIFTuxj/it/Hklz2zUJN 6KQzeddOuRKQw+enlWVJRcXProkzaZROdSxPI3BBAJrhkhiEr81V0qYWIBV4H7ez5D+e +rq4ezfWCCo15rtZDrcmHQPLezkBo+PWj/XIT2OsKfyltTrWqtnj56EgEwd5LzNsAf6O 4ixBz5dWdOgcNBKm69nsc7gfQsbZjDZdM7OjWOdRaJhDrWuXU5NY/dXNduQIfnVqQfDw gzXcoXbPB0ur1ZtyMiQI3wk+L3aQyy0qZhsVLzTgSeNQGorMGPOFnk5qRMDCvfdvbnw5 AIoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=QZedNHhsprNUnD/Sk//bQ8/DcxPxO0/K/n0mXz7RnHI=; b=xZGssH8BDoq50bp/UQyukm7DdjPcfGrY/ejtWiWtv6+TrjkHVTvo15cqplk6YctpoC qVS4pvHMlLubbrQnwdx2h0qx/LR/pEotyA9a1f9p5zNXGT2XqiUdcWJH61OSNIAxrOFG yGSjFyVU0Vjys881yeRJr2dXUiOobYiC6CKI7XmVJEiIkpoAhIzLJbB1iAk0H7OCZ9K8 cWl3hNIGWjhvdZ+8vEYpy3n+NshCtbTgkyBzavy/S8X5YUISRMjkEPTE4nMFm23NTSzX rPsHnxqcW46ulrGYiE6OuyVm8ki2PVhxceUx/4t3IXYBxKjDpYpQJ6K70nd12gJJr0af 1VNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=gbGT6SYp; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw16-20020a17090b4d1000b00218df8e02f2si16661689pjb.112.2022.12.05.11.12.32; Mon, 05 Dec 2022 11:12:42 -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=@linutronix.de header.s=2020 header.b=gbGT6SYp; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233338AbiLES0o (ORCPT + 81 others); Mon, 5 Dec 2022 13:26:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232434AbiLESZT (ORCPT ); Mon, 5 Dec 2022 13:25:19 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43F0A20BE6; Mon, 5 Dec 2022 10:25:18 -0800 (PST) Date: Mon, 05 Dec 2022 18:25:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1670264715; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QZedNHhsprNUnD/Sk//bQ8/DcxPxO0/K/n0mXz7RnHI=; b=gbGT6SYpiivaOGvBy7n9gXAuyKh3ISL1G3Bs3JuaoPYDp6RvFYhTdRnFHOyqjAsaP3IqF7 uxhgmHz/4O/FZEuXsHbYy4IyD3DzoF2R6YqatImSg+8JewL+wMni5ip9Q16p/K0shGjJWk ibOaa6ChWKsTiBO1ZRYyf+CIbns8cpKNhzf7Xe3SqGTjHfht12+SnsaGAoS6TrQUJ6V/dG QOVYQIbV4swHv9AoTMEPLJ84og+rKBKF9V2+rib2VGJ4s4O8Wc1HbiSzTPDV8QBhK30L5A 7XgTBcVljKospJl39yoa/IZLDIVex9tiYYYudTkpyGotKuzpFMEPd6l457t4+w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1670264715; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QZedNHhsprNUnD/Sk//bQ8/DcxPxO0/K/n0mXz7RnHI=; b=xP7s9XOJ0LFSeiXt+AJIUKGhsGF3KI6ZU6DirD3tEjvX96BVxZqPoHAxMV8xsZJsSqIjCU Ifhpu2kLnfQ9mnBw== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] genirq/msi: Provide msi_match_device_domain() Cc: Thomas Gleixner , Kevin Tian , Marc Zyngier , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221124232325.738047902@linutronix.de> References: <20221124232325.738047902@linutronix.de> MIME-Version: 1.0 Message-ID: <167026471551.4906.2567791541055402967.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 The following commit has been merged into the irq/core branch of tip: Commit-ID: 26e91b75bf6108550035355c835bf0c93c885b61 Gitweb: https://git.kernel.org/tip/26e91b75bf6108550035355c835bf0c93c885b61 Author: Thomas Gleixner AuthorDate: Fri, 25 Nov 2022 00:25:57 +01:00 Committer: Thomas Gleixner CommitterDate: Mon, 05 Dec 2022 19:21:01 +01:00 genirq/msi: Provide msi_match_device_domain() Provide an interface to match a per device domain bus token. This allows to query which type of domain is installed for a particular domain id. Will be used for PCI to avoid frequent create/remove cycles for the MSI resp. MSI-X domains. Signed-off-by: Thomas Gleixner Reviewed-by: Kevin Tian Acked-by: Marc Zyngier Link: https://lore.kernel.org/r/20221124232325.738047902@linutronix.de --- include/linux/msi.h | 3 +++ kernel/irq/msi.c | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/linux/msi.h b/include/linux/msi.h index ef46a3e..b4ab005 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -553,6 +553,9 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid, void *chip_data); void msi_remove_device_irq_domain(struct device *dev, unsigned int domid); +bool msi_match_device_irq_domain(struct device *dev, unsigned int domid, + enum irq_domain_bus_token bus_token); + int msi_domain_alloc_irqs_range_locked(struct device *dev, unsigned int domid, unsigned int first, unsigned int last); int msi_domain_alloc_irqs_range(struct device *dev, unsigned int domid, diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index 8b415bd..7449998 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -986,6 +986,31 @@ unlock: msi_unlock_descs(dev); } +/** + * msi_match_device_irq_domain - Match a device irq domain against a bus token + * @dev: Pointer to the device + * @domid: Domain id + * @bus_token: Bus token to match against the domain bus token + * + * Return: True if device domain exists and bus tokens match. + */ +bool msi_match_device_irq_domain(struct device *dev, unsigned int domid, + enum irq_domain_bus_token bus_token) +{ + struct msi_domain_info *info; + struct irq_domain *domain; + bool ret = false; + + msi_lock_descs(dev); + domain = msi_get_device_domain(dev, domid); + if (domain && irq_domain_is_msi_device(domain)) { + info = domain->host_data; + ret = info->bus_token == bus_token; + } + msi_unlock_descs(dev); + return ret; +} + int msi_domain_prepare_irqs(struct irq_domain *domain, struct device *dev, int nvec, msi_alloc_info_t *arg) {