2016-04-13 10:32:09

by Matthias Brugger

[permalink] [raw]
Subject: staging: fsl-mc: Convert to use platform_msi infrastrucutre

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.


2016-04-13 10:32:15

by Matthias Brugger

[permalink] [raw]
Subject: [PATCH 2/6] base: Export platform_msi_create_irq_domain

From: Matthias Brugger <[email protected]>

Export platform_msi_create_irq_domain to make it useable from within
modules.

Signed-off-by: Matthias Brugger <[email protected]>
---
drivers/base/platform-msi.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/base/platform-msi.c b/drivers/base/platform-msi.c
index 279e539..9ae0443 100644
--- a/drivers/base/platform-msi.c
+++ b/drivers/base/platform-msi.c
@@ -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,
--
2.6.6

2016-04-13 10:32:23

by Matthias Brugger

[permalink] [raw]
Subject: [PATCH 4/6] staging: fsl-mc: Use platform_msi_* infrastructure

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(-)

diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 720e2b0..0eecb7e 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -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;
diff --git a/drivers/staging/fsl-mc/bus/mc-allocator.c b/drivers/staging/fsl-mc/bus/mc-allocator.c
index 86f8543..b469c5a 100644
--- a/drivers/staging/fsl-mc/bus/mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/mc-allocator.c
@@ -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);

diff --git a/drivers/staging/fsl-mc/bus/mc-msi.c b/drivers/staging/fsl-mc/bus/mc-msi.c
index 3a8258f..ae62a71 100644
--- a/drivers/staging/fsl-mc/bus/mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/mc-msi.c
@@ -16,33 +16,9 @@
#include <linux/of_irq.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
-#include <linux/msi.h>
#include "../include/mc-sys.h"
#include "dprc-cmd.h"

-static void fsl_mc_msi_set_desc(msi_alloc_info_t *arg,
- struct msi_desc *desc)
-{
- arg->desc = desc;
- arg->hwirq = (irq_hw_number_t)desc->fsl_mc.msi_index;
-}
-
-static void fsl_mc_msi_update_dom_ops(struct msi_domain_info *info)
-{
- struct msi_domain_ops *ops = info->ops;
-
- if (WARN_ON(!ops))
- return;
-
- /*
- * set_desc should not be set by the caller
- */
- if (WARN_ON(ops->set_desc))
- return;
-
- ops->set_desc = fsl_mc_msi_set_desc;
-}
-
static void __fsl_mc_msi_write_msg(struct fsl_mc_device *mc_bus_dev,
struct fsl_mc_device_irq *mc_dev_irq)
{
@@ -101,14 +77,13 @@ static void __fsl_mc_msi_write_msg(struct fsl_mc_device *mc_bus_dev,
/*
* NOTE: This function is invoked with interrupts disabled
*/
-static void fsl_mc_msi_write_msg(struct irq_data *irq_data,
- struct msi_msg *msg)
+void fsl_mc_msi_write_msg(struct msi_desc *msi_desc,
+ struct msi_msg *msg)
{
- struct msi_desc *msi_desc = irq_data_get_msi_desc(irq_data);
struct fsl_mc_device *mc_bus_dev = to_fsl_mc_device(msi_desc->dev);
struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
struct fsl_mc_device_irq *mc_dev_irq =
- &mc_bus->irq_resources[msi_desc->fsl_mc.msi_index];
+ &mc_bus->irq_resources[msi_desc->platform.msi_index];

WARN_ON(mc_dev_irq->msi_desc != msi_desc);
msi_desc->msg = *msg;
@@ -119,52 +94,6 @@ static void fsl_mc_msi_write_msg(struct irq_data *irq_data,
__fsl_mc_msi_write_msg(mc_bus_dev, mc_dev_irq);
}

-static void fsl_mc_msi_update_chip_ops(struct msi_domain_info *info)
-{
- struct irq_chip *chip = info->chip;
-
- if (WARN_ON((!chip)))
- return;
-
- /*
- * irq_write_msi_msg should not be set by the caller
- */
- if (WARN_ON(chip->irq_write_msi_msg))
- return;
-
- chip->irq_write_msi_msg = fsl_mc_msi_write_msg;
-}
-
-/**
- * fsl_mc_msi_create_irq_domain - Create a fsl-mc MSI interrupt domain
- * @np: Optional device-tree node of the interrupt controller
- * @info: MSI domain info
- * @parent: Parent irq domain
- *
- * Updates the domain and chip ops and creates a fsl-mc MSI
- * interrupt domain.
- *
- * Returns:
- * A domain pointer or NULL in case of failure.
- */
-struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode,
- struct msi_domain_info *info,
- struct irq_domain *parent)
-{
- struct irq_domain *domain;
-
- if (info->flags & MSI_FLAG_USE_DEF_DOM_OPS)
- fsl_mc_msi_update_dom_ops(info);
- if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS)
- fsl_mc_msi_update_chip_ops(info);
-
- domain = msi_create_irq_domain(fwnode, info, parent);
- if (domain)
- domain->bus_token = DOMAIN_BUS_FSL_MC_MSI;
-
- return domain;
-}
-
int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
struct irq_domain **mc_msi_domain)
{
@@ -172,7 +101,7 @@ int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
struct device_node *mc_of_node = mc_platform_dev->of_node;

msi_domain = of_msi_get_domain(mc_platform_dev, mc_of_node,
- DOMAIN_BUS_FSL_MC_MSI);
+ DOMAIN_BUS_PLATFORM_MSI);
if (!msi_domain) {
pr_err("Unable to find fsl-mc MSI domain for %s\n",
mc_of_node->full_name);
@@ -184,93 +113,3 @@ int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
return 0;
}

