staging: fsl-mc: Convert to use platform_msi infrastrucutre
Subsystems (5)
Freescale MC driver can't be build as module as it uses it's own msi implementation. This patch set converts the driver to use platform_msi infrastructure instead, so that we can build the driver as a module.
Apart from that we have to export some functions of the msi framework to handle the domain.
PATCH 1/6 of/irq: Export of_msi_get_domain
From: Matthias Brugger <[email protected]>
Export of_mis_get_domain to enable it for users from outside.
--- drivers/of/irq.c | 1 + 1 file changed, 1 insertion(+)
drivers/of/irq.c +1 -0
@@ -750,6 +750,7 @@ struct irq_domain *of_msi_get_domain(struct device *dev,return NULL ; } +EXPORT_SYMBOL_GPL (of_msi_get_domain);/** * of_msi_configure - Set the msi_domain field of a device
Signature · 1 line
2.6.6
Re: [PATCH 1/6] of/irq: Export of_msi_get_domain
Quoted 8 lines · Matthias Brugger
From: Matthias Brugger <[email protected]>
Export
of_mis_get_domainto enable it for users from outside.Signed-off-by Matthias Brugger <[email protected]>--- drivers/of/irq.c | 1 + 1 file changed, 1 insertion(+)
PATCH 2/6 base: Export platform_msi_create_irq_domain
In reply to Matthias BruggerFrom: Matthias Brugger <[email protected]>
Export platform_msi_create_irq_domain to make it useable from within modules.
--- drivers/base/platform-msi.c | 1 + 1 file changed, 1 insertion(+)
drivers/base/platform-msi.c +1 -0
@@ -200,6 +200,7 @@ struct irq_domain *platform_msi_create_irq_domain(struct fwnode_handle *fwnode,return domain; } +EXPORT_SYMBOL_GPL (platform_msi_create_irq_domain);static struct platform_msi_priv_data * platform_msi_alloc_priv_data(struct device *dev, unsigned int nvec,
Signature · 1 line
2.6.6
PATCH 3/6 genirq/msi: Export msi_get_domain_info
In reply to Matthias BruggerFrom: Matthias Brugger <[email protected]>
Allow modules to call msi_get_domain_info.
--- kernel/irq/msi.c | 1 + 1 file changed, 1 insertion(+)
kernel/irq/msi.c +1 -0
@@ -400,5 +400,6 @@ struct msi_domain_info *msi_get_domain_info(struct irq_domain *domain) {return (struct msi_domain_info *)domain->host_data; } +EXPORT_SYMBOL_GPL (msi_get_domain_info);#endif /* CONFIG_GENERIC_MSI_IRQ_DOMAIN */
Signature · 1 line
2.6.6
PATCH 4/6 staging: fsl-mc: Use platform_msi_* infrastructure
In reply to Matthias BruggerFrom: Matthias Brugger <[email protected]>
The fsl-mc driver can't be build as a module because it uses msi_* functions directly. Port the driver to use the platform_msi_* infrastructure instead, to allow it to be build as a module.
--- .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 5 +- drivers/staging/fsl-mc/bus/mc-allocator.c | 9 +- drivers/staging/fsl-mc/bus/mc-msi.c | 169 +-------------------- drivers/staging/fsl-mc/include/mc-sys.h | 3 + 4 files changed, 14 insertions(+), 172 deletions(-)
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +2 -3
@@ -25,7 +25,6 @@ static struct irq_chip its_msi_irq_chip = { .irq_mask = irq_chip_mask_parent, .irq_unmask = irq_chip_unmask_parent, .irq_eoi = irq_chip_eoi_parent, - .irq_set_affinity = msi_domain_set_affinity }; static int its_fsl_mc_msi_prepare(struct irq_domain *msi_domain,
@@ -86,7 +85,7 @@ int __init its_fsl_mc_msi_init(void)continue ; } - mc_msi_domain =fsl_mc_msi_create_irq_domain ( + mc_msi_domain =platform_msi_create_irq_domain (of_node_to_fwnode (np), &its_fsl_mc_msi_domain_info, parent);
@@ -113,7 +112,7 @@ void its_fsl_mc_msi_cleanup(void) np = of_find_matching_node(np, its_device_id)) {struct irq_domain *mc_msi_domain =irq_find_matching_host ( np, -DOMAIN_BUS_FSL_MC_MSI ); +DOMAIN_BUS_PLATFORM_MSI );if (!of_property_read_bool (np,"msi-controller" ))continue ;
drivers/staging/fsl-mc/bus/mc-allocator.c +5 -4
@@ -487,7 +487,8 @@ int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus, irq_count > FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS))return -EINVAL ; - error =fsl_mc_msi_domain_alloc_irqs (&mc_bus_dev->dev, irq_count); + error =platform_msi_domain_alloc_irqs (&mc_bus_dev->dev, irq_count, + fsl_mc_msi_write_msg);if (error <0 )return error;
@@ -514,7 +515,7 @@ int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus, }for_each_msi_entry (msi_desc, &mc_bus_dev->dev) { - mc_dev_irq = &irq_resources[msi_desc->fsl_mc.msi_index]; + mc_dev_irq = &irq_resources[msi_desc->platform.msi_index]; mc_dev_irq->msi_desc = msi_desc; mc_dev_irq->resource.id = msi_desc->irq; }
@@ -525,7 +526,7 @@ int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus,return 0 ; cleanup_msi_irqs: -fsl_mc_msi_domain_free_irqs (&mc_bus_dev->dev); +platform_msi_domain_free_irqs (&mc_bus_dev->dev);return error; }EXPORT_SYMBOL_GPL (fsl_mc_populate_irq_pool);
@@ -553,7 +554,7 @@ void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus) res_pool->max_count =0 ; res_pool->free_count =0 ; mc_bus->irq_resources =NULL ; -fsl_mc_msi_domain_free_irqs (&mc_bus_dev->dev); +platform_msi_domain_free_irqs (&mc_bus_dev->dev); }EXPORT_SYMBOL_GPL (fsl_mc_cleanup_irq_pool);
drivers/staging/fsl-mc/bus/mc-msi.c +4 -165
203 lines not on this page · raw message
drivers/staging/fsl-mc/include/mc-sys.h +3 -0
@@ -41,6 +41,7 @@#include <linux/dma-mapping.h> #include <linux/mutex.h> #include <linux/spinlock.h> +#include <linux/msi.h> /** * Bit masks for a MC I/O object (struct fsl_mc_io) flags
@@ -107,6 +108,8 @@ int fsl_mc_io_set_dpmcp(struct fsl_mc_io *mc_io, struct fsl_mc_device *dpmcp_dev);void fsl_mc_io_unset_dpmcp (struct fsl_mc_io *mc_io); +void fsl_mc_msi_write_msg (struct msi_desc *msi_desc, +struct msi_msg *msg);int mc_send_command (struct fsl_mc_io *mc_io,struct mc_command *cmd);
Signature · 1 line
2.6.6
Re: [PATCH 4/6] staging: fsl-mc: Use platform_msi_* infrastructure
Quoted 27 lines · Matthias Brugger
From: Matthias Brugger <[email protected]>
The fsl-mc driver can't be build as a module because it uses msi_* functions directly. Port the driver to use the platform_msi_* infrastructure instead, to allow it to be build as a module.
Signed-off-by Matthias Brugger <[email protected]>--- .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 5 +- drivers/staging/fsl-mc/bus/mc-allocator.c | 9 +- drivers/staging/fsl-mc/bus/mc-msi.c | 169 +-------------------- drivers/staging/fsl-mc/include/mc-sys.h | 3 + 4 files changed, 14 insertions(+), 172 deletions(-)drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +0
-1@@ -25,7 +25,6 @@ static struct irq_chip its_msi_irq_chip = { .irq_mask = irq_chip_mask_parent, .irq_unmask = irq_chip_unmask_parent, .irq_eoi = irq_chip_eoi_parent, - .irq_set_affinity = msi_domain_set_affinity }; static int its_fsl_mc_msi_prepare(struct irq_domain *msi_domain,
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c int __init its_fsl_mc_msi_init(void) · line 91
Quoted 8 lines
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +1
-1@@ -86,7 +85,7 @@ int __init its_fsl_mc_msi_init(void)continue ; } - mc_msi_domain =fsl_mc_msi_create_irq_domain ( + mc_msi_domain =platform_msi_create_irq_domain (of_node_to_fwnode (np), &its_fsl_mc_msi_domain_info, parent);
What? We are already creating a platform MSI domain for the ITS. How is that going to work? If you want to convert this set of drivers to platform ITS, fine. But you can't randomly hack in the ITS code and pray for things not to fall apart.
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Re: [PATCH 4/6] staging: fsl-mc: Use platform_msi_* infrastructure
Quoted 31 lines · Marc Zyngier
Quoted 30 lines · Matthias Brugger
From: Matthias Brugger <[email protected]>
The fsl-mc driver can't be build as a module because it uses msi_* functions directly. Port the driver to use the platform_msi_* infrastructure instead, to allow it to be build as a module.
Signed-off-by Matthias Brugger <[email protected]>--- .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 5 +- drivers/staging/fsl-mc/bus/mc-allocator.c | 9 +- drivers/staging/fsl-mc/bus/mc-msi.c | 169 +-------------------- drivers/staging/fsl-mc/include/mc-sys.h | 3 + 4 files changed, 14 insertions(+), 172 deletions(-)drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +0
-1@@ -25,7 +25,6 @@ static struct irq_chip its_msi_irq_chip = { .irq_mask = irq_chip_mask_parent, .irq_unmask = irq_chip_unmask_parent, .irq_eoi = irq_chip_eoi_parent, - .irq_set_affinity = msi_domain_set_affinity }; static int its_fsl_mc_msi_prepare(struct irq_domain *msi_domain,@@ -86,7 +85,7 @@ int __init its_fsl_mc_msi_init(void)continue ; }
Quoted 11 lines
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c int __init its_fsl_mc_msi_init(void) · line 91
Quoted 5 lines
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +1
-1- mc_msi_domain =fsl_mc_msi_create_irq_domain ( + mc_msi_domain =platform_msi_create_irq_domain (of_node_to_fwnode (np), &its_fsl_mc_msi_domain_info, parent);What? We are already creating a platform MSI domain for the ITS. How is that going to work? If you want to convert this set of drivers to platform ITS, fine. But you can't randomly hack in the ITS code and pray for things not to fall apart.
From what I see, the difference between irq-gic-v3-its-fsl-mc-msi and
the irq-gic-v3-its-platform-msi is the way ITS specific DeviceID is created in msi_prepare.
German, is there a reason why you use the ICID read from the DPRC as dev_id?
Regards,
Matthias
Re: [PATCH 4/6] staging: fsl-mc: Use platform_msi_* infrastructure
Quoted 46 lines · Matthias Brugger
Quoted 31 lines · Marc Zyngier
Quoted 30 lines · Matthias Brugger
From: Matthias Brugger <[email protected]>
The fsl-mc driver can't be build as a module because it uses msi_* functions directly. Port the driver to use the platform_msi_* infrastructure instead, to allow it to be build as a module.
Signed-off-by Matthias Brugger <[email protected]>--- .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 5 +- drivers/staging/fsl-mc/bus/mc-allocator.c | 9 +- drivers/staging/fsl-mc/bus/mc-msi.c | 169 +-------------------- drivers/staging/fsl-mc/include/mc-sys.h | 3 + 4 files changed, 14 insertions(+), 172 deletions(-)drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +0
-1@@ -25,7 +25,6 @@ static struct irq_chip its_msi_irq_chip = { .irq_mask = irq_chip_mask_parent, .irq_unmask = irq_chip_unmask_parent, .irq_eoi = irq_chip_eoi_parent, - .irq_set_affinity = msi_domain_set_affinity }; static int its_fsl_mc_msi_prepare(struct irq_domain *msi_domain,@@ -86,7 +85,7 @@ int __init its_fsl_mc_msi_init(void)continue ; }Quoted 11 lines
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c int __init its_fsl_mc_msi_init(void) · line 91
Quoted 5 lines
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +1
-1- mc_msi_domain =fsl_mc_msi_create_irq_domain ( + mc_msi_domain =platform_msi_create_irq_domain (of_node_to_fwnode (np), &its_fsl_mc_msi_domain_info, parent);What? We are already creating a platform MSI domain for the ITS. How is that going to work? If you want to convert this set of drivers to platform ITS, fine. But you can't randomly hack in the ITS code and pray for things not to fall apart.
Quoted 3 lines
From what I see, the difference between irq-gic-v3-its-fsl-mc-msi and
the irq-gic-v3-its-platform-msi is the way ITS specific DeviceID is created inmsi_prepare.
It is not "created". It is extracted from the HW, either by looking at the RequesterID (PCI), at the DT (platform MSI), or a bus-specific method.
Quoted 1 line
German, is there a reason why you use the ICID read from the DPRC as
dev_id?
Because that's what is presented to the ITS as a DevID. This is a HW constraint, and you can't just change it.
If you want to use platform MSI for that, you also need to describe the DevID in the DT (breaking the existing platforms in the process).
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
RE: [PATCH 4/6] staging: fsl-mc: Use platform_msi_* infrastructure
In reply to Matthias BruggerQuoted 60 lines
-----Original Message-----
From: Matthias Brugger [mailto:mbrugger at suse.com]
Sent: Wednesday, April 13, 2016 6:23 AM
To: Marc Zyngier <[email protected]>; gregkh at linuxfoundation.org; robh+dt at kernel.org; frowand.list at gmail.com; grant.likely at linaro.org; German.Rivera at freescale.com; jiang.liu at linux.intel.com; tglx at linutronix.de
Cc: treding at nvidia.com; Stuart Yoder <[email protected]>; jroedel at suse.de; agraf at suse.de; bp at suse.de; matthias.bgg at gmail.com; bhaktipriya96 at gmail.com; linux-kernel at vger.kernel.org; devicetree at vger.kernel.org; devel at driverdev.osuosl.org; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 4/6] staging: fsl-mc: Use platform_msi_* infrastructureQuoted 15 lines · Marc Zyngier
Quoted 14 lines · Matthias Brugger
From: Matthias Brugger <[email protected]>
The fsl-mc driver can't be build as a module because it uses msi_* functions directly. Port the driver to use the platform_msi_* infrastructure instead, to allow it to be build as a module.
Signed-off-by Matthias Brugger <[email protected]>--- .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 5 +- drivers/staging/fsl-mc/bus/mc-allocator.c | 9 +- drivers/staging/fsl-mc/bus/mc-msi.c | 169 +-------------------- drivers/staging/fsl-mc/include/mc-sys.h | 3 + 4 files changed, 14 insertions(+), 172 deletions(-)Quoted 1 line
drivers/staging/fsl-
Quoted 1 line
drivers/staging/fsl- renamed from drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +0
-0
mc/bus/irq-gic-v3-its-fsl-mc-msi.cQuoted 15 lines
Quoted 15 lines
index 720e2b0..0eecb7e 100644
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +0
-1@@ -25,7 +25,6 @@ static struct irq_chip its_msi_irq_chip = { .irq_mask = irq_chip_mask_parent, .irq_unmask = irq_chip_unmask_parent, .irq_eoi = irq_chip_eoi_parent, - .irq_set_affinity = msi_domain_set_affinity }; static int its_fsl_mc_msi_prepare(struct irq_domain *msi_domain,@@ -86,7 +85,7 @@ int __init its_fsl_mc_msi_init(void)continue ; }Quoted 11 lines
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c int __init its_fsl_mc_msi_init(void) · line 91
Quoted 5 lines
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +1
-1- mc_msi_domain =fsl_mc_msi_create_irq_domain ( + mc_msi_domain =platform_msi_create_irq_domain (of_node_to_fwnode (np), &its_fsl_mc_msi_domain_info, parent);What? We are already creating a platform MSI domain for the ITS. How is that going to work? If you want to convert this set of drivers to platform ITS, fine. But you can't randomly hack in the ITS code and pray for things not to fall apart.
Quoted 5 lines
From what I see, the difference between irq-gic-v3-its-fsl-mc-msi and
the irq-gic-v3-its-platform-msi is the way ITS specific DeviceID is created inmsi_prepare.German, is there a reason why you use the ICID read from the DPRC as
dev_id?
Because it _is_ the dev_id at the hardware level. There is an fsl-mc bus specific mechanism to get that id...it's not in the device tree.
Stuart
PATCH 5/6 staging: fsl-mc: Clean up of irq_chip callbacks
In reply to Matthias Bruggerplatform_msi_create_irq_domain already sets the irq_chip callbacks accordingly. We don't need to define them explicitly in the driver.
--- drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 3 --- 1 file changed, 3 deletions(-)
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +0 -3
@@ -22,9 +22,6 @@static struct irq_chip its_msi_irq_chip = { .name ="fsl-mc-bus-msi" , - .irq_mask = irq_chip_mask_parent, - .irq_unmask = irq_chip_unmask_parent, - .irq_eoi = irq_chip_eoi_parent, }; static int its_fsl_mc_msi_prepare(struct irq_domain *msi_domain,
Signature · 1 line
2.6.6
PATCH 6/6 Revert "staging: fsl-mc: Do not allow building as a module"
In reply to Matthias BruggerFrom: Matthias Brugger <[email protected]>
This reverts commit <dfb11fe2281c> ("staging: fsl-mc: Do not allow building as a module")
--- drivers/staging/fsl-mc/bus/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fsl-mc/bus/Kconfig +1 -1
@@ -7,7 +7,7 @@ # config FSL_MC_BUS - bool "Freescale Management Complex (MC) bus driver" + tristate "Freescale Management Complex (MC) bus driver" depends on OF && ARM64 select GENERIC_MSI_IRQ_DOMAIN help
Signature · 1 line
2.6.6