AnsweredAssumed Answered

[i.MX7] IRQ affinity setting for GPIO interrupts

Question asked by PINTU KUMAR on May 16, 2018
Latest reply on Jun 19, 2018 by Carlos_Musich


I wanted to set IRQ affinity to some CPU for a particular GPIO interrupt.

Please let me know how can I do it.

I wanted to do it from my own kernel module.

First I tried to do it from sysfs, but it did not work.

I tried to use FUNC2 (GPIO138) for generating an interrupt.

# echo 138 > /sys/class/gpio/export

# echo "rising" > /sys/class/gpio/gpio138/edge

# root# cat /proc/interrupts | grep gpio
162: 0 0 gpio-mxc 0 Edge 30b40000.usdhc cd
172: 5 0 gpio-mxc 10 Edge usr_button_irq_handler


Thus GPIO 138 is mapped to IRQ 172

Now if I try to set affinity for 172, I get the error:

# root# echo 2 > /proc/irq/172/smp_affinity
-bash: echo: write error: Input/output error


I tried this from both user space and kernel module, but its not working.

I also tried using "irq_set_affinity_hint(irq, cpumask) from kernel driver, but this also failed.


Recently I discovered that it is not possible to set IRQ affinity to GPIO interrupt because it is not tied to a particular GIC line.

Thus GPIO bank affinity needs to be changed.


So, I know that GPIO interrupt affinity cannot be changed for a particular GPIO.


But, still I am looking for a work around or hack in kernel by which this can be still possible.

This is required only for some debug purpose.

If you have ideas please share.

Also please share some hardware document about how GPIO banks are connected on i.MX7.

And how GPIO interrupts are processed and the relation with GIC.



- How to change affinity for one of the GPIO Bank?

- Is it possible to disable CPU0 from my driver (for some time), until interrupt is served on another CPU?

- Is it possible to make CPU0 busy so that CPU1 can handle the GPIO interrupt?