-static void fsl_mc_msi_free_descs(struct device *dev)
-{
- struct msi_desc *desc, *tmp;
-
- list_for_each_entry_safe(desc, tmp, dev_to_msi_list(dev), list) {
- list_del(&desc->list);
- free_msi_entry(desc);
- }
-}
-
-static int fsl_mc_msi_alloc_descs(struct device *dev, unsigned int irq_count)
-
-{
- unsigned int i;
- int error;
- struct msi_desc *msi_desc;
-
- for (i = 0; i < irq_count; i++) {
- msi_desc = alloc_msi_entry(dev);
- if (!msi_desc) {
- dev_err(dev, "Failed to allocate msi entry\n");
- error = -ENOMEM;
- goto cleanup_msi_descs;
- }
-
- msi_desc->fsl_mc.msi_index = i;
- msi_desc->nvec_used = 1;
- INIT_LIST_HEAD(&msi_desc->list);
- list_add_tail(&msi_desc->list, dev_to_msi_list(dev));
- }
-
- return 0;
-
-cleanup_msi_descs:
- fsl_mc_msi_free_descs(dev);
- return error;
-}
-
-int fsl_mc_msi_domain_alloc_irqs(struct device *dev,
- unsigned int irq_count)
-{
- struct irq_domain *msi_domain;
- int error;
-
- if (WARN_ON(!list_empty(dev_to_msi_list(dev))))
- return -EINVAL;
-
- error = fsl_mc_msi_alloc_descs(dev, irq_count);
- if (error < 0)
- return error;
-
- msi_domain = dev_get_msi_domain(dev);
- if (WARN_ON(!msi_domain)) {
- error = -EINVAL;
- goto cleanup_msi_descs;
- }
-
- /*
- * NOTE: Calling this function will trigger the invocation of the
- * its_fsl_mc_msi_prepare() callback
- */
- error = msi_domain_alloc_irqs(msi_domain, dev, irq_count);
-
- if (error) {
- dev_err(dev, "Failed to allocate IRQs\n");
- goto cleanup_msi_descs;
- }
-
- return 0;
-
-cleanup_msi_descs:
- fsl_mc_msi_free_descs(dev);
- return error;
-}
-
-void fsl_mc_msi_domain_free_irqs(struct device *dev)
-{
- struct irq_domain *msi_domain;
-
- msi_domain = dev_get_msi_domain(dev);
- if (WARN_ON(!msi_domain))
- return;
-
- msi_domain_free_irqs(msi_domain, dev);
-
- if (WARN_ON(list_empty(dev_to_msi_list(dev))))
- return;
-
- fsl_mc_msi_free_descs(dev);
-}
diff --git a/drivers/staging/fsl-mc/include/mc-sys.h b/drivers/staging/fsl-mc/include/mc-sys.h
index c5038cc..d69582a 100644
--- a/drivers/staging/fsl-mc/include/mc-sys.h
+++ b/drivers/staging/fsl-mc/include/mc-sys.h
@@ -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);

--
2.6.6

2016-04-13 10:32:29

by Matthias Brugger

[permalink] [raw]
Subject: [PATCH 5/6] staging: fsl-mc: Clean up of irq_chip callbacks

platform_msi_create_irq_domain already sets the irq_chip callbacks accordingly.
We don't need to define them explicitly in the driver.

Signed-off-by: Matthias Brugger <[email protected]>
---
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 0eecb7e..c787090 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -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,
--
2.6.6

2016-04-13 10:32:13

by Matthias Brugger

[permalink] [raw]
Subject: [PATCH 3/6] genirq/msi: Export msi_get_domain_info

From: Matthias Brugger <[email protected]>

Allow modules to call msi_get_domain_info.

Signed-off-by: Matthias Brugger <[email protected]>
---
kernel/irq/msi.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index 38e89ce..9b0ba4a 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -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 */
--
2.6.6

2016-04-13 10:33:50

by Matthias Brugger

[permalink] [raw]
Subject: [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.

Signed-off-by: Matthias Brugger <[email protected]>
---
drivers/of/irq.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index e7bfc17..9f8cd6a 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -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
--
2.6.6

2016-04-13 10:55:36

by Matthias Brugger

[permalink] [raw]
Subject: [PATCH 6/6] Revert "staging: fsl-mc: Do not allow building as a module"

From: Matthias Brugger <[email protected]>

This reverts commit <dfb11fe2281c> ("staging: fsl-mc: Do not allow building as a module")

Signed-off-by: Matthias Brugger <[email protected]>
---
drivers/staging/fsl-mc/bus/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/bus/Kconfig b/drivers/staging/fsl-mc/bus/Kconfig
index 1f95933..c498ac6 100644
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ b/drivers/staging/fsl-mc/bus/Kconfig
@@ -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
--
2.6.6

2016-04-13 10:56:36

by Marc Zyngier

[permalink] [raw]
Subject: Re: [PATCH 4/6] staging: fsl-mc: Use platform_msi_* infrastructure

On 13/04/16 11:30, Matthias Brugger wrote:
> 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(-)
>
> diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
> index 720e2b0..0eecb7e 100644
> --- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
> +++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
> @@ -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);

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.
--
Jazz is not dead. It just smells funny...

2016-04-13 11:23:38

by Matthias Brugger

[permalink] [raw]
Subject: Re: [PATCH 4/6] staging: fsl-mc: Use platform_msi_* infrastructure



On 13/04/16 12:56, Marc Zyngier wrote:
> On 13/04/16 11:30, Matthias Brugger wrote:
>> 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(-)
>>
>> diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
>> index 720e2b0..0eecb7e 100644
>> --- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
>> +++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
>> @@ -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);
>
> 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

2016-04-13 12:08:35

by Marc Zyngier

[permalink] [raw]
Subject: Re: [PATCH 4/6] staging: fsl-mc: Use platform_msi_* infrastructure

On 13/04/16 12:23, Matthias Brugger wrote:
>
>
> On 13/04/16 12:56, Marc Zyngier wrote:
>> On 13/04/16 11:30, Matthias Brugger wrote:
>>> 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(-)
>>>
>>> diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
>>> index 720e2b0..0eecb7e 100644
>>> --- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
>>> +++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
>>> @@ -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);
>>
>> 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.

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.

> 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.
--
Jazz is not dead. It just smells funny...

2016-04-13 12:32:40

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH 1/6] of/irq: Export of_msi_get_domain

On Wed, Apr 13, 2016 at 5:30 AM, Matthias Brugger <[email protected]> wrote:
> From: Matthias Brugger <[email protected]>
>
> Export of_mis_get_domain to enable it for users from outside.
>
> Signed-off-by: Matthias Brugger <[email protected]>
> ---
> drivers/of/irq.c | 1 +
> 1 file changed, 1 insertion(+)

Acked-by: Rob Herring <[email protected]>

2016-04-13 14:57:24

by Stuart Yoder

[permalink] [raw]
Subject: RE: [PATCH 4/6] staging: fsl-mc: Use platform_msi_* infrastructure



> -----Original Message-----
> From: Matthias Brugger [mailto:[email protected]]
> Sent: Wednesday, April 13, 2016 6:23 AM
> To: Marc Zyngier <[email protected]>; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]
> Cc: [email protected]; Stuart Yoder <[email protected]>; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected]
> Subject: Re: [PATCH 4/6] staging: fsl-mc: Use platform_msi_* infrastructure
>
>
>
> On 13/04/16 12:56, Marc Zyngier wrote:
> > On 13/04/16 11:30, Matthias Brugger wrote:
> >> 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(-)
> >>
> >> diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-
> mc/bus/irq-gic-v3-its-fsl-mc-msi.c
> >> index 720e2b0..0eecb7e 100644
> >> --- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
> >> +++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
> >> @@ -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);
> >
> > 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?

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