linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rich Felker <dalias@libc.org>
To: linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org
Cc: Jason Cooper <jason@lakedaemon.net>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Daniel Lezcano <daniel.lezcano@linaro.org>
Subject: Re: [PATCH v3 08/12] irqchip: add J-Core AIC driver
Date: Fri, 15 Jul 2016 14:19:35 -0400	[thread overview]
Message-ID: <20160715181934.GU15995@brightrain.aerifal.cx> (raw)
In-Reply-To: <20160715012750.GQ15995@brightrain.aerifal.cx>

On Thu, Jul 14, 2016 at 09:27:50PM -0400, Rich Felker wrote:
> On Wed, May 25, 2016 at 05:43:03AM +0000, Rich Felker wrote:
> > There are two versions of the J-Core interrupt controller in use, aic1
> > which generates interrupts with programmable priorities, but only
> > supports 8 irq lines and maps them to cpu traps in the range 17 to 24,
> > and aic2 which uses traps in the range 64-127 and supports up to 128
> > irqs, with priorities dependent on the interrupt number. The Linux
> > driver does not make use of priorities anyway.
> > 
> > For simplicity, there is no aic1-specific logic in the driver beyond
> > setting the priority register, which is necessary for interrupts to
> > work at all. Eventually aic1 will likely be phased out, but it's
> > currently in use in deployments and all released bitstream binaries.
> 
> Any comments on changes I should make in resubmitting this for the 4.8
> merge window? I could somewhat restrict the possible irqs, but aic1
> allows the pit to be programmed to generate any trap number you want,
> despite the hard-wired interrupts being limited to the range 17-24.
> 
> It might make sense to do something to allow percpu irq requests, but
> I couldn't figure out how to make them work and the current timer
> driver (that needs per-cpu irq delivery) just requests its irq through
> normal request_irq and lets the hardware do the right thing.

I've looked into this some more, and the request_percpu_irq system
looks misdesigned and unusable. It requires the IRQ controller driver
to know in advance, before it knows what devices/drivers are connected
to it, whether each irq will be used with a __percpu dev_id, and this
is not a property of the irq controller hardware or the connected
peripheral device hardware, but rather of the _driver_ for the
connected hardware. This is because the irq controller driver must, at
irqdomain mapping time, decide whether to register the handler as
handle_percpu_devid_irq (which interprets dev_id as a __percpu pointer
and remaps it for the local cpu before invoking the driver's handler)
or one of the other handlers that does not perform any percpu
remapping.

The right way for this to work would be for handle_irq_event_percpu to
be responsible for the remapping, but do it conditionally on whether
the irq was requested via request_irq or request_percpu_irq.

In the mean time until this is overhauled correctly, I believe drivers
(in my case, the J-Core timer driver and IPI "driver") should just
call request_irq with the IRQF_PERCPU flag (to ensure the handler runs
on the cpu the irq was received for) and should do their own
this_cpu_ptr(dev_id) as needed.

Rich

  reply	other threads:[~2016-07-15 18:19 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25  5:43 [PATCH v3 00/12] J-core J2 cpu and SoC peripherals support Rich Felker
2016-05-25  5:43 ` [PATCH v3 01/12] of: add vendor prefix for J-Core Rich Felker
2016-05-25 13:18   ` Rob Herring
2016-07-27  5:31     ` Rich Felker
2016-08-04 22:27       ` Rich Felker
2016-08-30 21:13         ` Rob Herring
2016-05-25  5:43 ` [PATCH v3 12/12] sh: add device tree source for J2 FPGA on Mimas v2 board Rich Felker
2016-05-25 10:33   ` Mark Rutland
2016-05-25 23:15     ` Rich Felker
2016-05-26 10:39       ` Mark Rutland
2016-05-25  5:43 ` [PATCH v3 02/12] of: add J-Core cpu bindings Rich Felker
2016-05-25 10:22   ` Mark Rutland
2016-05-25 23:04     ` Rich Felker
2016-05-26  7:54       ` Geert Uytterhoeven
2016-05-26 10:38       ` Mark Rutland
2016-05-26 15:33         ` Rich Felker
2016-05-27  9:13           ` Mark Rutland
2016-05-26 21:44       ` Rob Landley
2016-05-27 11:51         ` Afzal Mohammed
2016-05-25  5:43 ` [PATCH v3 09/12] clocksource: add J-Core timer/clocksource driver Rich Felker
2016-05-25  5:43 ` [PATCH v3 03/12] of: add J-Core interrupt controller bindings Rich Felker
2016-05-25 10:25   ` Mark Rutland
2016-05-25 23:08     ` Rich Felker
2016-05-25  5:43 ` [PATCH v3 11/12] sh: add defconfig for J-Core J2 Rich Felker
2016-05-25  5:43 ` [PATCH v3 07/12] sh: add AT_HWCAP flag for J-Core cas.l instruction Rich Felker
2016-05-25  5:43 ` [PATCH v3 10/12] spi: add driver for J-Core SPI controller Rich Felker
2016-05-25 10:17   ` Mark Brown
2016-05-27  1:16     ` Rich Felker
2016-05-27 11:27       ` Mark Brown
2016-05-25  5:43 ` [PATCH v3 04/12] of: add J-Core timer bindings Rich Felker
2016-06-01 13:58   ` Rob Herring
2016-06-01 17:53     ` Rich Felker
2016-06-01 21:53       ` Rich Felker
2016-06-01 22:36       ` Rob Herring
2016-06-02  1:34         ` Rich Felker
2016-06-02 22:44           ` Rob Herring
2016-06-23 21:16             ` Rich Felker
2016-07-14 22:18               ` Rich Felker
2016-05-25  5:43 ` [PATCH v3 05/12] of: add J-Core SPI master bindings Rich Felker
2016-05-25 19:04   ` Rob Herring
2016-05-25  5:43 ` [PATCH v3 06/12] sh: add support for J-Core J2 processor Rich Felker
2016-05-25  5:43 ` [PATCH v3 08/12] irqchip: add J-Core AIC driver Rich Felker
2016-07-15  1:27   ` Rich Felker
2016-07-15 18:19     ` Rich Felker [this message]
2016-07-15 15:35   ` Paul Gortmaker
2016-07-15 15:41     ` Rich Felker
2016-07-15 16:19   ` Jason Cooper
2016-07-15 17:02     ` Rich Felker
2016-05-25  7:22 ` [PATCH v3 00/12] J-core J2 cpu and SoC peripherals support Geert Uytterhoeven
2016-05-25  9:54 ` Mark Brown
2016-05-25 22:24   ` Rich Felker
2016-05-26  0:42     ` Mark Brown

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=20160715181934.GU15995@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).