Skip to content

Commit d7703cf

Browse files
covanambjorn-helgaas
authored andcommitted
PCI: plda: 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 <[email protected]> [mani: reworded commit message] Signed-off-by: Manivannan Sadhasivam <[email protected]> [bhelgaas: rebase on dev_fwnode() conversion, drop fwnode local var] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Link: https://patch.msgid.link/1279fe6500a1d8135d8f5feb2f055df008746c88.1750858083.git.namcao@linutronix.de
1 parent f29861a commit d7703cf

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

drivers/pci/controller/plda/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ menu "PLDA-based PCIe controllers"
55

66
config PCIE_PLDA_HOST
77
bool
8+
select IRQ_MSI_LIB
89

910
config PCIE_MICROCHIP_HOST
1011
tristate "Microchip AXI PCIe controller"

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

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/align.h>
1212
#include <linux/bitfield.h>
1313
#include <linux/irqchip/chained_irq.h>
14+
#include <linux/irqchip/irq-msi-lib.h>
1415
#include <linux/irqdomain.h>
1516
#include <linux/msi.h>
1617
#include <linux/pci_regs.h>
@@ -134,42 +135,41 @@ static const struct irq_domain_ops msi_domain_ops = {
134135
.free = plda_irq_msi_domain_free,
135136
};
136137

137-
static struct irq_chip plda_msi_irq_chip = {
138-
.name = "PLDA PCIe MSI",
139-
.irq_ack = irq_chip_ack_parent,
140-
.irq_mask = pci_msi_mask_irq,
141-
.irq_unmask = pci_msi_unmask_irq,
142-
};
143-
144-
static struct msi_domain_info plda_msi_domain_info = {
145-
.flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
146-
MSI_FLAG_NO_AFFINITY | MSI_FLAG_PCI_MSIX,
147-
.chip = &plda_msi_irq_chip,
138+
#define PLDA_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \
139+
MSI_FLAG_USE_DEF_CHIP_OPS | \
140+
MSI_FLAG_NO_AFFINITY)
141+
#define PLDA_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \
142+
MSI_FLAG_PCI_MSIX)
143+
144+
static const struct msi_parent_ops plda_msi_parent_ops = {
145+
.required_flags = PLDA_MSI_FLAGS_REQUIRED,
146+
.supported_flags = PLDA_MSI_FLAGS_SUPPORTED,
147+
.chip_flags = MSI_CHIP_FLAG_SET_ACK,
148+
.bus_select_token = DOMAIN_BUS_PCI_MSI,
149+
.prefix = "PLDA-",
150+
.init_dev_msi_info = msi_lib_init_dev_msi_info,
148151
};
149152

150153
static int plda_allocate_msi_domains(struct plda_pcie_rp *port)
151154
{
152155
struct device *dev = port->dev;
153-
struct fwnode_handle *fwnode = dev_fwnode(dev);
154156
struct plda_msi *msi = &port->msi;
155157

156158
mutex_init(&port->msi.lock);
157159

158-
msi->dev_domain = irq_domain_create_linear(NULL, msi->num_vectors, &msi_domain_ops, port);
160+
struct irq_domain_info info = {
161+
.fwnode = dev_fwnode(dev),
162+
.ops = &msi_domain_ops,
163+
.host_data = port,
164+
.size = msi->num_vectors,
165+
};
166+
167+
msi->dev_domain = msi_create_parent_irq_domain(&info, &plda_msi_parent_ops);
159168
if (!msi->dev_domain) {
160169
dev_err(dev, "failed to create IRQ domain\n");
161170
return -ENOMEM;
162171
}
163172

164-
msi->msi_domain = pci_msi_create_irq_domain(fwnode,
165-
&plda_msi_domain_info,
166-
msi->dev_domain);
167-
if (!msi->msi_domain) {
168-
dev_err(dev, "failed to create MSI domain\n");
169-
irq_domain_remove(msi->dev_domain);
170-
return -ENOMEM;
171-
}
172-
173173
return 0;
174174
}
175175

@@ -563,7 +563,6 @@ static void plda_pcie_irq_domain_deinit(struct plda_pcie_rp *pcie)
563563
irq_set_chained_handler_and_data(pcie->msi_irq, NULL, NULL);
564564
irq_set_chained_handler_and_data(pcie->intx_irq, NULL, NULL);
565565

566-
irq_domain_remove(pcie->msi.msi_domain);
567566
irq_domain_remove(pcie->msi.dev_domain);
568567

569568
irq_domain_remove(pcie->intx_domain);

drivers/pci/controller/plda/pcie-plda.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ struct plda_pcie_host_ops {
164164

165165
struct plda_msi {
166166
struct mutex lock; /* Protect used bitmap */
167-
struct irq_domain *msi_domain;
168167
struct irq_domain *dev_domain;
169168
u32 num_vectors;
170169
u64 vector_phy;

0 commit comments

Comments
 (0)