All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] mips/octeon_3xxx: Fix a warning on octeon_3xxx
@ 2014-03-18  4:48 ` Wei.Yang
  0 siblings, 0 replies; 15+ messages in thread
From: Wei.Yang @ 2014-03-18  4:48 UTC (permalink / raw)
  To: wei.yang, david.daney, ralf; +Cc: linux-mips, andreas.herrmann

From: Yang Wei <Wei.Yang@windriver.com>

Since the xlate of interrupts property of GPIO on octeon 3xxx
does not success, so the following warning would be triggerred.

WARNING: CPU: 1 PID: 1 at drivers/of/platform.c:173 of_device_alloc+0x294/0x2a0()
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.14.0-rc6- #11
Stack : ffffffff81a20000 0000000000000001 0000000000000004 ffffffff81b50000
      0000000000000001 0000000000000000 0000000000000000 ffffffff8119e878
      ffffffff81a20000 ffffffff8119ee98 0000000000000000 0000000000000000
      ffffffff81b30000 ffffffff81b20000 ffffffff81932900 ffffffff81a11077
      ffffffff81b27a08 800000041f8704a8 0000000000000001 0000000000000001
      0000000000000000 800000041fbf7438 0000000000000001 ffffffff81800d90
      800000041f85fa68 ffffffff8114a60c 0000000000000000 ffffffff811a0838
      800000041f870000 800000041f85f980 0000000000000001 ffffffff81805080
      0000000000000000 0000000000000000 0000000000000000 0000000000000000
      0000000000000000 ffffffff81122620 0000000000000000 0000000000000000
      ...
Call Trace:
[<ffffffff81122620>] show_stack+0xc0/0xe0
[<ffffffff81805080>] dump_stack+0x8c/0xe0
[<ffffffff8114a7ac>] warn_slowpath_common+0x94/0xc8
[<ffffffff81693b1c>] of_device_alloc+0x294/0x2a0
[<ffffffff81693b74>] of_platform_device_create_pdata+0x4c/0xf0
[<ffffffff81693d58>] of_platform_bus_create+0x128/0x1a8
[<ffffffff81693da0>] of_platform_bus_create+0x170/0x1a8
[<ffffffff81693e8c>] of_platform_bus_probe+0xb4/0x110
[<ffffffff81100598>] do_one_initcall+0xe8/0x130
[<ffffffff81a92c5c>] kernel_init_freeable+0x1d4/0x2bc
[<ffffffff817fe140>] kernel_init+0x20/0x118
[<ffffffff8111d024>] ret_from_kernel_thread+0x14/0x1c

Signed-off-by: Yang Wei <Wei.Yang@windriver.com> 
---

Changes:
 
In v2:
Hi David,

According to your suggestion, I modify octeon-irq.c so that it doesn't try to reserve these numbers to fix this issue in v2.
How about is it?:-)

Thanks
Wei


 arch/mips/cavium-octeon/octeon-irq.c |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 25fbfae..31c76b1 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -975,10 +975,6 @@ static int octeon_irq_ciu_xlat(struct irq_domain *d,
 	if (ciu > 1 || bit > 63)
 		return -EINVAL;
 
-	/* These are the GPIO lines */
-	if (ciu == 0 && bit >= 16 && bit < 32)
-		return -EINVAL;
-
 	*out_hwirq = (ciu << 6) | bit;
 	*out_type = 0;
 
@@ -1010,6 +1006,13 @@ static int octeon_irq_ciu_map(struct irq_domain *d,
 	if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0)
 		return -EINVAL;
 
+	/*
+	 * If the irq is reserved for GPIO, we set virq to 0 so
+	 * that GPIO would be able to map it.
+	 */
+	if (line == 0 && bit >= 16 && bit <32)
+		virq = 0;
+
 	if (octeon_irq_ciu_is_edge(line, bit))
 		octeon_irq_set_ciu_mapping(virq, line, bit, 0,
 					   octeon_irq_ciu_chip,
@@ -1525,10 +1528,6 @@ static int octeon_irq_ciu2_xlat(struct irq_domain *d,
 	ciu = intspec[0];
 	bit = intspec[1];
 
-	/* Line 7  are the GPIO lines */
-	if (ciu > 6 || bit > 63)
-		return -EINVAL;
-
 	*out_hwirq = (ciu << 6) | bit;
 	*out_type = 0;
 
@@ -1570,10 +1569,16 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,
 	if (!octeon_irq_virq_in_range(virq))
 		return -EINVAL;
 
-	/* Line 7  are the GPIO lines */
-	if (line > 6 || octeon_irq_ciu_to_irq[line][bit] != 0)
+	if (octeon_irq_ciu_to_irq[line][bit] != 0)
 		return -EINVAL;
 
+	/*
+	 * Line 7 are the GPIO lines, we set virq to 0 so
+	 * that GPIO would be able to map it
+	 */
+	if (line > 6 || bit > 63)
+		virq = 0;
+
 	if (octeon_irq_ciu2_is_edge(line, bit))
 		octeon_irq_set_ciu_mapping(virq, line, bit, 0,
 					   &octeon_irq_chip_ciu2,
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH V2] mips/octeon_3xxx: Fix a warning on octeon_3xxx
@ 2014-03-18  4:48 ` Wei.Yang
  0 siblings, 0 replies; 15+ messages in thread
From: Wei.Yang @ 2014-03-18  4:48 UTC (permalink / raw)
  To: wei.yang, david.daney, ralf; +Cc: linux-mips, andreas.herrmann

From: Yang Wei <Wei.Yang@windriver.com>

Since the xlate of interrupts property of GPIO on octeon 3xxx
does not success, so the following warning would be triggerred.

WARNING: CPU: 1 PID: 1 at drivers/of/platform.c:173 of_device_alloc+0x294/0x2a0()
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.14.0-rc6- #11
Stack : ffffffff81a20000 0000000000000001 0000000000000004 ffffffff81b50000
      0000000000000001 0000000000000000 0000000000000000 ffffffff8119e878
      ffffffff81a20000 ffffffff8119ee98 0000000000000000 0000000000000000
      ffffffff81b30000 ffffffff81b20000 ffffffff81932900 ffffffff81a11077
      ffffffff81b27a08 800000041f8704a8 0000000000000001 0000000000000001
      0000000000000000 800000041fbf7438 0000000000000001 ffffffff81800d90
      800000041f85fa68 ffffffff8114a60c 0000000000000000 ffffffff811a0838
      800000041f870000 800000041f85f980 0000000000000001 ffffffff81805080
      0000000000000000 0000000000000000 0000000000000000 0000000000000000
      0000000000000000 ffffffff81122620 0000000000000000 0000000000000000
      ...
Call Trace:
[<ffffffff81122620>] show_stack+0xc0/0xe0
[<ffffffff81805080>] dump_stack+0x8c/0xe0
[<ffffffff8114a7ac>] warn_slowpath_common+0x94/0xc8
[<ffffffff81693b1c>] of_device_alloc+0x294/0x2a0
[<ffffffff81693b74>] of_platform_device_create_pdata+0x4c/0xf0
[<ffffffff81693d58>] of_platform_bus_create+0x128/0x1a8
[<ffffffff81693da0>] of_platform_bus_create+0x170/0x1a8
[<ffffffff81693e8c>] of_platform_bus_probe+0xb4/0x110
[<ffffffff81100598>] do_one_initcall+0xe8/0x130
[<ffffffff81a92c5c>] kernel_init_freeable+0x1d4/0x2bc
[<ffffffff817fe140>] kernel_init+0x20/0x118
[<ffffffff8111d024>] ret_from_kernel_thread+0x14/0x1c

Signed-off-by: Yang Wei <Wei.Yang@windriver.com> 
---

Changes:
 
In v2:
Hi David,

According to your suggestion, I modify octeon-irq.c so that it doesn't try to reserve these numbers to fix this issue in v2.
How about is it?:-)

