|
7 | 7 | #include <linux/bitfield.h> |
8 | 8 | #include <linux/interrupt.h> |
9 | 9 | #include <linux/irq.h> |
| 10 | +#include <linux/irqchip/irq-msi-lib.h> |
10 | 11 | #include <linux/irqdomain.h> |
11 | 12 | #include <linux/kernel.h> |
12 | 13 | #include <linux/module.h> |
@@ -90,7 +91,6 @@ struct xilinx_pl_dma_variant { |
90 | 91 | }; |
91 | 92 |
|
92 | 93 | struct xilinx_msi { |
93 | | - struct irq_domain *msi_domain; |
94 | 94 | unsigned long *bitmap; |
95 | 95 | struct irq_domain *dev_domain; |
96 | 96 | struct mutex lock; /* Protect bitmap variable */ |
@@ -373,20 +373,20 @@ static irqreturn_t xilinx_pl_dma_pcie_intr_handler(int irq, void *dev_id) |
373 | 373 | return IRQ_HANDLED; |
374 | 374 | } |
375 | 375 |
|
376 | | -static struct irq_chip xilinx_msi_irq_chip = { |
377 | | - .name = "pl_dma:PCIe MSI", |
378 | | - .irq_enable = pci_msi_unmask_irq, |
379 | | - .irq_disable = pci_msi_mask_irq, |
380 | | - .irq_mask = pci_msi_mask_irq, |
381 | | - .irq_unmask = pci_msi_unmask_irq, |
382 | | -}; |
| 376 | +#define XILINX_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ |
| 377 | + MSI_FLAG_USE_DEF_CHIP_OPS | \ |
| 378 | + MSI_FLAG_NO_AFFINITY) |
383 | 379 |
|
384 | | -static struct msi_domain_info xilinx_msi_domain_info = { |
385 | | - .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | |
386 | | - MSI_FLAG_NO_AFFINITY | MSI_FLAG_MULTI_PCI_MSI, |
387 | | - .chip = &xilinx_msi_irq_chip, |
388 | | -}; |
| 380 | +#define XILINX_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \ |
| 381 | + MSI_FLAG_MULTI_PCI_MSI) |
389 | 382 |
|
| 383 | +static const struct msi_parent_ops xilinx_msi_parent_ops = { |
| 384 | + .required_flags = XILINX_MSI_FLAGS_REQUIRED, |
| 385 | + .supported_flags = XILINX_MSI_FLAGS_SUPPORTED, |
| 386 | + .bus_select_token = DOMAIN_BUS_PCI_MSI, |
| 387 | + .prefix = "pl_dma-", |
| 388 | + .init_dev_msi_info = msi_lib_init_dev_msi_info, |
| 389 | +}; |
390 | 390 | static void xilinx_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) |
391 | 391 | { |
392 | 392 | struct pl_dma_pcie *pcie = irq_data_get_irq_chip_data(data); |
@@ -458,31 +458,24 @@ static void xilinx_pl_dma_pcie_free_irq_domains(struct pl_dma_pcie *port) |
458 | 458 | irq_domain_remove(msi->dev_domain); |
459 | 459 | msi->dev_domain = NULL; |
460 | 460 | } |
461 | | - |
462 | | - if (msi->msi_domain) { |
463 | | - irq_domain_remove(msi->msi_domain); |
464 | | - msi->msi_domain = NULL; |
465 | | - } |
466 | 461 | } |
467 | 462 |
|
468 | 463 | static int xilinx_pl_dma_pcie_init_msi_irq_domain(struct pl_dma_pcie *port) |
469 | 464 | { |
470 | 465 | struct device *dev = port->dev; |
471 | 466 | struct xilinx_msi *msi = &port->msi; |
472 | 467 | int size = BITS_TO_LONGS(XILINX_NUM_MSI_IRQS) * sizeof(long); |
473 | | - struct fwnode_handle *fwnode = dev_fwnode(port->dev); |
474 | | - |
475 | | - msi->dev_domain = irq_domain_create_linear(NULL, XILINX_NUM_MSI_IRQS, |
476 | | - &dev_msi_domain_ops, port); |
| 468 | + struct irq_domain_info info = { |
| 469 | + .fwnode = dev_fwnode(port->dev), |
| 470 | + .ops = &dev_msi_domain_ops, |
| 471 | + .host_data = port, |
| 472 | + .size = XILINX_NUM_MSI_IRQS, |
| 473 | + }; |
| 474 | + |
| 475 | + msi->dev_domain = msi_create_parent_irq_domain(&info, &xilinx_msi_parent_ops); |
477 | 476 | if (!msi->dev_domain) |
478 | 477 | goto out; |
479 | 478 |
|
480 | | - msi->msi_domain = pci_msi_create_irq_domain(fwnode, |
481 | | - &xilinx_msi_domain_info, |
482 | | - msi->dev_domain); |
483 | | - if (!msi->msi_domain) |
484 | | - goto out; |
485 | | - |
486 | 479 | mutex_init(&msi->lock); |
487 | 480 | msi->bitmap = kzalloc(size, GFP_KERNEL); |
488 | 481 | if (!msi->bitmap) |
|
0 commit comments