-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Kernel module cannot request interrupt 79 after kernel update from 4.9 to 4.14 #2590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That is not how you are supposed to use interrupts in Linux, for two reasons:
|
Thanks for the quick reply. I see your point, but the UIO-framework requires an interrupt number to be passed. Moreover, I am wondering what happened to IRQs 79 and 80 in |
Without diving into the kernel source code: Those IRQs are claimed by the gpio driver and only used to generate GPIO-specific "chained" IRQs. I would imagine that interrupts which are used in that way are omitted from the /proc/interrupts list - possibly to avoid double counting. |
Meanwhile, I was able to analyze the issue a bit further and I would like to tell you the insights I have gained from that. The GPIO bank interrupts are managed by the module With commit 85ae9e512f437cd09bf61564bdba29ab88bab3e3, which is part of the Raspbian kernel 4.14, the GPIO bank interrupt handling changed. As pelwell said, the interrupts are now chained irqchips, which are allocated using This behavior is also described in the documentation
and moreover:
The documentation also cites an example for that on the LKML, where the chained interrupt handlers are reverted to generic ones again with the following benefit (amongst others):
But the more important benefit in my opinion is the fact that generic handlers can be shared and thus be requested by other kernel modules for example as in my UIO-based case. Without such a patch for the |
Are your uses of UIO drivers limited to GPIOs 0-27? If so, it should be possible to use an overlay to overwrite the interrupt declaration for GPIO bank, preventing it from being claimed., without interfering with the other, system uses of GPIO interrupts. |
Yes, they are limited to this range. I only need a couple of them, but a common handler. How does the overlay concept work? Would be great if this works out... |
An overlay is just a set of patches that can be applied to a Device Tree. We need to do find a modification to the Device Tree that will cause the GPIO driver to not claim the interrupt for bank 0. The device node for the GPIO driver declares is interrupt usage using a standard
I think we should be able to overwrite that first interrupt with something invalid to cause it to be skipped without affecting GPIO bank 1. |
I'm sorry it's taken so long to get back to this. Here is a new overlay - gpio-no-bank0-irq - that stops the GPIO driver claiming IRQ79 in a way that should allow your module to claim it. Copy it into /boot/overlays, add Let me know how you get on, and if it works I'll make it part of the standard image. |
Many thanks for the overlay. I tested it on a PI 2B with the 4.14.52 kernel.
|
That is an unavoidable(?) warning that one of the interrupt specifiers is invalid, but that is what we want and should be no cause for concern. Did you actually try to use the system? |
No, I had not tried to use the system with your overlay being active at the time of my last post because I did not expect it to work with the given error message during bootup. Meanwhile, I tested the kernel module on my PI 3 with your overlay on the latest 4.14.52 kernel (where it shows up the same error message). I am more than glad to report that everything works as predicted by you: the Of course, I would appreciate it if you could make the overlay part of the standard image. |
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
This patch slipped down the cracks but it's in the 4.14 tree now, so the overlay will eventually become part of the standard images. |
See: raspberrypi/linux#2590 Signed-off-by: Phil Elwell <[email protected]> Signed-off-by: ahmedradaideh <[email protected]>
See: raspberrypi#2590 Signed-off-by: Phil Elwell <[email protected]>
See: raspberrypi#2590 Signed-off-by: Phil Elwell <[email protected]>
See: raspberrypi#2590 Signed-off-by: Phil Elwell <[email protected]>
See: raspberrypi#2590 Signed-off-by: Phil Elwell <[email protected]>
See: raspberrypi#2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: raspberrypi/linux#2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: raspberrypi/linux#2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: raspberrypi/linux#2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: raspberrypi#2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
See: #2590 Signed-off-by: Phil Elwell <[email protected]>
After a kernel upgrade from 4.9 to 4.14 via
apt-get upgrade
on a Raspberry Pi 3, loading my uio-based kernel module fails withuio_register_device()
returning-EINVAL
. The kernel module tries to request IRQ 79 for the edge detection of all GPIOs on bank 0. The otheruio_info
structure fieldsname
andversion
are also populated, andirq_flags
is set toIRQF_SHARED
.A more detailed analysis shows that
uio_register_device()
fails becauserequest_irq()
returns-EINVAL
as the outcome ofrequest_threaded_irq()
, which in turns fails, becauseirq_settings_can_request(desc)
returnsfalse
due todesc->status_use_accessors
having the_IRQ_NOREQUEST
bit set.This seems to indicate that IRQ 79 (for
gpio_int[0]
, used to be 49 as in the BCM2835 ARM Peripherals document) cannot be requested any longer with kernel 4.14.An observation that might be related to this is that the 4.14 content of
/proc/interrupts
does not have the two lines79: 0 0 0 0 ARMCTRL-level 81 Edge 3f200000.gpio:bank0
80: 0 0 0 0 ARMCTRL-level 82 Edge 3f200000.gpio:bank1
whereas the 4.9 kernel does have them.
The text was updated successfully, but these errors were encountered: