mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	PCI: xilinx: 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/b1353c797ce53714c22823de3bd2ae3d09fcd84f.1750858083.git.namcao@linutronix.de
This commit is contained in:
		
							parent
							
								
									710a1494e1
								
							
						
					
					
						commit
						f29861aa30
					
				
					 2 changed files with 31 additions and 24 deletions
				
			
		| 
						 | 
					@ -322,6 +322,7 @@ config PCIE_XILINX
 | 
				
			||||||
	bool "Xilinx AXI PCIe controller"
 | 
						bool "Xilinx AXI PCIe controller"
 | 
				
			||||||
	depends on OF
 | 
						depends on OF
 | 
				
			||||||
	depends on PCI_MSI
 | 
						depends on PCI_MSI
 | 
				
			||||||
 | 
						select IRQ_MSI_LIB
 | 
				
			||||||
	help
 | 
						help
 | 
				
			||||||
	  Say 'Y' here if you want kernel to support the Xilinx AXI PCIe
 | 
						  Say 'Y' here if you want kernel to support the Xilinx AXI PCIe
 | 
				
			||||||
	  Host Bridge driver.
 | 
						  Host Bridge driver.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,6 +12,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <linux/interrupt.h>
 | 
					#include <linux/interrupt.h>
 | 
				
			||||||
#include <linux/irq.h>
 | 
					#include <linux/irq.h>
 | 
				
			||||||
 | 
					#include <linux/irqchip/irq-msi-lib.h>
 | 
				
			||||||
#include <linux/irqdomain.h>
 | 
					#include <linux/irqdomain.h>
 | 
				
			||||||
#include <linux/kernel.h>
 | 
					#include <linux/kernel.h>
 | 
				
			||||||
#include <linux/init.h>
 | 
					#include <linux/init.h>
 | 
				
			||||||
| 
						 | 
					@ -203,11 +204,6 @@ static void xilinx_msi_top_irq_ack(struct irq_data *d)
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct irq_chip xilinx_msi_top_chip = {
 | 
					 | 
				
			||||||
	.name		= "PCIe MSI",
 | 
					 | 
				
			||||||
	.irq_ack	= xilinx_msi_top_irq_ack,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void xilinx_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
 | 
					static void xilinx_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct xilinx_pcie *pcie = irq_data_get_irq_chip_data(data);
 | 
						struct xilinx_pcie *pcie = irq_data_get_irq_chip_data(data);
 | 
				
			||||||
| 
						 | 
					@ -264,29 +260,42 @@ static const struct irq_domain_ops xilinx_msi_domain_ops = {
 | 
				
			||||||
	.free	= xilinx_msi_domain_free,
 | 
						.free	= xilinx_msi_domain_free,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct msi_domain_info xilinx_msi_info = {
 | 
					static bool xilinx_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
 | 
				
			||||||
	.flags	= MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
 | 
									     struct irq_domain *real_parent, struct msi_domain_info *info)
 | 
				
			||||||
		  MSI_FLAG_NO_AFFINITY,
 | 
					{
 | 
				
			||||||
	.chip	= &xilinx_msi_top_chip,
 | 
						struct irq_chip *chip = info->chip;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						chip->irq_ack = xilinx_msi_top_irq_ack;
 | 
				
			||||||
 | 
						return true;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define XILINX_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS	| \
 | 
				
			||||||
 | 
									   MSI_FLAG_USE_DEF_CHIP_OPS	| \
 | 
				
			||||||
 | 
									   MSI_FLAG_NO_AFFINITY)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const struct msi_parent_ops xilinx_msi_parent_ops = {
 | 
				
			||||||
 | 
						.required_flags		= XILINX_MSI_FLAGS_REQUIRED,
 | 
				
			||||||
 | 
						.supported_flags	= MSI_GENERIC_FLAGS_MASK,
 | 
				
			||||||
 | 
						.bus_select_token	= DOMAIN_BUS_PCI_MSI,
 | 
				
			||||||
 | 
						.prefix			= "xilinx-",
 | 
				
			||||||
 | 
						.init_dev_msi_info	= xilinx_init_dev_msi_info,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int xilinx_allocate_msi_domains(struct xilinx_pcie *pcie)
 | 
					static int xilinx_allocate_msi_domains(struct xilinx_pcie *pcie)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct fwnode_handle *fwnode = dev_fwnode(pcie->dev);
 | 
						struct irq_domain_info info = {
 | 
				
			||||||
	struct irq_domain *parent;
 | 
							.fwnode		= dev_fwnode(pcie->dev),
 | 
				
			||||||
 | 
							.ops		= &xilinx_msi_domain_ops,
 | 
				
			||||||
 | 
							.host_data	= pcie,
 | 
				
			||||||
 | 
							.size		= XILINX_NUM_MSI_IRQS,
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	parent = irq_domain_create_linear(fwnode, XILINX_NUM_MSI_IRQS,
 | 
						pcie->msi_domain = msi_create_parent_irq_domain(&info, &xilinx_msi_parent_ops);
 | 
				
			||||||
					  &xilinx_msi_domain_ops, pcie);
 | 
					 | 
				
			||||||
	if (!parent) {
 | 
					 | 
				
			||||||
		dev_err(pcie->dev, "failed to create IRQ domain\n");
 | 
					 | 
				
			||||||
		return -ENOMEM;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	irq_domain_update_bus_token(parent, DOMAIN_BUS_NEXUS);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	pcie->msi_domain = pci_msi_create_irq_domain(fwnode, &xilinx_msi_info, parent);
 | 
					 | 
				
			||||||
	if (!pcie->msi_domain) {
 | 
						if (!pcie->msi_domain) {
 | 
				
			||||||
		dev_err(pcie->dev, "failed to create MSI domain\n");
 | 
							dev_err(pcie->dev, "failed to create MSI domain\n");
 | 
				
			||||||
		irq_domain_remove(parent);
 | 
					 | 
				
			||||||
		return -ENOMEM;
 | 
							return -ENOMEM;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -295,10 +304,7 @@ static int xilinx_allocate_msi_domains(struct xilinx_pcie *pcie)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void xilinx_free_msi_domains(struct xilinx_pcie *pcie)
 | 
					static void xilinx_free_msi_domains(struct xilinx_pcie *pcie)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct irq_domain *parent = pcie->msi_domain->parent;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	irq_domain_remove(pcie->msi_domain);
 | 
						irq_domain_remove(pcie->msi_domain);
 | 
				
			||||||
	irq_domain_remove(parent);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* INTx Functions */
 | 
					/* INTx Functions */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue