From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: linux-hyperv@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
sparclinux@vger.kernel.org, Wei Liu <wei.liu@kernel.org>,
Ashok Raj <ashok.raj@intel.com>,
x86@kernel.org, Christian Borntraeger <borntraeger@de.ibm.com>,
Bjorn Helgaas <helgaas@kernel.org>,
Megha Dey <megha.dey@intel.com>, Jason Gunthorpe <jgg@nvidia.com>,
linux-pci@vger.kernel.org, xen-devel@lists.xenproject.org,
ath11k@lists.infradead.org, Kevin Tian <kevin.tian@intel.com>,
Heiko Carstens <hca@linux.ibm.com>,
Alex Williamson <alex.williamson@redhat.com>,
Cedric Le Goater <clg@kaod.org>,
Kalle Valo <kvalo@codeaurora.org>,
Juergen Gross <jgross@suse.com>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-mips@vger.kernel.org, Marc Zygnier <maz@kernel.org>,
linuxppc-dev@lists.ozlabs.org
Subject: [patch V2 16/23] PCI/MSI: Split out CONFIG_PCI_MSI independent part
Date: Mon, 6 Dec 2021 23:27:49 +0100 (CET) [thread overview]
Message-ID: <20211206210224.710137730@linutronix.de> (raw)
In-Reply-To: 20211206210147.872865823@linutronix.de
These functions are required even when CONFIG_PCI_MSI is not set. Move them
to their own file.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
---
drivers/pci/msi/Makefile | 3 ++-
drivers/pci/msi/msi.c | 39 ---------------------------------------
drivers/pci/msi/pcidev_msi.c | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 40 deletions(-)
--- a/drivers/pci/msi/Makefile
+++ b/drivers/pci/msi/Makefile
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the PCI/MSI
-obj-$(CONFIG_PCI) += msi.o
+obj-$(CONFIG_PCI) += pcidev_msi.o
+obj-$(CONFIG_PCI_MSI) += msi.o
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -18,8 +18,6 @@
#include "../pci.h"
-#ifdef CONFIG_PCI_MSI
-
static int pci_msi_enable = 1;
int pci_msi_ignore_mask;
@@ -1493,40 +1491,3 @@ bool pci_dev_has_special_msi_domain(stru
}
#endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */
-#endif /* CONFIG_PCI_MSI */
-
-void pci_msi_init(struct pci_dev *dev)
-{
- u16 ctrl;
-
- /*
- * Disable the MSI hardware to avoid screaming interrupts
- * during boot. This is the power on reset default so
- * usually this should be a noop.
- */
- dev->msi_cap = pci_find_capability(dev, PCI_CAP_ID_MSI);
- if (!dev->msi_cap)
- return;
-
- pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &ctrl);
- if (ctrl & PCI_MSI_FLAGS_ENABLE)
- pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS,
- ctrl & ~PCI_MSI_FLAGS_ENABLE);
-
- if (!(ctrl & PCI_MSI_FLAGS_64BIT))
- dev->no_64bit_msi = 1;
-}
-
-void pci_msix_init(struct pci_dev *dev)
-{
- u16 ctrl;
-
- dev->msix_cap = pci_find_capability(dev, PCI_CAP_ID_MSIX);
- if (!dev->msix_cap)
- return;
-
- pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &ctrl);
- if (ctrl & PCI_MSIX_FLAGS_ENABLE)
- pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS,
- ctrl & ~PCI_MSIX_FLAGS_ENABLE);
-}
--- /dev/null
+++ b/drivers/pci/msi/pcidev_msi.c
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * MSI[X} related functions which are available unconditionally.
+ */
+#include "../pci.h"
+
+/*
+ * Disable the MSI[X] hardware to avoid screaming interrupts during boot.
+ * This is the power on reset default so usually this should be a noop.
+ */
+
+void pci_msi_init(struct pci_dev *dev)
+{
+ u16 ctrl;
+
+ dev->msi_cap = pci_find_capability(dev, PCI_CAP_ID_MSI);
+ if (!dev->msi_cap)
+ return;
+
+ pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &ctrl);
+ if (ctrl & PCI_MSI_FLAGS_ENABLE) {
+ pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS,
+ ctrl & ~PCI_MSI_FLAGS_ENABLE);
+ }
+
+ if (!(ctrl & PCI_MSI_FLAGS_64BIT))
+ dev->no_64bit_msi = 1;
+}
+
+void pci_msix_init(struct pci_dev *dev)
+{
+ u16 ctrl;
+
+ dev->msix_cap = pci_find_capability(dev, PCI_CAP_ID_MSIX);
+ if (!dev->msix_cap)
+ return;
+
+ pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &ctrl);
+ if (ctrl & PCI_MSIX_FLAGS_ENABLE) {
+ pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS,
+ ctrl & ~PCI_MSIX_FLAGS_ENABLE);
+ }
+}
next prev parent reply other threads:[~2021-12-06 22:38 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-06 22:27 [patch V2 00/23] genirq/msi, PCI/MSI: Spring cleaning - Part 1 Thomas Gleixner
2021-12-06 22:27 ` [patch V2 01/23] powerpc/4xx: Remove MSI support which never worked Thomas Gleixner
2021-12-07 7:21 ` Cédric Le Goater
2021-12-07 11:36 ` Michael Ellerman
2021-12-07 15:50 ` Cédric Le Goater
2021-12-07 20:42 ` Thomas Gleixner
2021-12-08 10:44 ` Cédric Le Goater
2021-12-06 22:27 ` [patch V2 02/23] PCI/MSI: Fix pci_irq_vector()/pci_irq_get_affinity() Thomas Gleixner
2021-12-07 20:53 ` Bjorn Helgaas
2021-12-06 22:27 ` [patch V2 03/23] genirq/msi: Guard sysfs code Thomas Gleixner
2021-12-07 7:42 ` Greg Kroah-Hartman
2021-12-06 22:27 ` [patch V2 04/23] genirq/msi: Remove unused domain callbacks Thomas Gleixner
2021-12-06 22:27 ` [patch V2 05/23] genirq/msi: Fixup includes Thomas Gleixner
2021-12-07 7:43 ` Greg Kroah-Hartman
2021-12-06 22:27 ` [patch V2 06/23] PCI/MSI: Make pci_msi_domain_write_msg() static Thomas Gleixner
2021-12-07 20:54 ` Bjorn Helgaas
2021-12-06 22:27 ` [patch V2 07/23] PCI/MSI: Remove msi_desc_to_pci_sysdata() Thomas Gleixner
2021-12-07 20:55 ` Bjorn Helgaas
2021-12-06 22:27 ` [patch V2 08/23] PCI/sysfs: Use pci_irq_vector() Thomas Gleixner
2021-12-07 7:43 ` Greg Kroah-Hartman
2021-12-07 20:56 ` Bjorn Helgaas
2021-12-06 22:27 ` [patch V2 09/23] MIPS: Octeon: Use arch_setup_msi_irq() Thomas Gleixner
2021-12-06 22:27 ` [patch V2 10/23] genirq/msi, treewide: Use a named struct for PCI/MSI attributes Thomas Gleixner
2021-12-07 7:44 ` Greg Kroah-Hartman
2021-12-06 22:27 ` [patch V2 11/23] x86/hyperv: Refactor hv_msi_domain_free_irqs() Thomas Gleixner
2021-12-06 22:27 ` [patch V2 12/23] PCI/MSI: Make arch_restore_msi_irqs() less horrible Thomas Gleixner
2021-12-07 20:56 ` Bjorn Helgaas
2021-12-06 22:27 ` [patch V2 13/23] PCI/MSI: Cleanup include zoo Thomas Gleixner
2021-12-07 20:57 ` Bjorn Helgaas
2021-12-06 22:27 ` [patch V2 14/23] PCI/MSI: Make msix_update_entries() smarter Thomas Gleixner
2021-12-07 7:44 ` Greg Kroah-Hartman
2021-12-07 20:57 ` Bjorn Helgaas
2021-12-06 22:27 ` [patch V2 15/23] PCI/MSI: Move code into a separate directory Thomas Gleixner
2021-12-07 20:57 ` Bjorn Helgaas
2021-12-06 22:27 ` Thomas Gleixner [this message]
2021-12-07 7:45 ` [patch V2 16/23] PCI/MSI: Split out CONFIG_PCI_MSI independent part Greg Kroah-Hartman
2021-12-07 20:58 ` Bjorn Helgaas
2021-12-06 22:27 ` [patch V2 17/23] PCI/MSI: Split out !IRQDOMAIN code Thomas Gleixner
2021-12-07 7:45 ` Greg Kroah-Hartman
2021-12-07 20:59 ` Bjorn Helgaas
2021-12-06 22:27 ` [patch V2 18/23] PCI/MSI: Split out irqdomain code Thomas Gleixner
2021-12-07 7:46 ` Greg Kroah-Hartman
2021-12-07 21:00 ` Bjorn Helgaas
2021-12-06 22:27 ` [patch V2 19/23] PCI/MSI: Sanitize MSIX table map handling Thomas Gleixner
2021-12-07 21:01 ` Bjorn Helgaas
2021-12-06 22:27 ` [patch V2 20/23] PCI/MSI: Move msi_lock to struct pci_dev Thomas Gleixner
2021-12-07 7:47 ` Greg Kroah-Hartman
2021-12-07 21:01 ` Bjorn Helgaas
2021-12-08 15:29 ` Jason Gunthorpe
2021-12-08 20:56 ` Thomas Gleixner
2021-12-06 22:27 ` [patch V2 21/23] PCI/MSI: Make pci_msi_domain_check_cap() static Thomas Gleixner
2021-12-07 7:47 ` Greg Kroah-Hartman
2021-12-07 21:01 ` Bjorn Helgaas
2021-12-06 22:27 ` [patch V2 22/23] genirq/msi: Handle PCI/MSI allocation fail in core code Thomas Gleixner
2021-12-07 7:48 ` Greg Kroah-Hartman
2021-12-07 21:02 ` Bjorn Helgaas
2021-12-06 22:28 ` [patch V2 23/23] PCI/MSI: Move descriptor counting on allocation fail to the legacy code Thomas Gleixner
2021-12-07 7:48 ` Greg Kroah-Hartman
2021-12-07 21:02 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211206210224.710137730@linutronix.de \
--to=tglx@linutronix.de \
--cc=alex.williamson@redhat.com \
--cc=ashok.raj@intel.com \
--cc=ath11k@lists.infradead.org \
--cc=borntraeger@de.ibm.com \
--cc=clg@kaod.org \
--cc=gregkh@linuxfoundation.org \
--cc=hca@linux.ibm.com \
--cc=helgaas@kernel.org \
--cc=jgg@nvidia.com \
--cc=jgross@suse.com \
--cc=kevin.tian@intel.com \
--cc=kvalo@codeaurora.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maz@kernel.org \
--cc=megha.dey@intel.com \
--cc=paulus@samba.org \
--cc=sparclinux@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
--cc=wei.liu@kernel.org \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).