From owner-freebsd-mips@freebsd.org Fri Mar 4 13:10:07 2016 Return-Path: Delivered-To: freebsd-mips@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B6EF9DB445 for ; Fri, 4 Mar 2016 13:10:07 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: from mail-lb0-x229.google.com (mail-lb0-x229.google.com [IPv6:2a00:1450:4010:c04::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A0DE198B for ; Fri, 4 Mar 2016 13:10:06 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: by mail-lb0-x229.google.com with SMTP id k15so60465734lbg.0 for ; Fri, 04 Mar 2016 05:10:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=YmNcy5CuA+RsA4Bub96eukcFTGM2Sukcu+nGG4Kzaok=; b=Ss+nvyGM7UqxacNP3Y7qIFAXNnPEJnzFgr5YMTe4+eal1ig5qSiLjWY1IzZIfrrd3p uweLGTXjNXko66Q9fEgyyrCarphVDkooFDeOdqRDKeKtjbfCiR/ZnCakutoRmUB+Ypn4 QAL967kr1f5QXeKrOhTiQ/BBC9GBbviCwZAxQkXtE4Sx/M1ljYuZCHqfRFWXGrNQQDW4 /cSZc+eUXWYIzwXzxpzGzKtbq8VaX8zD0eZOtJwBKeE//pYTXBKPv4yYQSV1BhPjX6Kr IbRcNWRNdeH6zpVJFsC2WHXresCFczT9WP8JcGjsqQQadrCPAoVn9dBtYThd2xf420P8 BdBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=YmNcy5CuA+RsA4Bub96eukcFTGM2Sukcu+nGG4Kzaok=; b=GIvDfrTFvlM66SNjKTZcN9T33Rad7omHuzQ148CHH6FWj1LActNRGoouCxRnA5u99q kJFJDmKWWiAAKXpdWLXw8wdK8+pfsUkxNglLOp3+/ZZTyC4L3TYa9nAi0vPfr4SXXLDi GhN2Pf6UrQJOyfC7fFNnvZdqyceB831HRKNLmeKn4XuKC78PxC4/NwMOD44K4JuucIox PTa2v8s5fnQIAVei+sfPE6FeAj19KZLsD+QAAskD55o4EDSIujl8I5eYpPvJ3YsPk2RX N4jnDd/10PaOHEd4hDhlEESJdthZKXKSwqfeJSOcqf19a4JkhA//4aKhInf5JqeBfiNZ H10w== X-Gm-Message-State: AD7BkJLOzPeonaFJsbe9oIOZ+L/JYp1FxWU71c8K9GmncEwBtDEAISAdOaoSBx9r+Cpe46XpgijYjMJZ812HxA== MIME-Version: 1.0 X-Received: by 10.25.141.65 with SMTP id p62mr2420641lfd.10.1457097004760; Fri, 04 Mar 2016 05:10:04 -0800 (PST) Received: by 10.112.180.138 with HTTP; Fri, 4 Mar 2016 05:10:04 -0800 (PST) In-Reply-To: References: Date: Fri, 4 Mar 2016 16:10:04 +0300 Message-ID: Subject: Re: [BCM4718] Broken interrupts From: Michael Zhilin To: Stanislav Galabov Cc: Adrian Chadd , "freebsd-mips@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2016 13:10:07 -0000 Stanislav, I've added to BCM471x: makeoptions MIPS_INTRNG options MIPS_INTRNG to options.mips: MIPS_INTRNG opt_global.h Then removed all kernel object files and run buildkernel (thank you, Adrian, for freebsd-wifi-build scripts!). But it's still same behavior. Here is output of printfs before and after clock_intr: cpupic0: Servicing interrupt 7 before clock_intr(0x80528100) cnt=f2fe11a cmp=deadc0bb cause=8000 after clock_intr cnt=f45c9e6 cmp=ffffffff cause=8000 cpupic0: Servicing interrupt 7 before clock_intr(0x80528100) cnt=f6225e7 cmp=ffffffff cause=8000 after clock_intr cnt=f780e46 cmp=ffffffff cause=8000 cpupic0: Servicing interrupt 7 before clock_intr(0x80528100) cnt=f946b1e cmp=ffffffff cause=8000 after clock_intr cnt=faa548a cmp=ffffffff cause=8000 cpupic0: Servicing interrupt 7 before clock_intr(0x80528100) cnt=fc6b178 cmp=ffffffff cause=8000 after clock_intr cnt=fdc9ae6 cmp=ffffffff cause=8000 cpupic0: Servicing interrupt 7 before clock_intr(0x80528100) cnt=ff8f7b8 cmp=ffffffff cause=8000 after clock_intr cnt=100ee112 cmp=ffffffff cause=8000 cpupic0: Servicing interrupt 7 before clock_intr(0x80528100) cnt=102b8fa8 cmp=ffffffff cause=8000 after clock_intr cnt=1041cc94 cmp=ffffffff cause=8000 cpupic0: Servicing interrupt 7 before clock_intr(0x80528100) cnt=105e7b26 cmp=ffffffff cause=8000 after clock_intr cnt=1074b6c8 cmp=ffffffff cause=8000 cpupic0: Servicing interrupt 7 before clock_intr(0x80528100) cnt=10916586 cmp=ffffffff cause=8000 after clock_intr cnt=10a7a24c cmp=ffffffff cause=8000 cpupic0: Servicing interrupt 7 before clock_intr(0x80528100) cnt=10c4510a cmp=ffffffff cause=8000 after clock_intr cnt=10da8c62 cmp=ffffffff cause=8000 cpupic0: Servicing interrupt 7 before clock_intr(0x80528100) cnt=10f73c6e cmp=ffffffff cause=8000 after clock_intr cnt=110d7838 cmp=ffffffff cause=8000 As I mentioned before, there are 2 symptoms: * cnt != cmp for IRQ5 triggering * cause is always 8000 (i.e. IP7 = 1) even after mips_wr_compare. Thanks! On Fri, Mar 4, 2016 at 3:33 PM, Stanislav Galabov wrote: > Also, before doing that, you'll have to add: > MIPS_INTRNG opt_global.h > to the end of sys/conf/options.mips > > Adrian, we somehow missed that in the commit of > https://reviews.freebsd.org/D5182 although it is in the last diff I had > attached... I'll put up a review for this on monday. > > Best wishes, > Stanislav > > On Fri, Mar 4, 2016 at 2:17 PM, Stanislav Galabov > wrote: > >> Hi Michael, >> >> If I understand correctly the goal is to use INTRNG for MIPS? >> If so, I didn't notice 'options MIPS_INTRNG' anywhere in your kernel >> config files... >> Please try to add this to your sys/mips/bcm471x/std.bcm471x for example >> and let us know how this goes. >> >> Best wishes, >> Stanislav >> >> On Fri, Mar 4, 2016 at 1:19 PM, Michael Zhilin wrote: >> >>> Hi Adrian! >>> >>> Yes, KDB works. And yes, (today's finding) something is silly that force >>> make IRQ5 endless. After processing of previous request, next request is >>> starting. According to mips docs found in google, IRQ5 must be triggered >>> only if count == compare. In my case, count increments on 0x20000 >>> roughly, >>> compare is constant. There is another finding: cause register is always >>> 0x8000, even after call mips_wr_compare(). I suppose that this is >>> possible >>> reason of infinite IRQ5 requests, but still don't know how to fix it... >>> >>> Thx, >>> Michael >>> >>> On Fri, Mar 4, 2016 at 11:56 AM, Adrian Chadd >>> wrote: >>> >>> > hm, does kdb work (ie ,break to debugger at that point), or is the >>> system >>> > hosed? >>> > >>> > is it something silly like it getting stuck servicing interrupts >>> > because they're not being correctly ACKed? >>> > >>> > >>> > >>> > -a >>> > >>> > >>> > On 3 March 2016 at 12:22, Michael Zhilin wrote: >>> > > Hi, >>> > > >>> > > I'm trying to load FreeBSD kernel on Broadcom MIPS router (ASUS >>> RT-N16). >>> > > Here is actual dmesg: http://pastebin.com/AtEz6kc9 . But my actual >>> > problem >>> > > is broken interrupts. After enabling of interrupts in >>> > > autoconf.c:configure_final the MipsException code is called, it works >>> > fine >>> > > (including INTRNG), but cpu doesn't return to main thread (suprise!). >>> > > >>> > > I can see printf from clockintr, i.e. there are regular timer >>> requests. >>> > But >>> > > there is no printf from main thread (autoconf.c) after enabling of >>> > > interrupts. >>> > > >>> > > Also I've tried to simplify MipsException to avoid any issue with >>> > > saving/restoring registers: >>> > > mfc0 k0, MIPS_COP_0_EXC_PC >>> > > rfe >>> > > jr k0 >>> > > >>> > > but still there is no return to main thread. >>> > > >>> > > I'm not familiar with JTAG and have no JTAG adapter for debugging. >>> :( To >>> > be >>> > > honest, I've lost hope. >>> > > >>> > > What could possibly be wrong? Here is github branch for reference: >>> > > https://github.com/Cka3o4Huk/freebsd/tree/user/mizhka/bcm471x >>> > > >>> > > Thank you in advance, >>> > > Michael >>> > > _______________________________________________ >>> > > freebsd-mips@freebsd.org mailing list >>> > > https://lists.freebsd.org/mailman/listinfo/freebsd-mips >>> > > To unsubscribe, send any mail to " >>> freebsd-mips-unsubscribe@freebsd.org" >>> > >>> _______________________________________________ >>> freebsd-mips@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/freebsd-mips >>> To unsubscribe, send any mail to "freebsd-mips-unsubscribe@freebsd.org" >>> >> >> >