public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: Design of interrupt controller driver
Date: Mon, 5 Jun 2017 10:23:48 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1706051007050.3517@nanos> (raw)
In-Reply-To: <6e4da485-42cc-9b70-1b4a-9729f646e014@free.fr>

On Mon, 5 Jun 2017, Mason wrote:
> On 04/06/2017 22:13, Thomas Gleixner wrote:
> > When you configure the interrupt as edge then you cannot share it. No
> > matter whether it stays high or not.
> 
> Could you explain why? (I must be missing something.)

Device A    Device B	 Combined Output  Edge detection
Low    	    Low	   	 0	  	  N

Low -> High Low		 1	    	  Y  -> Interrupt handled

High   	    Low -> High	 1	    	  N

When the A line stays high, which it does, then the edge detector will not
see a transition for B and you lose an interrupt.

> > The only way to share it is, to configure it as level interrupt. But that
> > requires that you can disable the interrupt at the DMA device level once it
> > triggered. Otherwise you get an interrupt storm.
> 
> I'm not sure what you mean with "disable the interrupt at the
> DMA device level". The interrupt can be masked at the system
> interrupt controller (i.e. before sharing the interrupt
> signal). The DMA engine just outputs 0 when busy, 1 when idle.

Sharing level interrupts requires a way to disable the device (in your case
the DMA engine) interrupt output in order to prevent irq storms.

Pseudo code (locking etc. omitted):

irq_handler_devA()
{
	if (!interrupt_active(devA))
		return IRQ_NONE;

	handle_device_irq();

	if (no_more_outstanding_requests(devA)) {
		reg = readl(devA->irq_control_reg);
		reg &= ~DEV_IRQ_ENABLE;
		writel(devA->irq_control_reg, reg);
	}
	return IRQ_HANDLED;
}

queue_reqeust_devA()
{
	if (no_more_outstanding_requests(devA)) {
		queue_request();
		
		start_engine();

		/* Reenable interrupt at device level */
		reg = readl(devA->irq_control_reg);
		reg |= DEV_IRQ_ENABLE;
		writel(devA->irq_control_reg, reg);
	} else {
	       queue_request();
	}
}

You get the idea.

Thanks,

	tglx

  reply	other threads:[~2017-06-05  8:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-03 16:49 Design of interrupt controller driver Mason
2017-06-03 18:20 ` Mason
2017-06-04 13:55 ` Thomas Gleixner
2017-06-04 17:18   ` Mason
2017-06-04 20:13     ` Thomas Gleixner
2017-06-04 23:40       ` Mason
2017-06-05  8:23         ` Thomas Gleixner [this message]
2017-06-05 11:57           ` Mason
2017-06-06  7:39             ` Thomas Gleixner
2017-06-06  9:35               ` Mason
2017-06-06 10:29                 ` Thomas Gleixner

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=alpine.DEB.2.20.1706051007050.3517@nanos \
    --to=tglx@linutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox