[RFC] Refactored interrupt handling on ARM
Jakub Klama
jakub.klama at uj.edu.pl
Tue Apr 15 20:30:01 UTC 2014
On Tue, 15 Apr 2014 14:03:13 -0600, Warner Losh wrote:
>> Good point. I think that following change should be sufficent:
>>
>> --- a/sys/arm/arm/intrng.c
>> +++ b/sys/arm/arm/intrng.c
>> @@ -113,6 +113,14 @@ arm_dispatch_irq(device_t dev, struct trapframe
>> *tf, int irq)
>> debugf("pic %s, tf %p, irq %d\n", device_get_nameunit(dev),
>> tf, irq);
>> + /*
>> + * If we got null trapframe argument, that probably means
>> + * a call from non-root interrupt controller. In that case,
>> + * we'll just use the saved one.
>> + */
>> + if (tf == NULL)
>> + tf = PCPU_GET(curthread)->td_intr_frame;
>> +
>> for (i = 0; arm_intrs[i].ih_dev != NULL; i++) {
>> if (arm_intrs[i].ih_pic->ic_dev == dev &&
>> arm_intrs[i].ih_irq == irq) {
>
> I’d have thought that the cascading controllers would have passed
> this trap frame
> along. What am I missing?
What do you mean by "passed along"? In intr handler, you can have one
argument passed: either the trap frame or user-provided arg, but not
both.
In fact, you will rarely (if ever) need both. Second thing is that
the trap frame is saved in curthread->td_intr_frame and is easy to
reach.
So, in this solution, you will need to supply trap frame only in first
(root) call to arm_dispatch_irq() on nexus and consecutive next level
calls to intr_event_handle() will get same trap frame (so you can still
use NULL arg on intr handler and get tf instead).
Jakub
More information about the freebsd-arm
mailing list