All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/xics: Set the IRQ chip data for the ICS native backend
@ 2021-09-13 13:40 Cédric Le Goater
  2021-09-13 17:25 ` Gustavo Romero
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Cédric Le Goater @ 2021-09-13 13:40 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Cédric Le Goater

The ICS native driver relies on the IRQ chip data to find the struct
'ics_native' describing the ICS controller but it was removed by commit
248af248a8f4 ("powerpc/xics: Rename the map handler in a check handler").
Revert this change to fix the Microwatt SoC platform.

Fixes: 248af248a8f4 ("powerpc/xics: Rename the map handler in a check handler")
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 arch/powerpc/sysdev/xics/xics-common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c
index 5c1a157a83b8..244a727c6ba4 100644
--- a/arch/powerpc/sysdev/xics/xics-common.c
+++ b/arch/powerpc/sysdev/xics/xics-common.c
@@ -348,9 +348,9 @@ static int xics_host_map(struct irq_domain *domain, unsigned int virq,
 	if (xics_ics->check(xics_ics, hwirq))
 		return -EINVAL;
 
-	/* No chip data for the XICS domain */
+	/* Let the ICS be the chip data for the XICS domain. For ICS native */
 	irq_domain_set_info(domain, virq, hwirq, xics_ics->chip,
-			    NULL, handle_fasteoi_irq, NULL, NULL);
+			    xics_ics, handle_fasteoi_irq, NULL, NULL);
 
 	return 0;
 }
-- 
2.31.1


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

* Re: [PATCH] powerpc/xics: Set the IRQ chip data for the ICS native backend
  2021-09-13 13:40 [PATCH] powerpc/xics: Set the IRQ chip data for the ICS native backend Cédric Le Goater
@ 2021-09-13 17:25 ` Gustavo Romero
  2021-09-13 17:54 ` Gustavo Romero
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Gustavo Romero @ 2021-09-13 17:25 UTC (permalink / raw)
  To: linuxppc-dev, clg; +Cc: mikey, joel

Hi,

I confirm that if this fix is *not* applied to current Linus
tree (c605c39677b9) and kernel boots on Microwatt (18eb029) the
kernel will crash with the following exception:

<snip>

[    1.846437] BUG: Kernel NULL pointer dereference on read at 0x00000048
[    1.853121] Faulting instruction address: 0xc00000000003146c
Vector: 300 (Data Access) at [c0000000010332c0]
     pc: c00000000003146c: ics_native_unmask_irq+0x10/0x60
     lr: c0000000000314d4: ics_native_startup+0x18/0x2c
     sp: c000000001033560
    msr: 9000000000009033
    dar: 48
  dsisr: 40000000
   current = 0xc000000001050000
   paca    = 0xc00000000068c000   irqmask: 0x03   irq_happened: 0x01
     pid   = 1, comm = swapper
Linux version 5.14.0-11101-gc605c39677b9 (gromero@amd) (powerpc64-linux-gnu-gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0, GNU ld (GNU Binutils for Ubuntu) 2.36.1) #5 Sat Sep 11 22:01
enter ? for help
[link register   ] c0000000000314d4 ics_native_startup+0x18/0x2c
[c000000001033560] 0000000000003000 (unreliable)
[c000000001033580] c000000000074c00 irq_startup+0x8c/0xd4
[c0000000010335c0] c000000000072434 __setup_irq+0x534/0x6c4
[c000000001033660] c0000000000728ac request_threaded_irq+0x130/0x154
[c0000000010336d0] c000000000217478 univ8250_setup_irq+0x1b0/0x20c
[c000000001033720] c00000000021af2c serial8250_do_startup+0x428/0x654
[c0000000010337b0] c00000000021475c uart_startup+0xd0/0x1a0
[c000000001033800] c00000000021487c uart_port_activate+0x50/0x74
[c000000001033830] c00000000020fc98 tty_port_open+0xa4/0x110
[c000000001033880] c000000000212810 uart_open+0x24/0x4c
[c0000000010338a0] c000000000208b04 tty_open+0x2d4/0x394
[c000000001033920] c0000000000e38a8 chrdev_open+0xd4/0x15c
[c000000001033980] c0000000000dc080 do_dentry_open+0x24c/0x2d0
[c0000000010339d0] c0000000000edd60 path_openat+0x8fc/0xa2c
[c000000001033ab0] c0000000000edee8 do_filp_open+0x58/0xbc
[c000000001033be0] c0000000000dd530 file_open_name+0x54/0x7c
[c000000001033c50] c0000000000dd5a0 filp_open+0x48/0x68
[c000000001033c90] c00000000048e1d4 console_on_rootfs+0x2c/0x88
[c000000001033d00] c00000000048e424 kernel_init_freeable+0x1f4/0x238
[c000000001033db0] c00000000000e51c kernel_init+0x28/0x138
[c000000001033e10] c00000000000b114 ret_from_kernel_thread+0x5c/0x64
mon>


Thanks for fixing it Cédric.

Tested-by: Gustavo Romero <gustavo.romero@linaro.org>


Cheers,
Gustavo

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

* Re: [PATCH] powerpc/xics: Set the IRQ chip data for the ICS native backend
  2021-09-13 13:40 [PATCH] powerpc/xics: Set the IRQ chip data for the ICS native backend Cédric Le Goater
  2021-09-13 17:25 ` Gustavo Romero
