lkml.org 
[lkml]   [2021]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[tip: irq/msi] PCI/MSI: Split out CONFIG_PCI_MSI independent part
    The following commit has been merged into the irq/msi branch of tip:

    Commit-ID: 54324c2f3d728f451d9053fcc7859b26fc9cecb4
    Gitweb: https://git.kernel.org/tip/54324c2f3d728f451d9053fcc7859b26fc9cecb4
    Author: Thomas Gleixner <tglx@linutronix.de>
    AuthorDate: Mon, 06 Dec 2021 23:27:49 +01:00
    Committer: Thomas Gleixner <tglx@linutronix.de>
    CommitterDate: Thu, 09 Dec 2021 11:52:22 +01:00

    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

    ---
    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(-)
    create mode 100644 drivers/pci/msi/pcidev_msi.c

    diff --git a/drivers/pci/msi/Makefile b/drivers/pci/msi/Makefile
    index 79a6013..8ed69b3 100644
    --- 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
    diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
    index 00233b0..a32345d 100644
    --- 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(struct pci_dev *pdev)
    }

    #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);
    -}
    diff --git a/drivers/pci/msi/pcidev_msi.c b/drivers/pci/msi/pcidev_msi.c
    new file mode 100644
    index 0000000..5520aff
    --- /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);
    + }
    +}
    \
     
     \ /
      Last update: 2021-12-09 17:07    [W:4.263 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site