Skip to contentSkip to conversation

powerpc/xics: Set the IRQ chip data for the ICS native backend

PATCH Applied Cédric Le Goater 4 participants 5 messages Sep 13, 2021 – Sep 19, 2021 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/xics: Set the IRQ chip data for the ICS native backend

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")
---
 arch/powerpc/sysdev/xics/xics-common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/sysdev/xics/xics-common.c +2 -2
index 5c1a157a83b8..244a727c6ba4 100644
@@ -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;
 }
Signature · 1 line
2.31.1
Tested-by on v1 1/1
#1 lore raw

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.

Cheers,
Gustavo

Reviewed-by on v1 1/1
#2 lore raw
In reply to Cédric Le Goater
Quoted 8 lines · 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")

Thanks Cédric.

Quoted 23 lines
---
 arch/powerpc/sysdev/xics/xics-common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/sysdev/xics/xics-common.c +2 -3
index 5c1a157a83b8..244a727c6ba4 100644
@@ -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

Tested-by on v1 1/1
#3 lore raw
In reply to Cédric Le Goater

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.

Cheers,
Gustavo

#4 lore raw
In reply to Cédric Le Goater
Quoted 8 lines · 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.

[...]

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