Date: Tue, 15 Apr 2014 22:29:59 +0200 From: Jakub Klama <jakub.klama@uj.edu.pl> To: Warner Losh <imp@bsdimp.com> Cc: freebsd-arm@FreeBSD.org, Ian Lepore <ian@FreeBSD.org> Subject: Re: [RFC] Refactored interrupt handling on ARM Message-ID: <cb794718aa52359dfc1e1278d326f194@uj.edu.pl> In-Reply-To: <1C9D6FD8-A237-4123-A22F-9D8FAF984C1B@bsdimp.com> References: <3e7f866f4bc774975ae3c85e0df78ec2@uj.edu.pl> <53418D13.7030107@freebsd.org> <534C0F48.2090302@freebsd.org> <f2bebfa812ecb70f423b6be4779b217b@uj.edu.pl> <534C5A6A.1090707@freebsd.org> <246c2ef842c2b47eb2400c1f700ad441@uj.edu.pl> <534CC733.7010009@freebsd.org> <ACD52C94-A44A-42FD-8016-61B0B21B12D9@bsdimp.com> <619da7d72d2345b1fcac5426b45c6ead@uj.edu.pl> <1397580102.1124.121.camel@revolution.hippie.lan> <da94dcc391d9f02709186d662eab696e@uj.edu.pl> <1C9D6FD8-A237-4123-A22F-9D8FAF984C1B@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cb794718aa52359dfc1e1278d326f194>