mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
irqchip/ls-scfg-msi: Switch to use msi_create_parent_irq_domain()
Move away from the legacy MSI domain setup, switch to use msi_create_parent_irq_domain(). Signed-off-by: Nam Cao <namcao@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/6d23d93fa1f1e65526698f97c9888fa5d12abc7b.1750860131.git.namcao@linutronix.de
This commit is contained in:
parent
bafb290131
commit
94b59d5f56
2 changed files with 22 additions and 26 deletions
|
@ -436,6 +436,7 @@ config LS_SCFG_MSI
|
||||||
def_bool y if SOC_LS1021A || ARCH_LAYERSCAPE
|
def_bool y if SOC_LS1021A || ARCH_LAYERSCAPE
|
||||||
select IRQ_MSI_IOMMU
|
select IRQ_MSI_IOMMU
|
||||||
depends on PCI_MSI
|
depends on PCI_MSI
|
||||||
|
select IRQ_MSI_LIB
|
||||||
|
|
||||||
config PARTITION_PERCPU
|
config PARTITION_PERCPU
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <linux/iommu.h>
|
#include <linux/iommu.h>
|
||||||
#include <linux/irq.h>
|
#include <linux/irq.h>
|
||||||
#include <linux/irqchip/chained_irq.h>
|
#include <linux/irqchip/chained_irq.h>
|
||||||
|
#include <linux/irqchip/irq-msi-lib.h>
|
||||||
#include <linux/irqdomain.h>
|
#include <linux/irqdomain.h>
|
||||||
#include <linux/of_irq.h>
|
#include <linux/of_irq.h>
|
||||||
#include <linux/of_pci.h>
|
#include <linux/of_pci.h>
|
||||||
|
@ -47,7 +48,6 @@ struct ls_scfg_msi {
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
struct irq_domain *parent;
|
struct irq_domain *parent;
|
||||||
struct irq_domain *msi_domain;
|
|
||||||
void __iomem *regs;
|
void __iomem *regs;
|
||||||
phys_addr_t msiir_addr;
|
phys_addr_t msiir_addr;
|
||||||
struct ls_scfg_msi_cfg *cfg;
|
struct ls_scfg_msi_cfg *cfg;
|
||||||
|
@ -57,17 +57,18 @@ struct ls_scfg_msi {
|
||||||
unsigned long *used;
|
unsigned long *used;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct irq_chip ls_scfg_msi_irq_chip = {
|
#define MPIC_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \
|
||||||
.name = "MSI",
|
MSI_FLAG_USE_DEF_CHIP_OPS)
|
||||||
.irq_mask = pci_msi_mask_irq,
|
#define MPIC_MSI_FLAGS_SUPPORTED (MSI_FLAG_PCI_MSIX | \
|
||||||
.irq_unmask = pci_msi_unmask_irq,
|
MSI_GENERIC_FLAGS_MASK)
|
||||||
};
|
|
||||||
|
|
||||||
static struct msi_domain_info ls_scfg_msi_domain_info = {
|
static const struct msi_parent_ops ls_scfg_msi_parent_ops = {
|
||||||
.flags = (MSI_FLAG_USE_DEF_DOM_OPS |
|
.required_flags = MPIC_MSI_FLAGS_REQUIRED,
|
||||||
MSI_FLAG_USE_DEF_CHIP_OPS |
|
.supported_flags = MPIC_MSI_FLAGS_SUPPORTED,
|
||||||
MSI_FLAG_PCI_MSIX),
|
.bus_select_token = DOMAIN_BUS_NEXUS,
|
||||||
.chip = &ls_scfg_msi_irq_chip,
|
.bus_select_mask = MATCH_PCI_MSI,
|
||||||
|
.prefix = "MSI-",
|
||||||
|
.init_dev_msi_info = msi_lib_init_dev_msi_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int msi_affinity_flag = 1;
|
static int msi_affinity_flag = 1;
|
||||||
|
@ -185,6 +186,7 @@ static void ls_scfg_msi_domain_irq_free(struct irq_domain *domain,
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct irq_domain_ops ls_scfg_msi_domain_ops = {
|
static const struct irq_domain_ops ls_scfg_msi_domain_ops = {
|
||||||
|
.select = msi_lib_irq_domain_select,
|
||||||
.alloc = ls_scfg_msi_domain_irq_alloc,
|
.alloc = ls_scfg_msi_domain_irq_alloc,
|
||||||
.free = ls_scfg_msi_domain_irq_free,
|
.free = ls_scfg_msi_domain_irq_free,
|
||||||
};
|
};
|
||||||
|
@ -214,21 +216,15 @@ static void ls_scfg_msi_irq_handler(struct irq_desc *desc)
|
||||||
|
|
||||||
static int ls_scfg_msi_domains_init(struct ls_scfg_msi *msi_data)
|
static int ls_scfg_msi_domains_init(struct ls_scfg_msi *msi_data)
|
||||||
{
|
{
|
||||||
/* Initialize MSI domain parent */
|
struct irq_domain_info info = {
|
||||||
msi_data->parent = irq_domain_create_linear(NULL,
|
.fwnode = of_fwnode_handle(msi_data->pdev->dev.of_node),
|
||||||
msi_data->irqs_num,
|
.ops = &ls_scfg_msi_domain_ops,
|
||||||
&ls_scfg_msi_domain_ops,
|
.host_data = msi_data,
|
||||||
msi_data);
|
.size = msi_data->irqs_num,
|
||||||
if (!msi_data->parent) {
|
};
|
||||||
dev_err(&msi_data->pdev->dev, "failed to create IRQ domain\n");
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
msi_data->msi_domain = pci_msi_create_irq_domain(
|
msi_data->parent = msi_create_parent_irq_domain(&info, &ls_scfg_msi_parent_ops);
|
||||||
of_fwnode_handle(msi_data->pdev->dev.of_node),
|
if (!msi_data->parent) {
|
||||||
&ls_scfg_msi_domain_info,
|
|
||||||
msi_data->parent);
|
|
||||||
if (!msi_data->msi_domain) {
|
|
||||||
dev_err(&msi_data->pdev->dev, "failed to create MSI domain\n");
|
dev_err(&msi_data->pdev->dev, "failed to create MSI domain\n");
|
||||||
irq_domain_remove(msi_data->parent);
|
irq_domain_remove(msi_data->parent);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -405,7 +401,6 @@ static void ls_scfg_msi_remove(struct platform_device *pdev)
|
||||||
for (i = 0; i < msi_data->msir_num; i++)
|
for (i = 0; i < msi_data->msir_num; i++)
|
||||||
ls_scfg_msi_teardown_hwirq(&msi_data->msir[i]);
|
ls_scfg_msi_teardown_hwirq(&msi_data->msir[i]);
|
||||||
|
|
||||||
irq_domain_remove(msi_data->msi_domain);
|
|
||||||
irq_domain_remove(msi_data->parent);
|
irq_domain_remove(msi_data->parent);
|
||||||
|
|
||||||
platform_set_drvdata(pdev, NULL);
|
platform_set_drvdata(pdev, NULL);
|
||||||
|
|
Loading…
Add table
Reference in a new issue