gpio/davinci: fix oops on unbanked gpio irq request
Grant Likely
AppliedQuoted 4 lines · Sekhar Nori
Unbanked GPIO irq setup code was overwriting
chip_dataleading to the following oops onrequest_irq()Unable to handle kernel paging request at virtual address febfffff
[...]
Quoted 1 line
Fix the issue.
Applied, but for next time "Fix the issue" isn't the most helpful commit text. Please describe *how* you fixed the issue so that future commit readers have more clues as to what this patch is doing.
g.
Grant Likely
AppliedRe: [PATCH 2/2] gpio/davinci: fix enabling unbanked GPIO IRQs
In reply to a message not in the archiveQuoted 7 lines · Sekhar Nori
Unbanked GPIO IRQ handling code made a copy of just the
irq_chipstructure for GPIO IRQ lines which caused problems after the generic IRQ chip conversion because there was no validirq_chip_typestructure with the right "regs" populated.irq_gc_mask_set_bit()was therefore accessing random addresses.
Quoted 7 lines
Fix it by making a copy of
irq_chip_typestructure instead. This will ensure sane register offsets.Cc <[email protected]> # v3.0.x+Reported-by Jon Povey <[email protected]>Tested-by Jon Povey <[email protected]>Signed-off-by Sekhar Nori <[email protected]>
Applied, thx.
g.
Quoted 43 lines
--- drivers/gpio/gpio-davinci.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-)drivers/gpio/gpio-davinci.c +6
-5@@ -386,7 +386,7 @@ static int __init davinci_gpio_irq_setup(void)* IRQ mux conflicts; gpio_irq_type_unbanked() is only for GPIOs. */ if (soc_info->gpio_unbanked) { -static struct irq_chip gpio_irqchip_unbanked; +static struct irq_chip_type gpio_unbanked;/* pass "bank 0" GPIO IRQs to AINTC */ chips[0 ].chip.to_irq = gpio_to_irq_unbanked;@@ -394,9 +394,10 @@ static int __init davinci_gpio_irq_setup(void)/* AINTC handles mask/unmask; GPIO handles triggering */ irq = bank_irq; - gpio_irqchip_unbanked = *irq_get_chip (irq); - gpio_irqchip_unbanked.name ="GPIO-AINTC" ; - gpio_irqchip_unbanked.irq_set_type = gpio_irq_type_unbanked; + gpio_unbanked = *container_of (irq_get_chip (irq), + struct irq_chip_type, chip); + gpio_unbanked.chip.name ="GPIO-AINTC" ; + gpio_unbanked.chip.irq_set_type = gpio_irq_type_unbanked;/* default trigger: both edges */ g =gpio2regs (0 );@@ -405,7 +406,7 @@ static int __init davinci_gpio_irq_setup(void)/* set the direct IRQs up to use that irqchip */ for (gpio =0 ; gpio < soc_info->gpio_unbanked; gpio++, irq++) { -irq_set_chip (irq, &gpio_irqchip_unbanked); +irq_set_chip (irq, &gpio_unbanked.chip);irq_set_handler_data (irq, &chips[gpio /32 ]);irq_set_status_flags (irq,IRQ_TYPE_EDGE_BOTH ); }Signature · 1 line
1.7.0.4
Signature · 2 lines
Grant Likely, B.Sc, P.Eng. Secret Lab Technologies,Ltd.
Hi Grant,
Quoted 11 lines · Grant Likely
Quoted 4 lines · Sekhar Nori
Unbanked GPIO irq setup code was overwriting
chip_dataleading to the following oops onrequest_irq()Unable to handle kernel paging request at virtual address febfffff[...]
Quoted 1 line
Fix the issue.
Applied, but for next time "Fix the issue" isn't the most helpful commit text. Please describe *how* you fixed the issue so that future commit readers have more clues as to what this patch is doing.
Thanks for the feedback and noted for future. If it's not too much trouble, can you change the last line in commit message to:
Fix the issue by making unbanked GPIO code not overwrite chip_data because generic irq chip code uses it for its data structures. Instead use handler_data to pass around GPIO controller information.
Regards,
Sekhar
Quoted 15 lines · Sekhar
Hi Grant,
Quoted 11 lines · Grant Likely
Quoted 4 lines · Sekhar Nori
Unbanked GPIO irq setup code was overwriting
chip_dataleading to the following oops onrequest_irq()Unable to handle kernel paging request at virtual address febfffff[...]
Quoted 1 line
Fix the issue.
Applied, but for next time "Fix the issue" isn't the most helpful commit text. Please describe *how* you fixed the issue so that future commit readers have more clues as to what this patch is doing.
Quoted 6 lines
Thanks for the feedback and noted for future. If it's not too much trouble, can you change the last line in commit message to:
Fix the issue by making unbanked GPIO code not overwrite
chip_databecause generic irq chip code uses it for its data structures. Instead usehandler_datato pass around GPIO controller information.
I've already pushed it out, so I cannot rebase it, but thanks for taking me seriously. :-D
g.