@ 2021-09-13 17:54 ` Gustavo Romero
  2021-09-13 23:21 ` Joel Stanley
  2021-09-19 12:20 ` Michael Ellerman
  3 siblings, 0 replies; 5+ messages in thread
From: Gustavo Romero @ 2021-09-13 17:54 UTC (permalink / raw)
  To: linuxppc-dev, clg; +Cc: mikey, joel

Hi,

I confirm that if this fix is *not* applied to current Linus
tree (c605c39677b9) and kernel boots on Microwatt (18eb029) the
kernel will crash with the following exception:

<snip>

[    1.846437] BUG: Kernel NULL pointer dereference on read at 0x00000048
[    1.853121] Faulting instruction address: 0xc00000000003146c
Vector: 300 (Data Access) at [c0000000010332c0]
     pc: c00000000003146c: ics_native_unmask_irq+0x10/0x60
     lr: c0000000000314d4: ics_native_startup+0x18/0x2c
     sp: c000000001033560
    msr: 9000000000009033
    dar: 48
  dsisr: 40000000
   current = 0xc000000001050000
   paca    = 0xc00000000068c000   irqmask: 0x03   irq_happened: 0x01
     pid   = 1, comm = swapper
Linux version 5.14.0-11101-gc605c39677b9 (gromero@amd) (powerpc64-linux-gnu-gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0, GNU ld (GNU Binutils for Ubuntu) 2.36.1) #5 Sat Sep 11 22:01
enter ? for help
[link register   ] c0000000000314d4 ics_native_startup+0x18/0x2c
[c000000001033560] 0000000000003000 (unreliable)
[c000000001033580] c000000000074c00 irq_startup+0x8c/0xd4
[c0000000010335c0] c000000000072434 __setup_irq+0x534/0x6c4
[c000000001033660] c0000000000728ac request_threaded_irq+0x130/0x154
[c0000000010336d0] c000000000217478 univ8250_setup_irq+0x1b0/0x20c
[c000000001033720] c00000000021af2c serial8250_do_startup+0x428/0x654
[c0000000010337b0] c00000000021475c uart_startup+0xd0/0x1a0
[c000000001033800] c00000000021487c uart_port_activate+0x50/0x74
[c000000001033830] c00000000020fc98 tty_port_open+0xa4/0x110
[c000000001033880] c000000000212810 uart_open+0x24/0x4c
[c0000000010338a0] c000000000208b04 tty_open+0x2d4/0x394
[c000000001033920] c0000000000e38a8 chrdev_open+0xd4/0x15c
[c000000001033980] c0000000000dc080 do_dentry_open+0x24c/0x2d0
[c0000000010339d0] c0000000000edd60 path_openat+0x8fc/0xa2c
[c000000001033ab0] c0000000000edee8 do_filp_open+0x58/0xbc
[c000000001033be0] c0000000000dd530 file_open_name+0x54/0x7c
[c000000001033c50] c0000000000dd5a0 filp_open+0x48/0x68
[c000000001033c90] c00000000048e1d4 console_on_rootfs+0x2c/0x88
[c000000001033d00] c00000000048e424 kernel_init_freeable+0x1f4/0x238
[c000000001033db0] c00000000000e51c kernel_init+0x28/0x138
[c000000001033e10] c00000000000b114 ret_from_kernel_thread+0x5c/0x64
mon>


Thanks for fixing it Cédric.

Tested-by: Gustavo Romero <gustavo.romero@linaro.org>


Cheers,
Gustavo

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

* Re: [PATCH] powerpc/xics: Set the IRQ chip data for the ICS native backend
  2021-09-13 13:40 [PATCH] powerpc/xics: Set the IRQ chip data for the ICS native backend Cédric Le Goater
  2021-09-13 17:25 ` Gustavo Romero
  2021-09-13 17:54 ` Gustavo Romero
@ 2021-09-13 23:21 ` Joel Stanley
  2021-09-19 12:20 ` Michael Ellerman
  3 siblings, 0 replies; 5+ messages in thread
From: Joel Stanley @ 2021-09-13 23:21 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: linuxppc-dev

On Mon, 13 Sept 2021 at 13:48, Cédric Le Goater <clg@kaod.org> wrote:
>
> The ICS native driver relies on the IRQ chip data to find the struct
> 'ics_native' describing the ICS controller but it was removed by commit
> 248af248a8f4 ("powerpc/xics: Rename the map handler in a check handler").
> Revert this change to fix the Microwatt SoC platform.
>
> Fixes: 248af248a8f4 ("powerpc/xics: Rename the map handler in a check handler")
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Reviewed-by: Joel Stanley <joel@jms.id.au>

Thanks Cédric.

> ---
>  arch/powerpc/sysdev/xics/xics-common.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c
> index 5c1a157a83b8..244a727c6ba4 100644
> --- a/arch/powerpc/sysdev/xics/xics-common.c
> +++ b/arch/powerpc/sysdev/xics/xics-common.c
> @@ -348,9 +348,9 @@ static int xics_host_map(struct irq_domain *domain, unsigned int virq,
>         if (xics_ics->check(xics_ics, hwirq))
>                 return -EINVAL;
>
> -       /* No chip data for the XICS domain */
> +       /* Let the ICS be the chip data for the XICS domain. For ICS native */
>         irq_domain_set_info(domain, virq, hwirq, xics_ics->chip,
> -                           NULL, handle_fasteoi_irq, NULL, NULL);
> +                           xics_ics, handle_fasteoi_irq, NULL, NULL);
>
>         return 0;
>  }
> --
> 2.31.1
>

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

* Re: [PATCH] powerpc/xics: Set the IRQ chip data for the ICS native backend
  2021-09-13 13:40 [PATCH] powerpc/xics: Set the IRQ chip data for the ICS native backend Cédric Le Goater
                   ` (2 preceding siblings ...)
  2021-09-13 23:21 ` Joel Stanley
@ 2021-09-19 12:20 ` Michael Ellerman
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2021-09-19 12:20 UTC (permalink / raw)
  To: linuxppc-dev, Cédric Le Goater

On Mon, 13 Sep 2021 15:40:56 +0200, Cédric Le Goater wrote:
> The ICS native driver relies on the IRQ chip data to find the struct
> 'ics_native' describing the ICS controller but it was removed by commit
> 248af248a8f4 ("powerpc/xics: Rename the map handler in a check handler").
> Revert this change to fix the Microwatt SoC platform.
> 
> 
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc/xics: Set the IRQ chip data for the ICS native backend
      https://git.kernel.org/powerpc/c/c006a06508db4841d256d82f42da392d6391f3d9

cheers

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

end of thread, other threads:[~2021-09-19 12:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 13:40 [PATCH] powerpc/xics: Set the IRQ chip data for the ICS native backend Cédric Le Goater
2021-09-13 17:25 ` Gustavo Romero
2021-09-13 17:54 ` Gustavo Romero
2021-09-13 23:21 ` Joel Stanley
2021-09-19 12:20 ` Michael Ellerman

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.