Thanks
Wei


 arch/mips/cavium-octeon/octeon-irq.c |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 25fbfae..31c76b1 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -975,10 +975,6 @@ static int octeon_irq_ciu_xlat(struct irq_domain *d,
 	if (ciu > 1 || bit > 63)
 		return -EINVAL;
 
-	/* These are the GPIO lines */
-	if (ciu == 0 && bit >= 16 && bit < 32)
-		return -EINVAL;
-
 	*out_hwirq = (ciu << 6) | bit;
 	*out_type = 0;
 
@@ -1010,6 +1006,13 @@ static int octeon_irq_ciu_map(struct irq_domain *d,
 	if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0)
 		return -EINVAL;
 
+	/*
+	 * If the irq is reserved for GPIO, we set virq to 0 so
+	 * that GPIO would be able to map it.
+	 */
+	if (line == 0 && bit >= 16 && bit <32)
+		virq = 0;
+
 	if (octeon_irq_ciu_is_edge(line, bit))
 		octeon_irq_set_ciu_mapping(virq, line, bit, 0,
 					   octeon_irq_ciu_chip,
@@ -1525,10 +1528,6 @@ static int octeon_irq_ciu2_xlat(struct irq_domain *d,
 	ciu = intspec[0];
 	bit = intspec[1];
 
-	/* Line 7  are the GPIO lines */
-	if (ciu > 6 || bit > 63)
-		return -EINVAL;
-
 	*out_hwirq = (ciu << 6) | bit;
 	*out_type = 0;
 
@@ -1570,10 +1569,16 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,
 	if (!octeon_irq_virq_in_range(virq))
 		return -EINVAL;
 
-	/* Line 7  are the GPIO lines */
-	if (line > 6 || octeon_irq_ciu_to_irq[line][bit] != 0)
+	if (octeon_irq_ciu_to_irq[line][bit] != 0)
 		return -EINVAL;
 
+	/*
+	 * Line 7 are the GPIO lines, we set virq to 0 so
+	 * that GPIO would be able to map it
+	 */
+	if (line > 6 || bit > 63)
+		virq = 0;
+
 	if (octeon_irq_ciu2_is_edge(line, bit))
 		octeon_irq_set_ciu_mapping(virq, line, bit, 0,
 					   &octeon_irq_chip_ciu2,
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH V2] mips/octeon_3xxx: Fix a warning on octeon_3xxx
@ 2014-03-19  9:51   ` Yang,Wei
  0 siblings, 0 replies; 15+ messages in thread
From: Yang,Wei @ 2014-03-19  9:51 UTC (permalink / raw)
  To: Wei.Yang, wei.yang, david.daney, ralf; +Cc: linux-mips, andreas.herrmann

ping.

Wei
On 03/18/2014 12:48 PM, Wei.Yang@windriver.com wrote:
> From: Yang Wei <Wei.Yang@windriver.com>
>
> Since the xlate of interrupts property of GPIO on octeon 3xxx
> does not success, so the following warning would be triggerred.
>
> WARNING: CPU: 1 PID: 1 at drivers/of/platform.c:173 of_device_alloc+0x294/0x2a0()
> Modules linked in:
> CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.14.0-rc6- #11
> Stack : ffffffff81a20000 0000000000000001 0000000000000004 ffffffff81b50000
>        0000000000000001 0000000000000000 0000000000000000 ffffffff8119e878
>        ffffffff81a20000 ffffffff8119ee98 0000000000000000 0000000000000000
>        ffffffff81b30000 ffffffff81b20000 ffffffff81932900 ffffffff81a11077
>        ffffffff81b27a08 800000041f8704a8 0000000000000001 0000000000000001
>        0000000000000000 800000041fbf7438 0000000000000001 ffffffff81800d90
>        800000041f85fa68 ffffffff8114a60c 0000000000000000 ffffffff811a0838
>        800000041f870000 800000041f85f980 0000000000000001 ffffffff81805080
>        0000000000000000 0000000000000000 0000000000000000 0000000000000000
>        0000000000000000 ffffffff81122620 0000000000000000 0000000000000000
>        ...
> Call Trace:
> [<ffffffff81122620>] show_stack+0xc0/0xe0
> [<ffffffff81805080>] dump_stack+0x8c/0xe0
> [<ffffffff8114a7ac>] warn_slowpath_common+0x94/0xc8
> [<ffffffff81693b1c>] of_device_alloc+0x294/0x2a0
> [<ffffffff81693b74>] of_platform_device_create_pdata+0x4c/0xf0
> [<ffffffff81693d58>] of_platform_bus_create+0x128/0x1a8
> [<ffffffff81693da0>] of_platform_bus_create+0x170/0x1a8
> [<ffffffff81693e8c>] of_platform_bus_probe+0xb4/0x110
> [<ffffffff81100598>] do_one_initcall+0xe8/0x130
> [<ffffffff81a92c5c>] kernel_init_freeable+0x1d4/0x2bc
> [<ffffffff817fe140>] kernel_init+0x20/0x118
> [<ffffffff8111d024>] ret_from_kernel_thread+0x14/0x1c
>
> Signed-off-by: Yang Wei <Wei.Yang@windriver.com>
> ---
>
> Changes:
>   
> In v2:
> Hi David,
>
> According to your suggestion, I modify octeon-irq.c so that it doesn't try to reserve these numbers to fix this issue in v2.
> How about is it?:-)
>
> Thanks
> Wei
>
>
>   arch/mips/cavium-octeon/octeon-irq.c |   25 +++++++++++++++----------
>   1 file changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
> index 25fbfae..31c76b1 100644
> --- a/arch/mips/cavium-octeon/octeon-irq.c
> +++ b/arch/mips/cavium-octeon/octeon-irq.c
> @@ -975,10 +975,6 @@ static int octeon_irq_ciu_xlat(struct irq_domain *d,
>   	if (ciu > 1 || bit > 63)
>   		return -EINVAL;
>   
> -	/* These are the GPIO lines */
> -	if (ciu == 0 && bit >= 16 && bit < 32)
> -		return -EINVAL;
> -
>   	*out_hwirq = (ciu << 6) | bit;
>   	*out_type = 0;
>   
> @@ -1010,6 +1006,13 @@ static int octeon_irq_ciu_map(struct irq_domain *d,
>   	if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0)
>   		return -EINVAL;
>   
> +	/*
> +	 * If the irq is reserved for GPIO, we set virq to 0 so
> +	 * that GPIO would be able to map it.
> +	 */
> +	if (line == 0 && bit >= 16 && bit <32)
> +		virq = 0;
> +
>   	if (octeon_irq_ciu_is_edge(line, bit))
>   		octeon_irq_set_ciu_mapping(virq, line, bit, 0,
>   					   octeon_irq_ciu_chip,
> @@ -1525,10 +1528,6 @@ static int octeon_irq_ciu2_xlat(struct irq_domain *d,
>   	ciu = intspec[0];
>   	bit = intspec[1];
>   
> -	/* Line 7  are the GPIO lines */
> -	if (ciu > 6 || bit > 63)
> -		return -EINVAL;
> -
>   	*out_hwirq = (ciu << 6) | bit;
>   	*out_type = 0;
>   
> @@ -1570,10 +1569,16 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,
>   	if (!octeon_irq_virq_in_range(virq))
>   		return -EINVAL;
>   
> -	/* Line 7  are the GPIO lines */
> -	if (line > 6 || octeon_irq_ciu_to_irq[line][bit] != 0)
> +	if (octeon_irq_ciu_to_irq[line][bit] != 0)
>   		return -EINVAL;
>   
> +	/*
> +	 * Line 7 are the GPIO lines, we set virq to 0 so
> +	 * that GPIO would be able to map it
> +	 */
> +	if (line > 6 || bit > 63)
> +		virq = 0;
> +
>   	if (octeon_irq_ciu2_is_edge(line, bit))
>   		octeon_irq_set_ciu_mapping(virq, line, bit, 0,
>   					   &octeon_irq_chip_ciu2,

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V2] mips/octeon_3xxx: Fix a warning on octeon_3xxx
@ 2014-03-19  9:51   ` Yang,Wei
  0 siblings, 0 replies; 15+ messages in thread
From: Yang,Wei @ 2014-03-19  9:51 UTC (permalink / raw)
  To: Wei.Yang, wei.yang, david.daney, ralf; +Cc: linux-mips, andreas.herrmann

ping.

Wei
On 03/18/2014 12:48 PM, Wei.Yang@windriver.com wrote:
> From: Yang Wei <Wei.Yang@windriver.com>
>
> Since the xlate of interrupts property of GPIO on octeon 3xxx
> does not success, so the following warning would be triggerred.
>
> WARNING: CPU: 1 PID: 1 at drivers/of/platform.c:173 of_device_alloc+0x294/0x2a0()
> Modules linked in:
> CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.14.0-rc6- #11
> Stack : ffffffff81a20000 0000000000000001 0000000000000004 ffffffff81b50000
>        0000000000000001 0000000000000000 0000000000000000 ffffffff8119e878
>        ffffffff81a20000 ffffffff8119ee98 0000000000000000 0000000000000000
>        ffffffff81b30000 ffffffff81b20000 ffffffff81932900 ffffffff81a11077
>        ffffffff81b27a08 800000041f8704a8 0000000000000001 0000000000000001
>        0000000000000000 800000041fbf7438 0000000000000001 ffffffff81800d90
>        800000041f85fa68 ffffffff8114a60c 0000000000000000 ffffffff811a0838
>        800000041f870000 800000041f85f980 0000000000000001 ffffffff81805080
>        0000000000000000 0000000000000000 0000000000000000 0000000000000000
>        0000000000000000 ffffffff81122620 0000000000000000 0000000000000000
>        ...
> Call Trace:
> [<ffffffff81122620>] show_stack+0xc0/0xe0
> [<ffffffff81805080>] dump_stack+0x8c/0xe0
> [<ffffffff8114a7ac>] warn_slowpath_common+0x94/0xc8
> [<ffffffff81693b1c>] of_device_alloc+0x294/0x2a0
> [<ffffffff81693b74>] of_platform_device_create_pdata+0x4c/0xf0
> [<ffffffff81693d58>] of_platform_bus_create+0x128/0x1a8
> [<ffffffff81693da0>] of_platform_bus_create+0x170/0x1a8
> [<ffffffff81693e8c>] of_platform_bus_probe+0xb4/0x110
> [<ffffffff81100598>] do_one_initcall+0xe8/0x130
> [<ffffffff81a92c5c>] kernel_init_freeable+0x1d4/0x2bc
> [<ffffffff817fe140>] kernel_init+0x20/0x118
> [<ffffffff8111d024>] ret_from_kernel_thread+0x14/0x1c
>
> Signed-off-by: Yang Wei <Wei.Yang@windriver.com>
> ---
>
> Changes:
>   
> In v2:
> Hi David,
>
> According to your suggestion, I modify octeon-irq.c so that it doesn't try to reserve these numbers to fix this issue in v2.
> How about is it?:-)
>
> Thanks
> Wei
>
>
>   arch/mips/cavium-octeon/octeon-irq.c |   25 +++++++++++++++----------
>   1 file changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
> index 25fbfae..31c76b1 100644
> --- a/arch/mips/cavium-octeon/octeon-irq.c
> +++ b/arch/mips/cavium-octeon/octeon-irq.c
> @@ -975,10 +975,6 @@ static int octeon_irq_ciu_xlat(struct irq_domain *d,
>   	if (ciu > 1 || bit > 63)
>   		return -EINVAL;
>   
> -	/* These are the GPIO lines */
> -	if (ciu == 0 && bit >= 16 && bit < 32)
> -		return -EINVAL;
> -
>   	*out_hwirq = (ciu << 6) | bit;
>   	*out_type = 0;
>   
> @@ -1010,6 +1006,13 @@ static int octeon_irq_ciu_map(struct irq_domain *d,
>   	if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0)
>   		return -EINVAL;
>   
> +	/*
> +	 * If the irq is reserved for GPIO, we set virq to 0 so
> +	 * that GPIO would be able to map it.
> +	 */
> +	if (line == 0 && bit >= 16 && bit <32)
> +		virq = 0;
> +
>   	if (octeon_irq_ciu_is_edge(line, bit))
>   		octeon_irq_set_ciu_mapping(virq, line, bit, 0,
>   					   octeon_irq_ciu_chip,
> @@ -1525,10 +1528,6 @@ static int octeon_irq_ciu2_xlat(struct irq_domain *d,
>   	ciu = intspec[0];
>   	bit = intspec[1];
>   
> -	/* Line 7  are the GPIO lines */
> -	if (ciu > 6 || bit > 63)
> -		return -EINVAL;
> -
>   	*out_hwirq = (ciu << 6) | bit;
>   	*out_type = 0;
>   
> @@ -1570,10 +1569,16 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,
>   	if (!octeon_irq_virq_in_range(virq))
>   		return -EINVAL;
>   
> -	/* Line 7  are the GPIO lines */
> -	if (line > 6 || octeon_irq_ciu_to_irq[line][bit] != 0)
> +	if (octeon_irq_ciu_to_irq[line][bit] != 0)
>   		return -EINVAL;
>   
> +	/*
> +	 * Line 7 are the GPIO lines, we set virq to 0 so
> +	 * that GPIO would be able to map it
> +	 */
> +	if (line > 6 || bit > 63)
> +		virq = 0;
> +
>   	if (octeon_irq_ciu2_is_edge(line, bit))
>   		octeon_irq_set_ciu_mapping(virq, line, bit, 0,
>   					   &octeon_irq_chip_ciu2,

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V2] mips/octeon_3xxx: Fix a warning on octeon_3xxx
@ 2014-03-19 16:20     ` Andreas Herrmann
  0 siblings, 0 replies; 15+ messages in thread
From: Andreas Herrmann @ 2014-03-19 16:20 UTC (permalink / raw)
  To: Yang,Wei; +Cc: david.daney, ralf, linux-mips

On Wed, Mar 19, 2014 at 05:51:41PM +0800, Yang,Wei wrote:
> ping.

I think, that the proper solution to avoid this warning is
to fix the DTS information.

The warning started to trigger since commit
3da5278727a895d49a601f67fd49dffa0b80f9a5 (of/irq: Rework of_irq_count())
was introduced.

This changed of_irq_count() like this:

 -       while (of_irq_to_resource(dev, nr, NULL))
 +       while (of_irq_parse_one(dev, nr, &irq) == 0)

Since then the code maps IRQs listed in the gpio-controller device
node to its interrupt-parent, I think.

Before this patch those interrupts weren't mapped at this point.

I think both patches are fine to avoid the warning.  With the new
version kind of a redundant mapping of GPIO interrupts happens (which
will be overridden for an GPIO IRQ as soon as it is really used).
This makes me think that the warning makes sense and the DTS needs to
be fixed. (We should not use octeon_irq_ciu_xlat/octeon_irq_ciu_map
for GPIO lines.)

I might be wrong but maybe specifying an interrupt-parent for the
gpio-controller (and thus listing the GPIO IRQs in the gpio-controller
device node) was not a good choice.


Andreas

> Wei
> On 03/18/2014 12:48 PM, Wei.Yang@windriver.com wrote:
> >From: Yang Wei <Wei.Yang@windriver.com>
> >
> >Since the xlate of interrupts property of GPIO on octeon 3xxx
> >does not success, so the following warning would be triggerred.
> >
> >WARNING: CPU: 1 PID: 1 at drivers/of/platform.c:173 of_device_alloc+0x294/0x2a0()
> >Modules linked in:
> >CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.14.0-rc6- #11
> >Stack : ffffffff81a20000 0000000000000001 0000000000000004 ffffffff81b50000
> >       0000000000000001 0000000000000000 0000000000000000 ffffffff8119e878
> >       ffffffff81a20000 ffffffff8119ee98 0000000000000000 0000000000000000
> >       ffffffff81b30000 ffffffff81b20000 ffffffff81932900 ffffffff81a11077
> >       ffffffff81b27a08 800000041f8704a8 0000000000000001 0000000000000001
> >       0000000000000000 800000041fbf7438 0000000000000001 ffffffff81800d90
> >       800000041f85fa68 ffffffff8114a60c 0000000000000000 ffffffff811a0838
> >       800000041f870000 800000041f85f980 0000000000000001 ffffffff81805080
> >       0000000000000000 0000000000000000 0000000000000000 0000000000000000
> >       0000000000000000 ffffffff81122620 0000000000000000 0000000000000000
> >       ...
> >Call Trace:
> >[<ffffffff81122620>] show_stack+0xc0/0xe0
> >[<ffffffff81805080>] dump_stack+0x8c/0xe0
> >[<ffffffff8114a7ac>] warn_slowpath_common+0x94/0xc8
> >[<ffffffff81693b1c>] of_device_alloc+0x294/0x2a0
> >[<ffffffff81693b74>] of_platform_device_create_pdata+0x4c/0xf0
> >[<ffffffff81693d58>] of_platform_bus_create+0x128/0x1a8
> >[<ffffffff81693da0>] of_platform_bus_create+0x170/0x1a8
> >[<ffffffff81693e8c>] of_platform_bus_probe+0xb4/0x110
> >[<ffffffff81100598>] do_one_initcall+0xe8/0x130
> >[<ffffffff81a92c5c>] kernel_init_freeable+0x1d4/0x2bc
> >[<ffffffff817fe140>] kernel_init+0x20/0x118
> >[<ffffffff8111d024>] ret_from_kernel_thread+0x14/0x1c
> >
> >Signed-off-by: Yang Wei <Wei.Yang@windriver.com>
> >---
> >
> >Changes:
> >In v2:
> >Hi David,
> >
> >According to your suggestion, I modify octeon-irq.c so that it doesn't try to reserve these numbers to fix this issue in v2.
> >How about is it?:-)
> >
> >Thanks
> >Wei
> >
> >
> >  arch/mips/cavium-octeon/octeon-irq.c |   25 +++++++++++++++----------
> >  1 file changed, 15 insertions(+), 10 deletions(-)
> >
> >diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
> >index 25fbfae..31c76b1 100644
> >--- a/arch/mips/cavium-octeon/octeon-irq.c
> >+++ b/arch/mips/cavium-octeon/octeon-irq.c
> >@@ -975,10 +975,6 @@ static int octeon_irq_ciu_xlat(struct irq_domain *d,
> >  	if (ciu > 1 || bit > 63)
> >  		return -EINVAL;
> >-	/* These are the GPIO lines */
> >-	if (ciu == 0 && bit >= 16 && bit < 32)
> >-		return -EINVAL;
> >-
> >  	*out_hwirq = (ciu << 6) | bit;
> >  	*out_type = 0;
> >@@ -1010,6 +1006,13 @@ static int octeon_irq_ciu_map(struct irq_domain *d,
> >  	if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0)
> >  		return -EINVAL;
> >+	/*
> >+	 * If the irq is reserved for GPIO, we set virq to 0 so
> >+	 * that GPIO would be able to map it.
> >+	 */
> >+	if (line == 0 && bit >= 16 && bit <32)
> >+		virq = 0;
> >+
> >  	if (octeon_irq_ciu_is_edge(line, bit))
> >  		octeon_irq_set_ciu_mapping(virq, line, bit, 0,
> >  					   octeon_irq_ciu_chip,
> >@@ -1525,10 +1528,6 @@ static int octeon_irq_ciu2_xlat(struct irq_domain *d,
> >  	ciu = intspec[0];
> >  	bit = intspec[1];
> >-	/* Line 7  are the GPIO lines */
> >-	if (ciu > 6 || bit > 63)
> >-		return -EINVAL;
> >-
> >  	*out_hwirq = (ciu << 6) | bit;
> >  	*out_type = 0;
> >@@ -1570,10 +1569,16 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,
> >  	if (!octeon_irq_virq_in_range(virq))
> >  		return -EINVAL;
> >-	/* Line 7  are the GPIO lines */
> >-	if (line > 6 || octeon_irq_ciu_to_irq[line][bit] != 0)
> >+	if (octeon_irq_ciu_to_irq[line][bit] != 0)
> >  		return -EINVAL;
> >+	/*
> >+	 * Line 7 are the GPIO lines, we set virq to 0 so
> >+	 * that GPIO would be able to map it
> >+	 */
> >+	if (line > 6 || bit > 63)
> >+		virq = 0;
> >+
> >  	if (octeon_irq_ciu2_is_edge(line, bit))
> >  		octeon_irq_set_ciu_mapping(virq, line, bit, 0,
> >  					   &octeon_irq_chip_ciu2,
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V2] mips/octeon_3xxx: Fix a warning on octeon_3xxx
@ 2014-03-19 16:20     ` Andreas Herrmann
  0 siblings, 0 replies; 15+ messages in thread
From: Andreas Herrmann @ 2014-03-19 16:20 UTC (permalink / raw)
  To: Yang,Wei; +Cc: david.daney, ralf, linux-mips

On Wed, Mar 19, 2014 at 05:51:41PM +0800, Yang,Wei wrote:
> ping.

I think, that the proper solution to avoid this warning is
to fix the DTS information.

The warning started to trigger since commit
3da5278727a895d49a601f67fd49dffa0b80f9a5 (of/irq: Rework of_irq_count())
was introduced.

This changed of_irq_count() like this:

 -       while (of_irq_to_resource(dev, nr, NULL))
 +       while (of_irq_parse_one(dev, nr, &irq) == 0)

Since then the code maps IRQs listed in the gpio-controller device
node to its interrupt-parent, I think.

Before this patch those interrupts weren't mapped at this point.

I think both patches are fine to avoid the warning.  With the new
version kind of a redundant mapping of GPIO interrupts happens (which
will be overridden for an GPIO IRQ as soon as it is really used).
This makes me think that the warning makes sense and the DTS needs to
be fixed. (We should not use octeon_irq_ciu_xlat/octeon_irq_ciu_map
for GPIO lines.)

I might be wrong but maybe specifying an interrupt-parent for the
gpio-controller (and thus listing the GPIO IRQs in the gpio-controller
device node) was not a good choice.


Andreas

> Wei
> On 03/18/2014 12:48 PM, Wei.Yang@windriver.com wrote:
> >From: Yang Wei <Wei.Yang@windriver.com>
> >
> >Since the xlate of interrupts property of GPIO on octeon 3xxx
> >does not success, so the following warning would be triggerred.
> >
> >WARNING: CPU: 1 PID: 1 at drivers/of/platform.c:173 of_device_alloc+0x294/0x2a0()
> >Modules linked in:
> >CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.14.0-rc6- #11
> >Stack : ffffffff81a20000 0000000000000001 0000000000000004 ffffffff81b50000
> >       0000000000000001 0000000000000000 0000000000000000 ffffffff8119e878
> >       ffffffff81a20000 ffffffff8119ee98 0000000000000000 0000000000000000
> >       ffffffff81b30000 ffffffff81b20000 ffffffff81932900 ffffffff81a11077
> >       ffffffff81b27a08 800000041f8704a8 0000000000000001 0000000000000001
> >       0000000000000000 800000041fbf7438 0000000000000001 ffffffff81800d90
> >       800000041f85fa68 ffffffff8114a60c 0000000000000000 ffffffff811a0838
> >       800000041f870000 800000041f85f980 0000000000000001 ffffffff81805080
> >       0000000000000000 0000000000000000 0000000000000000 0000000000000000
> >       0000000000000000 ffffffff81122620 0000000000000000 0000000000000000
> >       ...
> >Call Trace:
> >[<ffffffff81122620>] show_stack+0xc0/0xe0
> >[<ffffffff81805080>] dump_stack+0x8c/0xe0
> >[<ffffffff8114a7ac>] warn_slowpath_common+0x94/0xc8
> >[<ffffffff81693b1c>] of_device_alloc+0x294/0x2a0
> >[<ffffffff81693b74>] of_platform_device_create_pdata+0x4c/0xf0
> >[<ffffffff81693d58>] of_platform_bus_create+0x128/0x1a8
> >[<ffffffff81693da0>] of_platform_bus_create+0x170/0x1a8
> >[<ffffffff81693e8c>] of_platform_bus_probe+0xb4/0x110
> >[<ffffffff81100598>] do_one_initcall+0xe8/0x130
> >[<ffffffff81a92c5c>] kernel_init_freeable+0x1d4/0x2bc
> >[<ffffffff817fe140>] kernel_init+0x20/0x118
> >[<ffffffff8111d024>] ret_from_kernel_thread+0x14/0x1c
> >
> >Signed-off-by: Yang Wei <Wei.Yang@windriver.com>
> >---
> >
> >Changes:
> >In v2:
> >Hi David,
> >
> >According to your suggestion, I modify octeon-irq.c so that it doesn't try to reserve these numbers to fix this issue in v2.
> >How about is it?:-)
> >
> >Thanks
> >Wei
> >
> >
> >  arch/mips/cavium-octeon/octeon-irq.c |   25 +++++++++++++++----------
> >  1 file changed, 15 insertions(+), 10 deletions(-)
> >
> >diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
> >index 25fbfae..31c76b1 100644
> >--- a/arch/mips/cavium-octeon/octeon-irq.c
> >+++ b/arch/mips/cavium-octeon/octeon-irq.c
> >@@ -975,10 +975,6 @@ static int octeon_irq_ciu_xlat(struct irq_domain *d,
> >  	if (ciu > 1 || bit > 63)
> >  		return -EINVAL;
> >-	/* These are the GPIO lines */
> >-	if (ciu == 0 && bit >= 16 && bit < 32)
> >-		return -EINVAL;
> >-
> >  	*out_hwirq = (ciu << 6) | bit;
> >  	*out_type = 0;
> >@@ -1010,6 +1006,13 @@ static int octeon_irq_ciu_map(struct irq_domain *d,
> >  	if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0)
> >  		return -EINVAL;
> >+	/*
> >+	 * If the irq is reserved for GPIO, we set virq to 0 so
> >+	 * that GPIO would be able to map it.
> >+	 */
> >+	if (line == 0 && bit >= 16 && bit <32)
> >+		virq = 0;
> >+
> >  	if (octeon_irq_ciu_is_edge(line, bit))
> >  		octeon_irq_set_ciu_mapping(virq, line, bit, 0,
> >  					   octeon_irq_ciu_chip,
> >@@ -1525,10 +1528,6 @@ static int octeon_irq_ciu2_xlat(struct irq_domain *d,
> >  	ciu = intspec[0];
> >  	bit = intspec[1];
> >-	/* Line 7  are the GPIO lines */
> >-	if (ciu > 6 || bit > 63)
> >-		return -EINVAL;
> >-
> >  	*out_hwirq = (ciu << 6) | bit;
> >  	*out_type = 0;
> >@@ -1570,10 +1569,16 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,
> >  	if (!octeon_irq_virq_in_range(virq))
> >  		return -EINVAL;
> >-	/* Line 7  are the GPIO lines */
> >-	if (line > 6 || octeon_irq_ciu_to_irq[line][bit] != 0)
> >+	if (octeon_irq_ciu_to_irq[line][bit] != 0)
> >  		return -EINVAL;
> >+	/*
> >+	 * Line 7 are the GPIO lines, we set virq to 0 so
> >+	 * that GPIO would be able to map it
> >+	 */
> >+	if (line > 6 || bit > 63)
> >+		virq = 0;
> >+
> >  	if (octeon_irq_ciu2_is_edge(line, bit))
> >  		octeon_irq_set_ciu_mapping(virq, line, bit, 0,
> >  					   &octeon_irq_chip_ciu2,
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V2] mips/octeon_3xxx: Fix a warning on octeon_3xxx
@ 2014-03-19 18:34       ` David Daney
  0 siblings, 0 replies; 15+ messages in thread
From: David Daney @ 2014-03-19 18:34 UTC (permalink / raw)
  To: Andreas Herrmann; +Cc: Yang,Wei, david.daney, ralf, linux-mips

On 03/19/2014 09:20 AM, Andreas Herrmann wrote:
> On Wed, Mar 19, 2014 at 05:51:41PM +0800, Yang,Wei wrote:
>> ping.
>
> I think, that the proper solution to avoid this warning is
> to fix the DTS information.
>

Just for the record:  The DTS is reflecting the actual routing of the 
signals within the SoC.  So I would argue that we shouldn't change it 
for these two reasons:

1) It accurately reflects reality.

2) There are deployed bootloaders that supply this to the kernel that 
are difficult to change.


> The warning started to trigger since commit
> 3da5278727a895d49a601f67fd49dffa0b80f9a5 (of/irq: Rework of_irq_count())
> was introduced.
>
> This changed of_irq_count() like this:
>
>   -       while (of_irq_to_resource(dev, nr, NULL))
>   +       while (of_irq_parse_one(dev, nr, &irq) == 0)
>
> Since then the code maps IRQs listed in the gpio-controller device
> node to its interrupt-parent, I think.
>
> Before this patch those interrupts weren't mapped at this point.
>
> I think both patches are fine to avoid the warning.  With the new
> version kind of a redundant mapping of GPIO interrupts happens (which
> will be overridden for an GPIO IRQ as soon as it is really used).
> This makes me think that the warning makes sense and the DTS needs to
> be fixed. (We should not use octeon_irq_ciu_xlat/octeon_irq_ciu_map
> for GPIO lines.)
>
> I might be wrong but maybe specifying an interrupt-parent for the
> gpio-controller (and thus listing the GPIO IRQs in the gpio-controller
> device node) was not a good choice.
>

Andreas has a slightly modified version of the V2 patch that we tested, 
and it seems to work.  I think we should go with that instead of the V2 
patch.

David Daney


>
>>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V2] mips/octeon_3xxx: Fix a warning on octeon_3xxx
@ 2014-03-19 18:34       ` David Daney
  0 siblings, 0 replies; 15+ messages in thread
From: David Daney @ 2014-03-19 18:34 UTC (permalink / raw)
  To: Andreas Herrmann; +Cc: Yang,Wei, david.daney, ralf, linux-mips

On 03/19/2014 09:20 AM, Andreas Herrmann wrote:
> On Wed, Mar 19, 2014 at 05:51:41PM +0800, Yang,Wei wrote:
>> ping.
>
> I think, that the proper solution to avoid this warning is
> to fix the DTS information.
>

Just for the record:  The DTS is reflecting the actual routing of the 
signals within the SoC.  So I would argue that we shouldn't change it 
for these two reasons:

1) It accurately reflects reality.

2) There are deployed bootloaders that supply this to the kernel that 
are difficult to change.


> The warning started to trigger since commit
> 3da5278727a895d49a601f67fd49dffa0b80f9a5 (of/irq: Rework of_irq_count())
> was introduced.
>
> This changed of_irq_count() like this:
>
>   -       while (of_irq_to_resource(dev, nr, NULL))
>   +       while (of_irq_parse_one(dev, nr, &irq) == 0)
>
> Since then the code maps IRQs listed in the gpio-controller device
> node to its interrupt-parent, I think.
>
> Before this patch those interrupts weren't mapped at this point.
>
> I think both patches are fine to avoid the warning.  With the new
> version kind of a redundant mapping of GPIO interrupts happens (which
> will be overridden for an GPIO IRQ as soon as it is really used).
> This makes me think that the warning makes sense and the DTS needs to
> be fixed. (We should not use octeon_irq_ciu_xlat/octeon_irq_ciu_map
> for GPIO lines.)
>
> I might be wrong but maybe specifying an interrupt-parent for the
> gpio-controller (and thus listing the GPIO IRQs in the gpio-controller
> device node) was not a good choice.
>

Andreas has a slightly modified version of the V2 patch that we tested, 
and it seems to work.  I think we should go with that instead of the V2 
patch.

David Daney


>
>>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] MIPS: octeon: Fix warning in of_device_alloc on cn3xxx
@ 2014-03-19 22:03         ` Andreas Herrmann
  0 siblings, 0 replies; 15+ messages in thread
From: Andreas Herrmann @ 2014-03-19 22:03 UTC (permalink / raw)
  To: David Daney, ralf; +Cc: Yang,Wei, linux-mips


Starting with commit 3da5278727a895d49a601f67fd49dffa0b80f9a5 (of/irq:
Rework of_irq_count()) the following warning is triggered on octeon
cn3xxx:

[    0.887281] WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171 of_device_alloc+0x228/0x230()
[    0.895642] Modules linked in:
[    0.898689] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0-rc7-00012-g9ae51f2-dirty #41
[    0.906860] Stack : c8b439581166d96e ffffffff816b0000 0000000040808000 ffffffff81185ddc
[    0.906860] 	  0000000000000000 0000000000000000 0000000000000000 000000000000000b
[    0.906860] 	  000000000000000a 000000000000000a 0000000000000000 0000000000000000
[    0.906860] 	  ffffffff81740000 ffffffff81720000 ffffffff81615900 ffffffff816b0177
[    0.906860] 	  ffffffff81727d10 800000041f868fb0 0000000000000001 0000000000000000
[    0.906860] 	  0000000000000000 0000000000000038 0000000000000001 ffffffff81568484
[    0.906860] 	  800000041f86faa8 ffffffff81145ddc 0000000000000000 ffffffff811873f4
[    0.906860] 	  800000041f868b88 800000041f86f9c0 0000000000000000 ffffffff81569c9c
[    0.906860] 	  0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    0.906860] 	  0000000000000000 ffffffff811205e0 0000000000000000 0000000000000000
[    0.906860] 	  ...
[    0.971695] Call Trace:
[    0.974139] [<ffffffff811205e0>] show_stack+0x68/0x80
[    0.979183] [<ffffffff81569c9c>] dump_stack+0x8c/0xe0
[    0.984196] [<ffffffff81145efc>] warn_slowpath_common+0x84/0xb8
[    0.990110] [<ffffffff81436888>] of_device_alloc+0x228/0x230
[    0.995726] [<ffffffff814368d8>] of_platform_device_create_pdata+0x48/0xd0
[    1.002593] [<ffffffff81436a94>] of_platform_bus_create+0x134/0x1e8
[    1.008837] [<ffffffff81436af8>] of_platform_bus_create+0x198/0x1e8
[    1.015064] [<ffffffff81436cc4>] of_platform_bus_probe+0xa4/0x100
[    1.021149] [<ffffffff81100570>] do_one_initcall+0xd8/0x128
[    1.026701] [<ffffffff816e2a10>] kernel_init_freeable+0x144/0x210
[    1.032753] [<ffffffff81564bc4>] kernel_init+0x14/0x110
[    1.037973] [<ffffffff8111bb44>] ret_from_kernel_thread+0x14/0x1c

With this commit the kernel starts mapping the interrupts listed for
gpio-controller node. irq_domain_ops for CIU (octeon_irq_ciu_map and
octeon_irq_ciu_xlat) refuse to handle the GPIO lines (returning -EINVAL)
and this is causing above warning in of_device_alloc().

Modify irq_domain_ops for CIU and CIU2 to "gracefully handle" GPIO
lines (neither return error code nor call octeon_irq_set_ciu_mapping
for it). This should avoid the warning.

(As before the real setup for GPIO lines will happen using
irq_domain_ops of gpio-controller.)

This patch is based on Wei's patch v2 (see
http://marc.info/?l=linux-mips&m=139511814813247).

Reported-by: Yang Wei <wei.yang@windriver.com>
Cc: David Daney <david.daney@caviumnetworks.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
---
 arch/mips/cavium-octeon/octeon-irq.c |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 25fbfae..c2bb4f8 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -975,10 +975,6 @@ static int octeon_irq_ciu_xlat(struct irq_domain *d,
 	if (ciu > 1 || bit > 63)
 		return -EINVAL;
 
-	/* These are the GPIO lines */
-	if (ciu == 0 && bit >= 16 && bit < 32)
-		return -EINVAL;
-
 	*out_hwirq = (ciu << 6) | bit;
 	*out_type = 0;
 
@@ -1007,6 +1003,10 @@ static int octeon_irq_ciu_map(struct irq_domain *d,
 	if (!octeon_irq_virq_in_range(virq))
 		return -EINVAL;
 
+	/* Don't map irq if it is reserved for GPIO. */
+	if (line == 0 && bit >= 16 && bit <32)
+		return 0;
+
 	if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0)
 		return -EINVAL;
 
@@ -1525,10 +1525,6 @@ static int octeon_irq_ciu2_xlat(struct irq_domain *d,
 	ciu = intspec[0];
 	bit = intspec[1];
 
-	/* Line 7  are the GPIO lines */
-	if (ciu > 6 || bit > 63)
-		return -EINVAL;
-
 	*out_hwirq = (ciu << 6) | bit;
 	*out_type = 0;
 
@@ -1570,8 +1566,14 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,
 	if (!octeon_irq_virq_in_range(virq))
 		return -EINVAL;
 
-	/* Line 7  are the GPIO lines */
-	if (line > 6 || octeon_irq_ciu_to_irq[line][bit] != 0)
+	/*
+	 * Don't map irq if it is reserved for GPIO.
+	 * (Line 7 are the GPIO lines.)
+	 */
+	if (line == 7)
+		return 0;
+
+	if (line > 7 || octeon_irq_ciu_to_irq[line][bit] != 0)
 		return -EINVAL;
 
 	if (octeon_irq_ciu2_is_edge(line, bit))
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] MIPS: octeon: Fix warning in of_device_alloc on cn3xxx
@ 2014-03-19 22:03         ` Andreas Herrmann
  0 siblings, 0 replies; 15+ messages in thread
From: Andreas Herrmann @ 2014-03-19 22:03 UTC (permalink / raw)
  To: David Daney, ralf; +Cc: Yang,Wei, linux-mips


Starting with commit 3da5278727a895d49a601f67fd49dffa0b80f9a5 (of/irq:
Rework of_irq_count()) the following warning is triggered on octeon
cn3xxx:

[    0.887281] WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171 of_device_alloc+0x228/0x230()
[    0.895642] Modules linked in:
[    0.898689] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0-rc7-00012-g9ae51f2-dirty #41
[    0.906860] Stack : c8b439581166d96e ffffffff816b0000 0000000040808000 ffffffff81185ddc
[    0.906860] 	  0000000000000000 0000000000000000 0000000000000000 000000000000000b
[    0.906860] 	  000000000000000a 000000000000000a 0000000000000000 0000000000000000
[    0.906860] 	  ffffffff81740000 ffffffff81720000 ffffffff81615900 ffffffff816b0177
[    0.906860] 	  ffffffff81727d10 800000041f868fb0 0000000000000001 0000000000000000
[    0.906860] 	  0000000000000000 0000000000000038 0000000000000001 ffffffff81568484
[    0.906860] 	  800000041f86faa8 ffffffff81145ddc 0000000000000000 ffffffff811873f4
[    0.906860] 	  800000041f868b88 800000041f86f9c0 0000000000000000 ffffffff81569c9c
[    0.906860] 	  0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    0.906860] 	  0000000000000000 ffffffff811205e0 0000000000000000 0000000000000000
[    0.906860] 	  ...
[    0.971695] Call Trace:
[    0.974139] [<ffffffff811205e0>] show_stack+0x68/0x80
[    0.979183] [<ffffffff81569c9c>] dump_stack+0x8c/0xe0
[    0.984196] [<ffffffff81145efc>] warn_slowpath_common+0x84/0xb8
[    0.990110] [<ffffffff81436888>] of_device_alloc+0x228/0x230
[    0.995726] [<ffffffff814368d8>] of_platform_device_create_pdata+0x48/0xd0
[    1.002593] [<ffffffff81436a94>] of_platform_bus_create+0x134/0x1e8
[    1.008837] [<ffffffff81436af8>] of_platform_bus_create+0x198/0x1e8
[    1.015064] [<ffffffff81436cc4>] of_platform_bus_probe+0xa4/0x100
[    1.021149] [<ffffffff81100570>] do_one_initcall+0xd8/0x128
[    1.026701] [<ffffffff816e2a10>] kernel_init_freeable+0x144/0x210
[    1.032753] [<ffffffff81564bc4>] kernel_init+0x14/0x110
[    1.037973] [<ffffffff8111bb44>] ret_from_kernel_thread+0x14/0x1c

With this commit the kernel starts mapping the interrupts listed for
gpio-controller node. irq_domain_ops for CIU (octeon_irq_ciu_map and
octeon_irq_ciu_xlat) refuse to handle the GPIO lines (returning -EINVAL)
and this is causing above warning in of_device_alloc().

Modify irq_domain_ops for CIU and CIU2 to "gracefully handle" GPIO
lines (neither return error code nor call octeon_irq_set_ciu_mapping
for it). This should avoid the warning.

(As before the real setup for GPIO lines will happen using
irq_domain_ops of gpio-controller.)

This patch is based on Wei's patch v2 (see
http://marc.info/?l=linux-mips&m=139511814813247).

Reported-by: Yang Wei <wei.yang@windriver.com>
Cc: David Daney <david.daney@caviumnetworks.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
---
 arch/mips/cavium-octeon/octeon-irq.c |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 25fbfae..c2bb4f8 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -975,10 +975,6 @@ static int octeon_irq_ciu_xlat(struct irq_domain *d,
 	if (ciu > 1 || bit > 63)
 		return -EINVAL;
 
-	/* These are the GPIO lines */
-	if (ciu == 0 && bit >= 16 && bit < 32)
-		return -EINVAL;
-
 	*out_hwirq = (ciu << 6) | bit;
 	*out_type = 0;
 
@@ -1007,6 +1003,10 @@ static int octeon_irq_ciu_map(struct irq_domain *d,
 	if (!octeon_irq_virq_in_range(virq))
 		return -EINVAL;
 
+	/* Don't map irq if it is reserved for GPIO. */
+	if (line == 0 && bit >= 16 && bit <32)
+		return 0;
+
 	if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0)
 		return -EINVAL;
 
@@ -1525,10 +1525,6 @@ static int octeon_irq_ciu2_xlat(struct irq_domain *d,
 	ciu = intspec[0];
 	bit = intspec[1];
 
-	/* Line 7  are the GPIO lines */
-	if (ciu > 6 || bit > 63)
-		return -EINVAL;
-
 	*out_hwirq = (ciu << 6) | bit;
 	*out_type = 0;
 
@@ -1570,8 +1566,14 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,
 	if (!octeon_irq_virq_in_range(virq))
 		return -EINVAL;
 
-	/* Line 7  are the GPIO lines */
-	if (line > 6 || octeon_irq_ciu_to_irq[line][bit] != 0)
+	/*
+	 * Don't map irq if it is reserved for GPIO.
+	 * (Line 7 are the GPIO lines.)
+	 */
+	if (line == 7)
+		return 0;
+
+	if (line > 7 || octeon_irq_ciu_to_irq[line][bit] != 0)
 		return -EINVAL;
 
 	if (octeon_irq_ciu2_is_edge(line, bit))
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] MIPS: octeon: Fix warning in of_device_alloc on cn3xxx
@ 2014-03-19 22:12           ` David Daney
  0 siblings, 0 replies; 15+ messages in thread
From: David Daney @ 2014-03-19 22:12 UTC (permalink / raw)
  To: Andreas Herrmann, ralf; +Cc: Yang,Wei, linux-mips

On 03/19/2014 03:03 PM, Andreas Herrmann wrote:
>
> Starting with commit 3da5278727a895d49a601f67fd49dffa0b80f9a5 (of/irq:
> Rework of_irq_count()) the following warning is triggered on octeon
> cn3xxx:
>
> [    0.887281] WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171 of_device_alloc+0x228/0x230()
> [    0.895642] Modules linked in:
> [    0.898689] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0-rc7-00012-g9ae51f2-dirty #41
> [    0.906860] Stack : c8b439581166d96e ffffffff816b0000 0000000040808000 ffffffff81185ddc
> [    0.906860] 	  0000000000000000 0000000000000000 0000000000000000 000000000000000b
> [    0.906860] 	  000000000000000a 000000000000000a 0000000000000000 0000000000000000
> [    0.906860] 	  ffffffff81740000 ffffffff81720000 ffffffff81615900 ffffffff816b0177
> [    0.906860] 	  ffffffff81727d10 800000041f868fb0 0000000000000001 0000000000000000
> [    0.906860] 	  0000000000000000 0000000000000038 0000000000000001 ffffffff81568484
> [    0.906860] 	  800000041f86faa8 ffffffff81145ddc 0000000000000000 ffffffff811873f4
> [    0.906860] 	  800000041f868b88 800000041f86f9c0 0000000000000000 ffffffff81569c9c
> [    0.906860] 	  0000000000000000 0000000000000000 0000000000000000 0000000000000000
> [    0.906860] 	  0000000000000000 ffffffff811205e0 0000000000000000 0000000000000000
> [    0.906860] 	  ...
> [    0.971695] Call Trace:
> [    0.974139] [<ffffffff811205e0>] show_stack+0x68/0x80
> [    0.979183] [<ffffffff81569c9c>] dump_stack+0x8c/0xe0
> [    0.984196] [<ffffffff81145efc>] warn_slowpath_common+0x84/0xb8
> [    0.990110] [<ffffffff81436888>] of_device_alloc+0x228/0x230
> [    0.995726] [<ffffffff814368d8>] of_platform_device_create_pdata+0x48/0xd0
> [    1.002593] [<ffffffff81436a94>] of_platform_bus_create+0x134/0x1e8
> [    1.008837] [<ffffffff81436af8>] of_platform_bus_create+0x198/0x1e8
> [    1.015064] [<ffffffff81436cc4>] of_platform_bus_probe+0xa4/0x100
> [    1.021149] [<ffffffff81100570>] do_one_initcall+0xd8/0x128
> [    1.026701] [<ffffffff816e2a10>] kernel_init_freeable+0x144/0x210
> [    1.032753] [<ffffffff81564bc4>] kernel_init+0x14/0x110
> [    1.037973] [<ffffffff8111bb44>] ret_from_kernel_thread+0x14/0x1c
>
> With this commit the kernel starts mapping the interrupts listed for
> gpio-controller node. irq_domain_ops for CIU (octeon_irq_ciu_map and
> octeon_irq_ciu_xlat) refuse to handle the GPIO lines (returning -EINVAL)
> and this is causing above warning in of_device_alloc().
>
> Modify irq_domain_ops for CIU and CIU2 to "gracefully handle" GPIO
> lines (neither return error code nor call octeon_irq_set_ciu_mapping
> for it). This should avoid the warning.
>
> (As before the real setup for GPIO lines will happen using
> irq_domain_ops of gpio-controller.)
>
> This patch is based on Wei's patch v2 (see
> http://marc.info/?l=linux-mips&m=139511814813247).
>
> Reported-by: Yang Wei <wei.yang@windriver.com>
> Cc: David Daney <david.daney@caviumnetworks.com>

Thanks Andreas and Yang Wei.

FWIW:

Tested and...

Acked-by: David Daney <david.daney@cavium.com>


Ralf et al.  If you are sending more patches for 3.14, this would be a 
good candidate.

Thanks,
David Daney

> Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
> ---
>   arch/mips/cavium-octeon/octeon-irq.c |   22 ++++++++++++----------
>   1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
> index 25fbfae..c2bb4f8 100644
> --- a/arch/mips/cavium-octeon/octeon-irq.c
> +++ b/arch/mips/cavium-octeon/octeon-irq.c
[...]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] MIPS: octeon: Fix warning in of_device_alloc on cn3xxx
@ 2014-03-19 22:12           ` David Daney
  0 siblings, 0 replies; 15+ messages in thread
From: David Daney @ 2014-03-19 22:12 UTC (permalink / raw)
  To: Andreas Herrmann, ralf; +Cc: Yang,Wei, linux-mips

On 03/19/2014 03:03 PM, Andreas Herrmann wrote:
>
> Starting with commit 3da5278727a895d49a601f67fd49dffa0b80f9a5 (of/irq:
> Rework of_irq_count()) the following warning is triggered on octeon
> cn3xxx:
>
> [    0.887281] WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171 of_device_alloc+0x228/0x230()
> [    0.895642] Modules linked in:
> [    0.898689] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0-rc7-00012-g9ae51f2-dirty #41
> [    0.906860] Stack : c8b439581166d96e ffffffff816b0000 0000000040808000 ffffffff81185ddc
> [    0.906860] 	  0000000000000000 0000000000000000 0000000000000000 000000000000000b
> [    0.906860] 	  000000000000000a 000000000000000a 0000000000000000 0000000000000000
> [    0.906860] 	  ffffffff81740000 ffffffff81720000 ffffffff81615900 ffffffff816b0177
> [    0.906860] 	  ffffffff81727d10 800000041f868fb0 0000000000000001 0000000000000000
> [    0.906860] 	  0000000000000000 0000000000000038 0000000000000001 ffffffff81568484
> [    0.906860] 	  800000041f86faa8 ffffffff81145ddc 0000000000000000 ffffffff811873f4
> [    0.906860] 	  800000041f868b88 800000041f86f9c0 0000000000000000 ffffffff81569c9c
> [    0.906860] 	  0000000000000000 0000000000000000 0000000000000000 0000000000000000
> [    0.906860] 	  0000000000000000 ffffffff811205e0 0000000000000000 0000000000000000
> [    0.906860] 	  ...
> [    0.971695] Call Trace:
> [    0.974139] [<ffffffff811205e0>] show_stack+0x68/0x80
> [    0.979183] [<ffffffff81569c9c>] dump_stack+0x8c/0xe0
> [    0.984196] [<ffffffff81145efc>] warn_slowpath_common+0x84/0xb8
> [    0.990110] [<ffffffff81436888>] of_device_alloc+0x228/0x230
> [    0.995726] [<ffffffff814368d8>] of_platform_device_create_pdata+0x48/0xd0
> [    1.002593] [<ffffffff81436a94>] of_platform_bus_create+0x134/0x1e8
> [    1.008837] [<ffffffff81436af8>] of_platform_bus_create+0x198/0x1e8
> [    1.015064] [<ffffffff81436cc4>] of_platform_bus_probe+0xa4/0x100
> [    1.021149] [<ffffffff81100570>] do_one_initcall+0xd8/0x128
> [    1.026701] [<ffffffff816e2a10>] kernel_init_freeable+0x144/0x210
> [    1.032753] [<ffffffff81564bc4>] kernel_init+0x14/0x110
> [    1.037973] [<ffffffff8111bb44>] ret_from_kernel_thread+0x14/0x1c
>
> With this commit the kernel starts mapping the interrupts listed for
> gpio-controller node. irq_domain_ops for CIU (octeon_irq_ciu_map and
> octeon_irq_ciu_xlat) refuse to handle the GPIO lines (returning -EINVAL)
> and this is causing above warning in of_device_alloc().
>
> Modify irq_domain_ops for CIU and CIU2 to "gracefully handle" GPIO
> lines (neither return error code nor call octeon_irq_set_ciu_mapping
> for it). This should avoid the warning.
>
> (As before the real setup for GPIO lines will happen using
> irq_domain_ops of gpio-controller.)
>
> This patch is based on Wei's patch v2 (see
> http://marc.info/?l=linux-mips&m=139511814813247).
>
> Reported-by: Yang Wei <wei.yang@windriver.com>
> Cc: David Daney <david.daney@caviumnetworks.com>

Thanks Andreas and Yang Wei.

FWIW:

Tested and...

Acked-by: David Daney <david.daney@cavium.com>


Ralf et al.  If you are sending more patches for 3.14, this would be a 
good candidate.

Thanks,
David Daney

> Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
> ---
>   arch/mips/cavium-octeon/octeon-irq.c |   22 ++++++++++++----------
>   1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
> index 25fbfae..c2bb4f8 100644
> --- a/arch/mips/cavium-octeon/octeon-irq.c
> +++ b/arch/mips/cavium-octeon/octeon-irq.c
[...]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] MIPS: octeon: Fix warning in of_device_alloc on cn3xxx
  2014-03-19 22:03         ` Andreas Herrmann
  (?)
  (?)
@ 2014-03-19 23:11         ` Aaro Koskinen
  -1 siblings, 0 replies; 15+ messages in thread
From: Aaro Koskinen @ 2014-03-19 23:11 UTC (permalink / raw)
  To: Andreas Herrmann; +Cc: David Daney, ralf, Yang,Wei, linux-mips

Hi,

On Wed, Mar 19, 2014 at 11:03:30PM +0100, Andreas Herrmann wrote:
> Starting with commit 3da5278727a895d49a601f67fd49dffa0b80f9a5 (of/irq:
> Rework of_irq_count()) the following warning is triggered on octeon
> cn3xxx:

[...]

> Reported-by: Yang Wei <wei.yang@windriver.com>
> Cc: David Daney <david.daney@caviumnetworks.com>
> Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>

Thanks,

A.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] MIPS: octeon: Fix warning in of_device_alloc on cn3xxx
@ 2014-03-20  0:53           ` Yang,Wei
  0 siblings, 0 replies; 15+ messages in thread
From: Yang,Wei @ 2014-03-20  0:53 UTC (permalink / raw)
  To: Andreas Herrmann, David Daney, ralf; +Cc: linux-mips, Ashfield, Bruce

On 03/20/2014 06:03 AM, Andreas Herrmann wrote:
> Starting with commit 3da5278727a895d49a601f67fd49dffa0b80f9a5 (of/irq:
> Rework of_irq_count()) the following warning is triggered on octeon
> cn3xxx:
>
> [    0.887281] WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171 of_device_alloc+0x228/0x230()
> [    0.895642] Modules linked in:
> [    0.898689] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0-rc7-00012-g9ae51f2-dirty #41
> [    0.906860] Stack : c8b439581166d96e ffffffff816b0000 0000000040808000 ffffffff81185ddc
> [    0.906860] 	  0000000000000000 0000000000000000 0000000000000000 000000000000000b
> [    0.906860] 	  000000000000000a 000000000000000a 0000000000000000 0000000000000000
> [    0.906860] 	  ffffffff81740000 ffffffff81720000 ffffffff81615900 ffffffff816b0177
> [    0.906860] 	  ffffffff81727d10 800000041f868fb0 0000000000000001 0000000000000000
> [    0.906860] 	  0000000000000000 0000000000000038 0000000000000001 ffffffff81568484
> [    0.906860] 	  800000041f86faa8 ffffffff81145ddc 0000000000000000 ffffffff811873f4
> [    0.906860] 	  800000041f868b88 800000041f86f9c0 0000000000000000 ffffffff81569c9c
> [    0.906860] 	  0000000000000000 0000000000000000 0000000000000000 0000000000000000
> [    0.906860] 	  0000000000000000 ffffffff811205e0 0000000000000000 0000000000000000
> [    0.906860] 	  ...
> [    0.971695] Call Trace:
> [    0.974139] [<ffffffff811205e0>] show_stack+0x68/0x80
> [    0.979183] [<ffffffff81569c9c>] dump_stack+0x8c/0xe0
> [    0.984196] [<ffffffff81145efc>] warn_slowpath_common+0x84/0xb8
> [    0.990110] [<ffffffff81436888>] of_device_alloc+0x228/0x230
> [    0.995726] [<ffffffff814368d8>] of_platform_device_create_pdata+0x48/0xd0
> [    1.002593] [<ffffffff81436a94>] of_platform_bus_create+0x134/0x1e8
> [    1.008837] [<ffffffff81436af8>] of_platform_bus_create+0x198/0x1e8
> [    1.015064] [<ffffffff81436cc4>] of_platform_bus_probe+0xa4/0x100
> [    1.021149] [<ffffffff81100570>] do_one_initcall+0xd8/0x128
> [    1.026701] [<ffffffff816e2a10>] kernel_init_freeable+0x144/0x210
> [    1.032753] [<ffffffff81564bc4>] kernel_init+0x14/0x110
> [    1.037973] [<ffffffff8111bb44>] ret_from_kernel_thread+0x14/0x1c
>
> With this commit the kernel starts mapping the interrupts listed for
> gpio-controller node. irq_domain_ops for CIU (octeon_irq_ciu_map and
> octeon_irq_ciu_xlat) refuse to handle the GPIO lines (returning -EINVAL)
> and this is causing above warning in of_device_alloc().
>
> Modify irq_domain_ops for CIU and CIU2 to "gracefully handle" GPIO
> lines (neither return error code nor call octeon_irq_set_ciu_mapping
> for it). This should avoid the warning.
>
> (As before the real setup for GPIO lines will happen using
> irq_domain_ops of gpio-controller.)
>
> This patch is based on Wei's patch v2 (see
> http://marc.info/?l=linux-mips&m=139511814813247).
>
> Reported-by: Yang Wei <wei.yang@windriver.com>
> Cc: David Daney <david.daney@caviumnetworks.com>
> Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>

Okay, Thank you Andreas and David for this review.


Thanks
Wei
> ---
>   arch/mips/cavium-octeon/octeon-irq.c |   22 ++++++++++++----------
>   1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
> index 25fbfae..c2bb4f8 100644
> --- a/arch/mips/cavium-octeon/octeon-irq.c
> +++ b/arch/mips/cavium-octeon/octeon-irq.c
> @@ -975,10 +975,6 @@ static int octeon_irq_ciu_xlat(struct irq_domain *d,
>   	if (ciu > 1 || bit > 63)
>   		return -EINVAL;
>   
> -	/* These are the GPIO lines */
> -	if (ciu == 0 && bit >= 16 && bit < 32)
> -		return -EINVAL;
> -
>   	*out_hwirq = (ciu << 6) | bit;
>   	*out_type = 0;
>   
> @@ -1007,6 +1003,10 @@ static int octeon_irq_ciu_map(struct irq_domain *d,
>   	if (!octeon_irq_virq_in_range(virq))
>   		return -EINVAL;
>   
> +	/* Don't map irq if it is reserved for GPIO. */
> +	if (line == 0 && bit >= 16 && bit <32)
> +		return 0;
> +
>   	if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0)
>   		return -EINVAL;
>   
> @@ -1525,10 +1525,6 @@ static int octeon_irq_ciu2_xlat(struct irq_domain *d,
>   	ciu = intspec[0];
>   	bit = intspec[1];
>   
> -	/* Line 7  are the GPIO lines */
> -	if (ciu > 6 || bit > 63)
> -		return -EINVAL;
> -
>   	*out_hwirq = (ciu << 6) | bit;
>   	*out_type = 0;
>   
> @@ -1570,8 +1566,14 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,
>   	if (!octeon_irq_virq_in_range(virq))
>   		return -EINVAL;
>   
> -	/* Line 7  are the GPIO lines */
> -	if (line > 6 || octeon_irq_ciu_to_irq[line][bit] != 0)
> +	/*
> +	 * Don't map irq if it is reserved for GPIO.
> +	 * (Line 7 are the GPIO lines.)
> +	 */
> +	if (line == 7)
> +		return 0;
> +
> +	if (line > 7 || octeon_irq_ciu_to_irq[line][bit] != 0)
>   		return -EINVAL;
>   
>   	if (octeon_irq_ciu2_is_edge(line, bit))

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] MIPS: octeon: Fix warning in of_device_alloc on cn3xxx
@ 2014-03-20  0:53           ` Yang,Wei
  0 siblings, 0 replies; 15+ messages in thread
From: Yang,Wei @ 2014-03-20  0:53 UTC (permalink / raw)
  To: Andreas Herrmann, David Daney, ralf; +Cc: linux-mips, Ashfield, Bruce

On 03/20/2014 06:03 AM, Andreas Herrmann wrote:
> Starting with commit 3da5278727a895d49a601f67fd49dffa0b80f9a5 (of/irq:
> Rework of_irq_count()) the following warning is triggered on octeon
> cn3xxx:
>
> [    0.887281] WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171 of_device_alloc+0x228/0x230()
> [    0.895642] Modules linked in:
> [    0.898689] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0-rc7-00012-g9ae51f2-dirty #41
> [    0.906860] Stack : c8b439581166d96e ffffffff816b0000 0000000040808000 ffffffff81185ddc
> [    0.906860] 	  0000000000000000 0000000000000000 0000000000000000 000000000000000b
> [    0.906860] 	  000000000000000a 000000000000000a 0000000000000000 0000000000000000
> [    0.906860] 	  ffffffff81740000 ffffffff81720000 ffffffff81615900 ffffffff816b0177
> [    0.906860] 	  ffffffff81727d10 800000041f868fb0 0000000000000001 0000000000000000
> [    0.906860] 	  0000000000000000 0000000000000038 0000000000000001 ffffffff81568484
> [    0.906860] 	  800000041f86faa8 ffffffff81145ddc 0000000000000000 ffffffff811873f4
> [    0.906860] 	  800000041f868b88 800000041f86f9c0 0000000000000000 ffffffff81569c9c
> [    0.906860] 	  0000000000000000 0000000000000000 0000000000000000 0000000000000000
> [    0.906860] 	  0000000000000000 ffffffff811205e0 0000000000000000 0000000000000000
> [    0.906860] 	  ...
> [    0.971695] Call Trace:
> [    0.974139] [<ffffffff811205e0>] show_stack+0x68/0x80
> [    0.979183] [<ffffffff81569c9c>] dump_stack+0x8c/0xe0
> [    0.984196] [<ffffffff81145efc>] warn_slowpath_common+0x84/0xb8
> [    0.990110] [<ffffffff81436888>] of_device_alloc+0x228/0x230
> [    0.995726] [<ffffffff814368d8>] of_platform_device_create_pdata+0x48/0xd0
> [    1.002593] [<ffffffff81436a94>] of_platform_bus_create+0x134/0x1e8
> [    1.008837] [<ffffffff81436af8>] of_platform_bus_create+0x198/0x1e8
> [    1.015064] [<ffffffff81436cc4>] of_platform_bus_probe+0xa4/0x100
> [    1.021149] [<ffffffff81100570>] do_one_initcall+0xd8/0x128
> [    1.026701] [<ffffffff816e2a10>] kernel_init_freeable+0x144/0x210
> [    1.032753] [<ffffffff81564bc4>] kernel_init+0x14/0x110
> [    1.037973] [<ffffffff8111bb44>] ret_from_kernel_thread+0x14/0x1c
>
> With this commit the kernel starts mapping the interrupts listed for
> gpio-controller node. irq_domain_ops for CIU (octeon_irq_ciu_map and
> octeon_irq_ciu_xlat) refuse to handle the GPIO lines (returning -EINVAL)
> and this is causing above warning in of_device_alloc().
>
> Modify irq_domain_ops for CIU and CIU2 to "gracefully handle" GPIO
> lines (neither return error code nor call octeon_irq_set_ciu_mapping
> for it). This should avoid the warning.
>
> (As before the real setup for GPIO lines will happen using
> irq_domain_ops of gpio-controller.)
>
> This patch is based on Wei's patch v2 (see
> http://marc.info/?l=linux-mips&m=139511814813247).
>
> Reported-by: Yang Wei <wei.yang@windriver.com>
> Cc: David Daney <david.daney@caviumnetworks.com>
> Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>

Okay, Thank you Andreas and David for this review.


Thanks
Wei
> ---
>   arch/mips/cavium-octeon/octeon-irq.c |   22 ++++++++++++----------
>   1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
> index 25fbfae..c2bb4f8 100644
> --- a/arch/mips/cavium-octeon/octeon-irq.c
> +++ b/arch/mips/cavium-octeon/octeon-irq.c
> @@ -975,10 +975,6 @@ static int octeon_irq_ciu_xlat(struct irq_domain *d,
>   	if (ciu > 1 || bit > 63)
>   		return -EINVAL;
>   
> -	/* These are the GPIO lines */
> -	if (ciu == 0 && bit >= 16 && bit < 32)
> -		return -EINVAL;
> -
>   	*out_hwirq = (ciu << 6) | bit;
>   	*out_type = 0;
>   
> @@ -1007,6 +1003,10 @@ static int octeon_irq_ciu_map(struct irq_domain *d,
>   	if (!octeon_irq_virq_in_range(virq))
>   		return -EINVAL;
>   
> +	/* Don't map irq if it is reserved for GPIO. */
> +	if (line == 0 && bit >= 16 && bit <32)
> +		return 0;
> +
>   	if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0)
>   		return -EINVAL;
>   
> @@ -1525,10 +1525,6 @@ static int octeon_irq_ciu2_xlat(struct irq_domain *d,
>   	ciu = intspec[0];
>   	bit = intspec[1];
>   
> -	/* Line 7  are the GPIO lines */
> -	if (ciu > 6 || bit > 63)
> -		return -EINVAL;
> -
>   	*out_hwirq = (ciu << 6) | bit;
>   	*out_type = 0;
>   
> @@ -1570,8 +1566,14 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,
>   	if (!octeon_irq_virq_in_range(virq))
>   		return -EINVAL;
>   
> -	/* Line 7  are the GPIO lines */
> -	if (line > 6 || octeon_irq_ciu_to_irq[line][bit] != 0)
> +	/*
> +	 * Don't map irq if it is reserved for GPIO.
> +	 * (Line 7 are the GPIO lines.)
> +	 */
> +	if (line == 7)
> +		return 0;
> +
> +	if (line > 7 || octeon_irq_ciu_to_irq[line][bit] != 0)
>   		return -EINVAL;
>   
>   	if (octeon_irq_ciu2_is_edge(line, bit))

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-03-20  0:54 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-18  4:48 [PATCH V2] mips/octeon_3xxx: Fix a warning on octeon_3xxx Wei.Yang
2014-03-18  4:48 ` Wei.Yang
2014-03-19  9:51 ` Yang,Wei
2014-03-19  9:51   ` Yang,Wei
2014-03-19 16:20   ` Andreas Herrmann
2014-03-19 16:20     ` Andreas Herrmann
2014-03-19 18:34     ` David Daney
2014-03-19 18:34       ` David Daney
2014-03-19 22:03       ` [PATCH] MIPS: octeon: Fix warning in of_device_alloc on cn3xxx Andreas Herrmann
2014-03-19 22:03         ` Andreas Herrmann
2014-03-19 22:12         ` David Daney
2014-03-19 22:12           ` David Daney
2014-03-19 23:11         ` Aaro Koskinen
2014-03-20  0:53         ` Yang,Wei
2014-03-20  0:53           ` Yang,Wei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.