From patchwork Thu Nov 17 15:08:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 21715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp452845wrr; Thu, 17 Nov 2022 07:11:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf6BTJ3aeHXN/ncz1Mg84ith4UDIqpRUD+Txy52+w3MMvkS6LX4S39qcDS7OZRAQq8KfQKvH X-Received: by 2002:a17:906:2416:b0:7ad:4a55:d6f5 with SMTP id z22-20020a170906241600b007ad4a55d6f5mr2565454eja.220.1668697870716; Thu, 17 Nov 2022 07:11:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668697870; cv=none; d=google.com; s=arc-20160816; b=Nk4zcwkMEmacRq9zUu3BJccwqo6AztCoQzAuw0v7XyrF3+ZuDQaPcsPWoPHY3t1gi4 MrkkXcKZ1m8PWowLkopcXexQYzMQ/YuWkXg9A8L2DUCZh3DjMRrs5t17fFLPRWXitvUL YYl57Iqi3J8wAevFqIZ8W4at/vXmge73RmlUXI6ujhVdf/gsWrk5XJl7bJy/41xGojZl CyzA3f0UbqIvxKC30kcuYgDTjQX0J/gejAAlt936Shc5vLTK/ntQgr+Bn2z/FzRjaxSB LftvXNzfsQ4qT8O6IAh6/O5ba3EALo90eX48+Bcb5gDkZ8W8d1LFYZUFYyn6rFOFQxY0 T1VA== 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=U0EA+g4Bcyz2I47A6x9+qV6VZ1P347eeX/eR5+TVmlc=; b=dDSrgeN11UM+BiBLdu3iERDV9/gTs4HhIJxtL6cohEZMk2obv3LiJp/ZZCBHwDA9E/ mChJMA9gPfAIee9SrEGAYbCNgLeV6EUoFtO5ETJ+IaDnSR+ZgbgnUL4o7IrKY9Ha0hq8 EQ/XddCsS2JRsQ2NkRjMrOr80ZVZYQQOnK/a6K5vaimtmFp6QSRyTMfBx7BC3y4vWKIf JbnG7+HfJJE02696cK1vYapJu4ykcsJGotypkYvVgkVWYUatvIFEQ1wVZGOOFWdILP/F F4oNO/QmB9ZU4W00wRf9F6QxWF15rejN3EdwF9VQ115PxXrC+7QElVZjeMBvwsw14Gue bNIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oLdys8Gr; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji14-20020a170907980e00b007adb78db1adsi683887ejc.804.2022.11.17.07.10.35; Thu, 17 Nov 2022 07:11:10 -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=oLdys8Gr; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 S240319AbiKQPJa (ORCPT + 99 others); Thu, 17 Nov 2022 10:09:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240285AbiKQPIu (ORCPT ); Thu, 17 Nov 2022 10:08:50 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0711E7721F; Thu, 17 Nov 2022 07:08:08 -0800 (PST) Date: Thu, 17 Nov 2022 15:08:05 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668697686; 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=U0EA+g4Bcyz2I47A6x9+qV6VZ1P347eeX/eR5+TVmlc=; b=oLdys8GrKc1rBQWSF81TyiXDk1FW3/Mpborfl6iOC6ihd5p8cQP3LIvikCv1y9om198Egm 1lwJ3s04SeztseFpjlv+VYOCvHueoMnfx9Sre212VmJCbshKgYT8Y3dR8JuaCk/gffgxuS sYF6DX8wErU928PPLrOKhBDxXokPG7Y0uWQoUY6plGu12iohYHZdD13yzuJ428SsQnH12D +AajRqUkOtEmGuM2RUFJpYiaC+99PZIkd2eU0NhcIwuz80SXY6qvITscT8EstNqWMeWUiD WZsX3AWIzA9AriToMRo+byQ1Q8KYJbs/h7sPG8NYEiHf5tqGGFy6NL1WWlQdyg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668697686; 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=U0EA+g4Bcyz2I47A6x9+qV6VZ1P347eeX/eR5+TVmlc=; b=jTQUljMiEQonEh0A1SUtxKm1P2jpyyYx7CKlYAlqA606+UxM8/luK7cXsjJKJyadEWKd2F N1h5Z2VAIF6BmmAg== From: "tip-bot2 for Ahmed S. Darwish" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] PCI/MSI: Move pci_msix_vec_count() to api.c Cc: "Ahmed S. Darwish" , Thomas Gleixner , Bjorn Helgaas , x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20221111122015.099461602@linutronix.de> References: <20221111122015.099461602@linutronix.de> MIME-Version: 1.0 Message-ID: <166869768535.4906.5642923343631874738.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749208378296062517?= X-GMAIL-MSGID: =?utf-8?q?1749756538169791466?= The following commit has been merged into the irq/core branch of tip: Commit-ID: 7b50f62776672e7b328455eddc90ceb01b64ac3e Gitweb: https://git.kernel.org/tip/7b50f62776672e7b328455eddc90ceb01b64ac3e Author: Ahmed S. Darwish AuthorDate: Fri, 11 Nov 2022 14:54:56 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 17 Nov 2022 15:15:21 +01:00 PCI/MSI: Move pci_msix_vec_count() to api.c To disentangle the maze in msi.c, all exported device-driver MSI APIs are now to be grouped in one file, api.c. Move pci_msix_vec_count() and make its kernel-doc comprehensive. Signed-off-by: Ahmed S. Darwish Signed-off-by: Thomas Gleixner Acked-by: Bjorn Helgaas Link: https://lore.kernel.org/r/20221111122015.099461602@linutronix.de --- drivers/pci/msi/api.c | 20 ++++++++++++++++++++ drivers/pci/msi/msi.c | 20 -------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/pci/msi/api.c b/drivers/pci/msi/api.c index 2ff2a9c..83ea38f 100644 --- a/drivers/pci/msi/api.c +++ b/drivers/pci/msi/api.c @@ -60,6 +60,26 @@ void pci_disable_msi(struct pci_dev *dev) EXPORT_SYMBOL(pci_disable_msi); /** + * pci_msix_vec_count() - Get number of MSI-X interrupt vectors on device + * @dev: the PCI device to operate on + * + * Return: number of MSI-X interrupt vectors available on this device + * (i.e., the device's MSI-X capability structure "table size"), -EINVAL + * if the device is not MSI-X capable, other errnos otherwise. + */ +int pci_msix_vec_count(struct pci_dev *dev) +{ + u16 control; + + if (!dev->msix_cap) + return -EINVAL; + + pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &control); + return msix_table_size(control); +} +EXPORT_SYMBOL(pci_msix_vec_count); + +/** * pci_enable_msix_range() - Enable MSI-X interrupt mode on device * @dev: the PCI device to operate on * @entries: input/output parameter, array of MSI-X configuration entries diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index ed8caf5..1226d66 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -701,26 +701,6 @@ void pci_msi_shutdown(struct pci_dev *dev) pcibios_alloc_irq(dev); } -/** - * pci_msix_vec_count - return the number of device's MSI-X table entries - * @dev: pointer to the pci_dev data structure of MSI-X device function - * This function returns the number of device's MSI-X table entries and - * therefore the number of MSI-X vectors device is capable of sending. - * It returns a negative errno if the device is not capable of sending MSI-X - * interrupts. - **/ -int pci_msix_vec_count(struct pci_dev *dev) -{ - u16 control; - - if (!dev->msix_cap) - return -EINVAL; - - pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &control); - return msix_table_size(control); -} -EXPORT_SYMBOL(pci_msix_vec_count); - static int __pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec, struct irq_affinity *affd, int flags) {