All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Harco Kuppens <h.kuppens@cs.ru.nl>, xenomai@xenomai.org
Subject: Re: [Xenomai] problem gpio interrupts xenomai3 on the raspberry pi 2 (or 3)
Date: Tue, 30 May 2017 19:30:58 +0200	[thread overview]
Message-ID: <cb912c40-1247-6395-9a84-a3203dd5f022@xenomai.org> (raw)
In-Reply-To: <46850988-a862-b747-f11d-1191f7e13458@cs.ru.nl>

On 05/30/2017 06:38 PM, Harco Kuppens wrote:
> So I decided to also  test these wiringpi test programs on mine build
> xenomai 3 image for the rpi2. Unfortunately the isr.c wiringpi program
> didn't work anymore on mine build image. So even without using xenomai3,
> but just using linux the pi2 just hangs and a hard reset was needed.
> 
> Thus I guess there is still something wrong with mine image?
> Does anybody know what I'm doing wrong?
> Or is this still a bug in the gpio library or in the patches applied?
> 

It looks obvious that you tried hard and got your feet wet with Xenomai
already, so let's go straight to the point: the lockup issue when using
GPIO interrupts is most likely due to the I-pipe patch not properly
adapting the GPIO chip driver for dealing with IRQ virtualization.

In short, each IRQ controller which may be active on a SoC must be
driven by I-pipe aware code. For instance, the bcm2835 family has common
GPIOs controlled by the driver at drivers/pinctrl/pinctrl-bcm2835.c. If
that driver has not been patched specifically for supporting the IRQ
pipeline, then this won't work with Xenomai, and may well end up with
painful IRQ storms causing a machine hang. The same goes for any other
chip serving as an IRQ controller you might need on your platform.

So, first and foremost, I would recommend to make sure the I-pipe code
is right for your kernel, then build on top of that. A good way to
figure out which IRQ controllers are active is look at the output of
/proc/interrupts on a kernel that disables the interrupt pipeline.
Each IRQ information mentions the label of the controller which deals
with it. With that information, you need to cross-check whether the
corresponding IRQ chip driver (the one that bears this label in the
irq_chip descriptor structure) was made I-pipe aware.

Some time ago, I ported Xenomai 3 to the PI Zero (kernel 4.1.18), which
is based on the bcm2835 SoC like the PI 1 series. That code is available
from the vendors/raspberry/ipipe-4.1 branch at
git://git.xenomai.org/ipipe.git. This may be a good starting point, at
least for testing with a PI 1, before working on the required fixups for
supporting other Broadcom SoCs.

IIRC, RPI 2B and RPI 3 are based on the bcm2836, bcm2837 SoCs resp.,
which are not covered by the port just mentioned. You may find some
preliminary I-pipe related changes in the bcm2836 core interrupt support
code, but those have never been tested. By preliminary, I mean that
there is likely a few more IRQ controllers to make I-pipe aware on these
SoCs, aside of testing the initial changes.

Bottom line: using a stock I-pipe patch is unlikely to work out of the
box. The fact that such patch does support several SoCs equipped with
Cortex A7/A9 CPUs is by no mean a guarantee that all Cortex-based SoCs
are supported by the same code.

-- 
Philippe.


  reply	other threads:[~2017-05-30 17:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30 16:38 [Xenomai] problem gpio interrupts xenomai3 on the raspberry pi 2 (or 3) Harco Kuppens
2017-05-30 17:30 ` Philippe Gerum [this message]
2017-05-30 19:32   ` Harco Kuppens
     [not found] <mailman.115.1496162312.4225.xenomai@xenomai.org>
2017-05-30 17:47 ` Nitin Kulkarni
     [not found] <mailman.117.1496166485.4225.xenomai@xenomai.org>
2017-05-30 18:02 ` Nitin Kulkarni
2017-05-31  7:16   ` Philippe Gerum
2017-05-31 10:34     ` Nitin Kulkarni
2017-06-01  7:11       ` Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb912c40-1247-6395-9a84-a3203dd5f022@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=h.kuppens@cs.ru.nl \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.