|
11 | 11 | #include <linux/align.h>
|
12 | 12 | #include <linux/bitfield.h>
|
13 | 13 | #include <linux/irqchip/chained_irq.h>
|
| 14 | +#include <linux/irqchip/irq-msi-lib.h> |
14 | 15 | #include <linux/irqdomain.h>
|
15 | 16 | #include <linux/msi.h>
|
16 | 17 | #include <linux/pci_regs.h>
|
@@ -134,42 +135,41 @@ static const struct irq_domain_ops msi_domain_ops = {
|
134 | 135 | .free = plda_irq_msi_domain_free,
|
135 | 136 | };
|
136 | 137 |
|
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, |
148 | 151 | };
|
149 | 152 |
|
150 | 153 | static int plda_allocate_msi_domains(struct plda_pcie_rp *port)
|
151 | 154 | {
|
152 | 155 | struct device *dev = port->dev;
|
153 |
| - struct fwnode_handle *fwnode = dev_fwnode(dev); |
154 | 156 | struct plda_msi *msi = &port->msi;
|
155 | 157 |
|
156 | 158 | mutex_init(&port->msi.lock);
|
157 | 159 |
|
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); |
159 | 168 | if (!msi->dev_domain) {
|
160 | 169 | dev_err(dev, "failed to create IRQ domain\n");
|
161 | 170 | return -ENOMEM;
|
162 | 171 | }
|
163 | 172 |
|
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 |
| - |
173 | 173 | return 0;
|
174 | 174 | }
|
175 | 175 |
|
@@ -563,7 +563,6 @@ static void plda_pcie_irq_domain_deinit(struct plda_pcie_rp *pcie)
|
563 | 563 | irq_set_chained_handler_and_data(pcie->msi_irq, NULL, NULL);
|
564 | 564 | irq_set_chained_handler_and_data(pcie->intx_irq, NULL, NULL);
|
565 | 565 |
|
566 |
| - irq_domain_remove(pcie->msi.msi_domain); |
567 | 566 | irq_domain_remove(pcie->msi.dev_domain);
|
568 | 567 |
|
569 | 568 | irq_domain_remove(pcie->intx_domain);
|
|
0 commit comments