Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI/MSI: Split out CONFIG_PCI_MSI independent part

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>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20211206210224.710137730@linutronix.de

+45 -40
+2 -1
drivers/pci/msi/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # 3 3 # Makefile for the PCI/MSI 4 - obj-$(CONFIG_PCI) += msi.o 4 + obj-$(CONFIG_PCI) += pcidev_msi.o 5 + obj-$(CONFIG_PCI_MSI) += msi.o
-39
drivers/pci/msi/msi.c
··· 18 18 19 19 #include "../pci.h" 20 20 21 - #ifdef CONFIG_PCI_MSI 22 - 23 21 static int pci_msi_enable = 1; 24 22 int pci_msi_ignore_mask; 25 23 ··· 1491 1493 } 1492 1494 1493 1495 #endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */ 1494 - #endif /* CONFIG_PCI_MSI */ 1495 - 1496 - void pci_msi_init(struct pci_dev *dev) 1497 - { 1498 - u16 ctrl; 1499 - 1500 - /* 1501 - * Disable the MSI hardware to avoid screaming interrupts 1502 - * during boot. This is the power on reset default so 1503 - * usually this should be a noop. 1504 - */ 1505 - dev->msi_cap = pci_find_capability(dev, PCI_CAP_ID_MSI); 1506 - if (!dev->msi_cap) 1507 - return; 1508 - 1509 - pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &ctrl); 1510 - if (ctrl & PCI_MSI_FLAGS_ENABLE) 1511 - pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, 1512 - ctrl & ~PCI_MSI_FLAGS_ENABLE); 1513 - 1514 - if (!(ctrl & PCI_MSI_FLAGS_64BIT)) 1515 - dev->no_64bit_msi = 1; 1516 - } 1517 - 1518 - void pci_msix_init(struct pci_dev *dev) 1519 - { 1520 - u16 ctrl; 1521 - 1522 - dev->msix_cap = pci_find_capability(dev, PCI_CAP_ID_MSIX); 1523 - if (!dev->msix_cap) 1524 - return; 1525 - 1526 - pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &ctrl); 1527 - if (ctrl & PCI_MSIX_FLAGS_ENABLE) 1528 - pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, 1529 - ctrl & ~PCI_MSIX_FLAGS_ENABLE); 1530 - }
+43
drivers/pci/msi/pcidev_msi.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * MSI[X} related functions which are available unconditionally. 4 + */ 5 + #include "../pci.h" 6 + 7 + /* 8 + * Disable the MSI[X] hardware to avoid screaming interrupts during boot. 9 + * This is the power on reset default so usually this should be a noop. 10 + */ 11 + 12 + void pci_msi_init(struct pci_dev *dev) 13 + { 14 + u16 ctrl; 15 + 16 + dev->msi_cap = pci_find_capability(dev, PCI_CAP_ID_MSI); 17 + if (!dev->msi_cap) 18 + return; 19 + 20 + pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &ctrl); 21 + if (ctrl & PCI_MSI_FLAGS_ENABLE) { 22 + pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, 23 + ctrl & ~PCI_MSI_FLAGS_ENABLE); 24 + } 25 + 26 + if (!(ctrl & PCI_MSI_FLAGS_64BIT)) 27 + dev->no_64bit_msi = 1; 28 + } 29 + 30 + void pci_msix_init(struct pci_dev *dev) 31 + { 32 + u16 ctrl; 33 + 34 + dev->msix_cap = pci_find_capability(dev, PCI_CAP_ID_MSIX); 35 + if (!dev->msix_cap) 36 + return; 37 + 38 + pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &ctrl); 39 + if (ctrl & PCI_MSIX_FLAGS_ENABLE) { 40 + pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, 41 + ctrl & ~PCI_MSIX_FLAGS_ENABLE); 42 + } 43 + }