Skip to content

Commit dd26c1a

Browse files
covanambjorn-helgaas
authored andcommitted
PCI: rcar-host: 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, drop fwnode local var] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://patch.msgid.link/ab4005db0a829549be1f348f6c27be50a2118b5e.1750858083.git.namcao@linutronix.de
1 parent e449cb9 commit dd26c1a

2 files changed

Lines changed: 26 additions & 45 deletions

File tree

drivers/pci/controller/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ config PCIE_RCAR_HOST
243243
bool "Renesas R-Car PCIe controller (host mode)"
244244
depends on ARCH_RENESAS || COMPILE_TEST
245245
depends on PCI_MSI
246+
select IRQ_MSI_LIB
246247
help
247248
Say Y here if you want PCIe controller support on R-Car SoCs in host
248249
mode.

drivers/pci/controller/pcie-rcar-host.c

Lines changed: 25 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/delay.h>
1818
#include <linux/interrupt.h>
1919
#include <linux/irq.h>
20+
#include <linux/irqchip/irq-msi-lib.h>
2021
#include <linux/irqdomain.h>
2122
#include <linux/kernel.h>
2223
#include <linux/init.h>
@@ -597,30 +598,6 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)
597598
return IRQ_HANDLED;
598599
}
599600

600-
static void rcar_msi_top_irq_ack(struct irq_data *d)
601-
{
602-
irq_chip_ack_parent(d);
603-
}
604-
605-
static void rcar_msi_top_irq_mask(struct irq_data *d)
606-
{
607-
pci_msi_mask_irq(d);
608-
irq_chip_mask_parent(d);
609-
}
610-
611-
static void rcar_msi_top_irq_unmask(struct irq_data *d)
612-
{
613-
pci_msi_unmask_irq(d);
614-
irq_chip_unmask_parent(d);
615-
}
616-
617-
static struct irq_chip rcar_msi_top_chip = {
618-
.name = "PCIe MSI",
619-
.irq_ack = rcar_msi_top_irq_ack,
620-
.irq_mask = rcar_msi_top_irq_mask,
621-
.irq_unmask = rcar_msi_top_irq_unmask,
622-
};
623-
624601
static void rcar_msi_irq_ack(struct irq_data *d)
625602
{
626603
struct rcar_msi *msi = irq_data_get_irq_chip_data(d);
@@ -718,30 +695,36 @@ static const struct irq_domain_ops rcar_msi_domain_ops = {
718695
.free = rcar_msi_domain_free,
719696
};
720697

721-
static struct msi_domain_info rcar_msi_info = {
722-
.flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
723-
MSI_FLAG_NO_AFFINITY | MSI_FLAG_MULTI_PCI_MSI,
724-
.chip = &rcar_msi_top_chip,
698+
#define RCAR_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \
699+
MSI_FLAG_USE_DEF_CHIP_OPS | \
700+
MSI_FLAG_PCI_MSI_MASK_PARENT | \
701+
MSI_FLAG_NO_AFFINITY)
702+
703+
#define RCAR_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \
704+
MSI_FLAG_MULTI_PCI_MSI)
705+
706+
static const struct msi_parent_ops rcar_msi_parent_ops = {
707+
.required_flags = RCAR_MSI_FLAGS_REQUIRED,
708+
.supported_flags = RCAR_MSI_FLAGS_SUPPORTED,
709+
.bus_select_token = DOMAIN_BUS_PCI_MSI,
710+
.chip_flags = MSI_CHIP_FLAG_SET_ACK,
711+
.prefix = "RCAR-",
712+
.init_dev_msi_info = msi_lib_init_dev_msi_info,
725713
};
726714

727715
static int rcar_allocate_domains(struct rcar_msi *msi)
728716
{
729717
struct rcar_pcie *pcie = &msi_to_host(msi)->pcie;
730-
struct fwnode_handle *fwnode = dev_fwnode(pcie->dev);
731-
struct irq_domain *parent;
732-
733-
parent = irq_domain_create_linear(fwnode, INT_PCI_MSI_NR,
734-
&rcar_msi_domain_ops, msi);
735-
if (!parent) {
736-
dev_err(pcie->dev, "failed to create IRQ domain\n");
737-
return -ENOMEM;
738-
}
739-
irq_domain_update_bus_token(parent, DOMAIN_BUS_NEXUS);
740-
741-
msi->domain = pci_msi_create_irq_domain(fwnode, &rcar_msi_info, parent);
718+
struct irq_domain_info info = {
719+
.fwnode = dev_fwnode(pcie->dev),
720+
.ops = &rcar_msi_domain_ops,
721+
.host_data = msi,
722+
.size = INT_PCI_MSI_NR,
723+
};
724+
725+
msi->domain = msi_create_parent_irq_domain(&info, &rcar_msi_parent_ops);
742726
if (!msi->domain) {
743-
dev_err(pcie->dev, "failed to create MSI domain\n");
744-
irq_domain_remove(parent);
727+
dev_err(pcie->dev, "failed to create IRQ domain\n");
745728
return -ENOMEM;
746729
}
747730

@@ -750,10 +733,7 @@ static int rcar_allocate_domains(struct rcar_msi *msi)
750733

751734
static void rcar_free_domains(struct rcar_msi *msi)
752735
{
753-
struct irq_domain *parent = msi->domain->parent;
754-
755736
irq_domain_remove(msi->domain);
756-
irq_domain_remove(parent);
757737
}
758738

759739
static int rcar_pcie_enable_msi(struct rcar_pcie_host *host)

0 commit comments

Comments
 (0)