Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: altera-msi: 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]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://patch.msgid.link/0a88da04bb82bd588828a7889e9d58c515ea5dbb.1750858083.git.namcao@linutronix.de

authored by

Nam Cao and committed by
Bjorn Helgaas
cf154ccc 75027704

+21 -23
+1
drivers/pci/controller/Kconfig
··· 30 30 tristate "Altera PCIe MSI feature" 31 31 depends on PCIE_ALTERA 32 32 depends on PCI_MSI 33 + select IRQ_MSI_LIB 33 34 help 34 35 Say Y here if you want PCIe MSI support for the Altera FPGA. 35 36 This MSI driver supports Altera MSI to GIC controller IP.
+20 -23
drivers/pci/controller/pcie-altera-msi.c
··· 9 9 10 10 #include <linux/interrupt.h> 11 11 #include <linux/irqchip/chained_irq.h> 12 + #include <linux/irqchip/irq-msi-lib.h> 12 13 #include <linux/irqdomain.h> 13 14 #include <linux/init.h> 14 15 #include <linux/module.h> ··· 30 29 DECLARE_BITMAP(used, MAX_MSI_VECTORS); 31 30 struct mutex lock; /* protect "used" bitmap */ 32 31 struct platform_device *pdev; 33 - struct irq_domain *msi_domain; 34 32 struct irq_domain *inner_domain; 35 33 void __iomem *csr_base; 36 34 void __iomem *vector_base; ··· 74 74 chained_irq_exit(chip, desc); 75 75 } 76 76 77 - static struct irq_chip altera_msi_irq_chip = { 78 - .name = "Altera PCIe MSI", 79 - .irq_mask = pci_msi_mask_irq, 80 - .irq_unmask = pci_msi_unmask_irq, 81 - }; 77 + #define ALTERA_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ 78 + MSI_FLAG_USE_DEF_CHIP_OPS | \ 79 + MSI_FLAG_NO_AFFINITY) 82 80 83 - static struct msi_domain_info altera_msi_domain_info = { 84 - .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | 85 - MSI_FLAG_NO_AFFINITY | MSI_FLAG_PCI_MSIX, 86 - .chip = &altera_msi_irq_chip, 87 - }; 81 + #define ALTERA_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \ 82 + MSI_FLAG_PCI_MSIX) 88 83 84 + static const struct msi_parent_ops altera_msi_parent_ops = { 85 + .required_flags = ALTERA_MSI_FLAGS_REQUIRED, 86 + .supported_flags = ALTERA_MSI_FLAGS_SUPPORTED, 87 + .bus_select_token = DOMAIN_BUS_PCI_MSI, 88 + .prefix = "Altera-", 89 + .init_dev_msi_info = msi_lib_init_dev_msi_info, 90 + }; 89 91 static void altera_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) 90 92 { 91 93 struct altera_msi *msi = irq_data_get_irq_chip_data(data); ··· 166 164 167 165 static int altera_allocate_domains(struct altera_msi *msi) 168 166 { 169 - struct fwnode_handle *fwnode = dev_fwnode(&msi->pdev->dev); 167 + struct irq_domain_info info = { 168 + .fwnode = dev_fwnode(&msi->pdev->dev), 169 + .ops = &msi_domain_ops, 170 + .host_data = msi, 171 + .size = msi->num_of_vectors, 172 + }; 170 173 171 - msi->inner_domain = irq_domain_create_linear(NULL, msi->num_of_vectors, 172 - &msi_domain_ops, msi); 174 + msi->inner_domain = msi_create_parent_irq_domain(&info, &altera_msi_parent_ops); 173 175 if (!msi->inner_domain) { 174 - dev_err(&msi->pdev->dev, "failed to create IRQ domain\n"); 175 - return -ENOMEM; 176 - } 177 - 178 - msi->msi_domain = pci_msi_create_irq_domain(fwnode, 179 - &altera_msi_domain_info, msi->inner_domain); 180 - if (!msi->msi_domain) { 181 176 dev_err(&msi->pdev->dev, "failed to create MSI domain\n"); 182 - irq_domain_remove(msi->inner_domain); 183 177 return -ENOMEM; 184 178 } 185 179 ··· 184 186 185 187 static void altera_free_domains(struct altera_msi *msi) 186 188 { 187 - irq_domain_remove(msi->msi_domain); 188 189 irq_domain_remove(msi->inner_domain); 189 190 } 190 191