Project

General

Profile

FPGA PIO interrupt issues with Rocko and kernel 4.9

Added by V J over 5 years ago

Hi
After upgrading to Rocko and kernel 4.9 (RT) my pio interrupt routine is no longer working. My previous setup was Krogoth with kernel 4.1.22 where my pio interrupts were working fine.
When receiving an FPGA PIO interrupt now I get (from dmesg):

[   69.408679] irq 78, desc: ee6e5200, depth: 0, count: 0, unhandled: 0
[   69.408707] ->handle_irq():  c0172188,
[   69.408708] handle_bad_irq+0x0/0x2a4
[   69.408724] ->irq_data.chip(): c0b4ae6c,
[   69.408726] 0xc0b4ae6c
[   69.408731] ->action(): ee6163c0
[   69.408754] ->action->handler(): c01728c4,
[   69.408755] irq_default_primary_handler+0x0/0x1
[   69.408762]    IRQ_NOPROBE set
[   69.408769] unexpected IRQ trap at vector 4e
[   69.410301] irq 78, desc: ee6e5200, depth: 0, count: 0, unhandled: 0
...


And from 'cat /proc/interrupts' (truncated):
           CPU0       CPU1
 78:        128          0  altera-gpio   0 Edge      fpga_uinput0
Err:        128

My dts settings for the PIO (truncated):

        hps_lw_bus: bus@0ff200000 {
            compatible = "simple-bus";
            reg = <0xFF200000 0x00200000>;
            #address-cells = <1>;
            #size-cells = <1>;
            ranges = <0x0 0xFF200000 0x00200000>;

            status = "okay";

            sysid_qsys: sysid@000000 {
                compatible = "altr,sysid-1.0";
                reg = <0x000000 0x08>;
            };

            pio_fpga_irq0: gpio@00a0 {
                compatible = "altr,pio-1.0";
                reg = <0x00a0 0x10>;
                interrupts = <0 40 4>;
                altr,ngpio = <32>;
                altr,interrupt-type = <IRQ_TYPE_EDGE_RISING>;
                #gpio-cells = <2>;
                gpio-controller;
                #interrupt-cells = <1>;
                interrupt-controller;
            };         
      };

Other FPGA PIOs without interrupt are working fine.

Are you aware of any changes (or bugs) in kernel 4.9 compared to earlier versions which affects the PIO interrupts?

BR
VJ


Replies (4)

RE: FPGA PIO interrupt issues with Rocko and kernel 4.9 - Added by Daniel Vincelette over 5 years ago

Hello,

We aren't aware of any changes or issues with the PIO interrupts. We haven't been able to recreate the issue that you are seeing here. Could you post your boot log and the section of code that you are using to initialize the gpios in your application?

Thank you,
Dan

RE: FPGA PIO interrupt issues with Rocko and kernel 4.9 - Added by V J over 5 years ago

Hi Dan, thanks for your reply.

I did a quick test where I replaced the 4.9 (RT) zImage with 4.1.22(RT) on my rocko SD card, and then my PIO interrupts worked as expected.

When using the kernel from the rocko branch (ref https://support.criticallink.com/redmine/boards/45/topics/4963?r=5814#message-5814) there were some issues with missing files in the kernel source when building my kernel modules:

...
././include/linux/kconfig.h:4:32: fatal error: generated/autoconf.h: No such file or directory
 #include <generated/autoconf.h>
...

so I am using a rebuilt version of the 4.9(RT) kernel (from git://github.com/altera-opensource/linux-socfpga).

I have attached my 4.9(RT) boot log and my irq kernel module.

BR
VJ

RE: FPGA PIO interrupt issues with Rocko and kernel 4.9 - Added by Wesley Dahar over 5 years ago

Thanks for the log and module code.

We'd like to build this module in an attempt to recreate the issue, but the declaration of const struct driver_attribute *driver_attr_fpga_uinput is not contained in the module code. Could you provide the necessary files? The FPGA project shouldn't be necessary.

One point of interest is the call to request_irq(). Looking at gpio_sysfs_request_irq(), it shows a call to request_any_context_irq() which in turn calls request_irq(). This is one thing to look for since the Linux uses a new generic IRQ system. I'm still looking into the reasoning behind these changes.

Consider using:

ret = request_any_context_irq(irq_number, fpga_uinput_interrupt, 0, "fpga_uinput0", NULL);
if (ret < 0)
  goto fail_request_irq;

irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);

in place of:

ret = request_irq(irq_number, fpga_uinput_interrupt, 0, "fpga_uinput0", NULL);
if (ret < 0)
  goto fail_request_irq;

Wesley Dahar

RE: FPGA PIO interrupt issues with Rocko and kernel 4.9 - Added by V J over 5 years ago

Hi Wesley
Thank you for the proposed code change, that did the trick!
I think static DRIVER_ATTR(fpga_uinput, S_IRUSR, fpga_uinput_show, fpga_uinput_store) creates the driver_attr_fpga_uinput variable.
BR
VJ

    (1-4/4)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)