mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
PCI: altera-msi: Switch to msi_create_parent_irq_domain()
Switch to msi_create_parent_irq_domain() from pci_msi_create_irq_domain() which was using legacy MSI domain setup. Signed-off-by: Nam Cao <namcao@linutronix.de> [mani: reworded commit message] Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> [bhelgaas: rebase on dev_fwnode() conversion] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://patch.msgid.link/0a88da04bb82bd588828a7889e9d58c515ea5dbb.1750858083.git.namcao@linutronix.de
This commit is contained in:
@@ -30,6 +30,7 @@ config PCIE_ALTERA_MSI
|
||||
tristate "Altera PCIe MSI feature"
|
||||
depends on PCIE_ALTERA
|
||||
depends on PCI_MSI
|
||||
select IRQ_MSI_LIB
|
||||
help
|
||||
Say Y here if you want PCIe MSI support for the Altera FPGA.
|
||||
This MSI driver supports Altera MSI to GIC controller IP.
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/irqchip/chained_irq.h>
|
||||
#include <linux/irqchip/irq-msi-lib.h>
|
||||
#include <linux/irqdomain.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
@@ -29,7 +30,6 @@ struct altera_msi {
|
||||
DECLARE_BITMAP(used, MAX_MSI_VECTORS);
|
||||
struct mutex lock; /* protect "used" bitmap */
|
||||
struct platform_device *pdev;
|
||||
struct irq_domain *msi_domain;
|
||||
struct irq_domain *inner_domain;
|
||||
void __iomem *csr_base;
|
||||
void __iomem *vector_base;
|
||||
@@ -74,18 +74,20 @@ static void altera_msi_isr(struct irq_desc *desc)
|
||||
chained_irq_exit(chip, desc);
|
||||
}
|
||||
|
||||
static struct irq_chip altera_msi_irq_chip = {
|
||||
.name = "Altera PCIe MSI",
|
||||
.irq_mask = pci_msi_mask_irq,
|
||||
.irq_unmask = pci_msi_unmask_irq,
|
||||
};
|
||||
#define ALTERA_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \
|
||||
MSI_FLAG_USE_DEF_CHIP_OPS | \
|
||||
MSI_FLAG_NO_AFFINITY)
|
||||
|
||||
static struct msi_domain_info altera_msi_domain_info = {
|
||||
.flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
|
||||
MSI_FLAG_NO_AFFINITY | MSI_FLAG_PCI_MSIX,
|
||||
.chip = &altera_msi_irq_chip,
|
||||
};
|
||||
#define ALTERA_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \
|
||||
MSI_FLAG_PCI_MSIX)
|
||||
|
||||
static const struct msi_parent_ops altera_msi_parent_ops = {
|
||||
.required_flags = ALTERA_MSI_FLAGS_REQUIRED,
|
||||
.supported_flags = ALTERA_MSI_FLAGS_SUPPORTED,
|
||||
.bus_select_token = DOMAIN_BUS_PCI_MSI,
|
||||
.prefix = "Altera-",
|
||||
.init_dev_msi_info = msi_lib_init_dev_msi_info,
|
||||
};
|
||||
static void altera_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
|
||||
{
|
||||
struct altera_msi *msi = irq_data_get_irq_chip_data(data);
|
||||
@@ -164,20 +166,16 @@ static const struct irq_domain_ops msi_domain_ops = {
|
||||
|
||||
static int altera_allocate_domains(struct altera_msi *msi)
|
||||
{
|
||||
struct fwnode_handle *fwnode = dev_fwnode(&msi->pdev->dev);
|
||||
struct irq_domain_info info = {
|
||||
.fwnode = dev_fwnode(&msi->pdev->dev),
|
||||
.ops = &msi_domain_ops,
|
||||
.host_data = msi,
|
||||
.size = msi->num_of_vectors,
|
||||
};
|
||||
|
||||
msi->inner_domain = irq_domain_create_linear(NULL, msi->num_of_vectors,
|
||||
&msi_domain_ops, msi);
|
||||
msi->inner_domain = msi_create_parent_irq_domain(&info, &altera_msi_parent_ops);
|
||||
if (!msi->inner_domain) {
|
||||
dev_err(&msi->pdev->dev, "failed to create IRQ domain\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
msi->msi_domain = pci_msi_create_irq_domain(fwnode,
|
||||
&altera_msi_domain_info, msi->inner_domain);
|
||||
if (!msi->msi_domain) {
|
||||
dev_err(&msi->pdev->dev, "failed to create MSI domain\n");
|
||||
irq_domain_remove(msi->inner_domain);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -186,7 +184,6 @@ static int altera_allocate_domains(struct altera_msi *msi)
|
||||
|
||||
static void altera_free_domains(struct altera_msi *msi)
|
||||
{
|
||||
irq_domain_remove(msi->msi_domain);
|
||||
irq_domain_remove(msi->inner_domain);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user