* [PATCH] iommu/of: Only do IOMMU lookup for available ones
@ 2018-01-03 6:09 Jeffy Chen
[not found] ` <20180103060920.23475-1-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2018-01-17 13:28 ` Joerg Roedel
0 siblings, 2 replies; 5+ messages in thread
From: Jeffy Chen @ 2018-01-03 6:09 UTC (permalink / raw)
To: linux-kernel; +Cc: jcliang, tfiga, Jeffy Chen, iommu, Joerg Roedel
The for_each_matching_node_and_match() would return every matching
nodes including unavailable ones.
It's pointless to init unavailable IOMMUs, so add a sanity check to
avoid that.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
drivers/iommu/of_iommu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
index 50947ebb6d17..6f7456caa30d 100644
--- a/drivers/iommu/of_iommu.c
+++ b/drivers/iommu/of_iommu.c
@@ -240,6 +240,9 @@ static int __init of_iommu_init(void)
for_each_matching_node_and_match(np, matches, &match) {
const of_iommu_init_fn init_fn = match->data;
+ if (!of_device_is_available(np))
+ continue;
+
if (init_fn && init_fn(np))
pr_err("Failed to initialise IOMMU %pOF\n", np);
}
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread[parent not found: <20180103060920.23475-1-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>]
* Re: [PATCH] iommu/of: Only do IOMMU lookup for available ones
[not found] ` <20180103060920.23475-1-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
@ 2018-01-08 11:45 ` Robin Murphy
0 siblings, 0 replies; 5+ messages in thread
From: Robin Murphy @ 2018-01-08 11:45 UTC (permalink / raw)
To: Jeffy Chen, linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: jcliang-F7+t8E8rja9g9hUCZPvPmw,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Hi Jeffy,
On 03/01/18 06:09, Jeffy Chen wrote:
> The for_each_matching_node_and_match() would return every matching
> nodes including unavailable ones.
>
> It's pointless to init unavailable IOMMUs, so add a sanity check to
> avoid that.
Even better would be to clean up the last remaining init_fn user and get
rid of the whole business. With the probe-deferral mechanism, early
initialisation hooks are no longer needed, and the IOMMU_OF_DECLARE
section really only remains as a way of detecting builtin drivers long
before their registration initcalls run.
Robin.
> Signed-off-by: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
>
> drivers/iommu/of_iommu.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
> index 50947ebb6d17..6f7456caa30d 100644
> --- a/drivers/iommu/of_iommu.c
> +++ b/drivers/iommu/of_iommu.c
> @@ -240,6 +240,9 @@ static int __init of_iommu_init(void)
> for_each_matching_node_and_match(np, matches, &match) {
> const of_iommu_init_fn init_fn = match->data;
>
> + if (!of_device_is_available(np))
> + continue;
> +
> if (init_fn && init_fn(np))
> pr_err("Failed to initialise IOMMU %pOF\n", np);
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu/of: Only do IOMMU lookup for available ones
2018-01-03 6:09 [PATCH] iommu/of: Only do IOMMU lookup for available ones Jeffy Chen
[not found] ` <20180103060920.23475-1-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
@ 2018-01-17 13:28 ` Joerg Roedel
[not found] ` <20180117132808.s5henw63oseg3ufd-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
1 sibling, 1 reply; 5+ messages in thread
From: Joerg Roedel @ 2018-01-17 13:28 UTC (permalink / raw)
To: Jeffy Chen; +Cc: linux-kernel, jcliang, tfiga, iommu, Robin Murphy, Will Deacon
On Wed, Jan 03, 2018 at 02:09:20PM +0800, Jeffy Chen wrote:
> The for_each_matching_node_and_match() would return every matching
> nodes including unavailable ones.
>
> It's pointless to init unavailable IOMMUs, so add a sanity check to
> avoid that.
>
> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
> ---
>
> drivers/iommu/of_iommu.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
> index 50947ebb6d17..6f7456caa30d 100644
> --- a/drivers/iommu/of_iommu.c
> +++ b/drivers/iommu/of_iommu.c
> @@ -240,6 +240,9 @@ static int __init of_iommu_init(void)
> for_each_matching_node_and_match(np, matches, &match) {
> const of_iommu_init_fn init_fn = match->data;
>
> + if (!of_device_is_available(np))
> + continue;
> +
Makes sense to me, but I'd like to have an OK from Robin or Will (added
to Cc) before applying this.
Joerg
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-01-18 14:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-03 6:09 [PATCH] iommu/of: Only do IOMMU lookup for available ones Jeffy Chen
[not found] ` <20180103060920.23475-1-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2018-01-08 11:45 ` Robin Murphy
2018-01-17 13:28 ` Joerg Roedel
[not found] ` <20180117132808.s5henw63oseg3ufd-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2018-01-18 14:41 ` Will Deacon
[not found] ` <20180118144118.GA12394-5wv7dgnIgG8@public.gmane.org>
2018-01-18 14:58 ` JeffyChen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox