From owner-freebsd-mips@FreeBSD.ORG Mon Jun 29 00:51:51 2009 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 281AC10656C1 for ; Mon, 29 Jun 2009 00:51:51 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from core.tav.kiev.ua (tavex.colocall.com [62.149.10.42]) by mx1.freebsd.org (Postfix) with ESMTP id AFCE78FC21 for ; Mon, 29 Jun 2009 00:51:50 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from s0106001c10164644.vc.shawcable.net ([24.87.58.40] helo=[192.168.1.47]) by core.tav.kiev.ua with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.52 (FreeBSD)) id 1ML4of-0006Hy-Jb; Mon, 29 Jun 2009 03:33:50 +0300 Message-ID: <4A480BD2.8010700@bluezbox.com> Date: Sun, 28 Jun 2009 17:33:22 -0700 From: Oleksandr Tymoshenko User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Neelkanth Natu References: <58821.29900.qm@web34405.mail.mud.yahoo.com> In-Reply-To: <58821.29900.qm@web34405.mail.mud.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Core-Spam-Level: -- X-Core-Spam-Report: Spam detection software, running on the system "core.tav.kiev.ua", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Neelkanth Natu wrote: > Hi Oleksandr, > > I'll try out your patch and let you know how it goes. > > Do you have anything in particular that you will be working on in the > platform-independent part? I could help if needed. > I just tried to build several ports and see if it's going to succeed. As a result bug in pmap_qenter was fixed and threads work in FreeBSD/mips now. So far I managed to build python and perl(with system malloc) and they seem to work. More thorough testing required though. [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.8 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 BAYES_50 BODY: Bayesian spam probability is 40 to 60% [score: 0.5000] -0.3 AWL AWL: From: address is in the auto white-list Cc: freebsd-mips@freebsd.org Subject: Re: FreeBSD/mips booting on Sibyte 1250 X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 00:51:51 -0000 Neelkanth Natu wrote: > Hi Oleksandr, > > I'll try out your patch and let you know how it goes. > > Do you have anything in particular that you will be working on in the > platform-independent part? I could help if needed. > I just tried to build several ports and see if it's going to succeed. As a result bug in pmap_qenter was fixed and threads work in FreeBSD/mips now. So far I managed to build python and perl(with system malloc) and they seem to work. More thorough testing required though. > best > Neel > > --- On Fri, 6/26/09, Oleksandr Tymoshenko wrote: > > >> From: Oleksandr Tymoshenko >> Subject: Re: FreeBSD/mips booting on Sibyte 1250 >> To: "Neelkanth Natu" >> Cc: freebsd-mips@freebsd.org, "Alexandr Rybalko" >> Date: Friday, June 26, 2009, 2:14 PM >> Neelkanth Natu wrote: >> >>> Hi Warner, >>> >>> I have attached the diffs against -current at revision >>> >> 194280. >> >>> There are some changes in the diff that are unrelated >>> >> to the sibyte >> >>> work and probably should be committed separately. >>> >>> I can provide more information about changes to >>> >> specific files if necessary. >> Thanks for contribution. I'm trying to make >> platform-independent >> part of mips/ tree and userland stable and once it's done >> more time >> will be available for adding new platforms (I hope it will >> be soon >> enough) :) >> Meanwhile I'd appreciate if you test attached >> patch for busdma >> with your hardware. This implementation has been >> shamelessly ripped >> from arm code tree and should handle alignment/boundaries >> limitations >> properly. If possible, test with several DMA-enabled >> devices working >> simultaneously. Thanks. >> >> Patch: http://people.freebsd.org/~gonzo/busdma.diff >> >> > > > > > From owner-freebsd-mips@FreeBSD.ORG Mon Jun 29 19:13:43 2009 Return-Path: Delivered-To: freebsd-mips@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 330201065672 for ; Mon, 29 Jun 2009 19:13:43 +0000 (UTC) (envelope-from gsa@arrigogroup.com.mt) Received: from mxrouter1.telemail.com.mt (mxrouter1.telemail.com.mt [62.173.0.44]) by mx1.freebsd.org (Postfix) with ESMTP id 840F08FC17 for ; Mon, 29 Jun 2009 19:13:42 +0000 (UTC) (envelope-from gsa@arrigogroup.com.mt) Received: from bandwidth.arrigogroup.com.mt (mail3.arrigogroup.com.mt [62.173.19.5]) by mxrouter1.telemail.com.mt (8.13.1/8.13.1) with SMTP id n5TIvBDG026676 for ; Mon, 29 Jun 2009 20:57:11 +0200 Received: FROM spamb BY bandwidth.arrigogroup.com.mt ; Mon Jun 29 18:17:28 2009 +0200 Organization: Arrigo Group Message-ID: <40ee31acd19bd309a5160275001b696a@arrigogroup.com.mt> From: "Arrigo Group" To: Date: Sun, 28 Jun 2009 23:45:34 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Croatia X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gsa@arrigogroup.com.mt List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 19:13:43 -0000 Direct flights to Croatia with Special Prices Packages starting from Eu399pp which includes direct flights to Split, = airport taxes, 7-nights in a self-catering apartment or Tour packages starting from Eu465pp which includes direct flights to = Split, airport taxes, 7-nights in a central hotel in Trogir on bed and = breakfast, transfers and tour leader Flight only also available=2E Special prices applies for groups of over 5 passengers!! =20 For further details visit: www.letsgoholiday.com or call on 2345 2345 From owner-freebsd-mips@FreeBSD.ORG Wed Jul 1 04:42:28 2009 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEB76106564A for ; Wed, 1 Jul 2009 04:42:28 +0000 (UTC) (envelope-from neelnatu@yahoo.com) Received: from web34403.mail.mud.yahoo.com (web34403.mail.mud.yahoo.com [66.163.178.152]) by mx1.freebsd.org (Postfix) with SMTP id 8BB058FC0C for ; Wed, 1 Jul 2009 04:42:28 +0000 (UTC) (envelope-from neelnatu@yahoo.com) Received: (qmail 72844 invoked by uid 60001); 1 Jul 2009 04:42:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1246423348; bh=gy3WkrNxgodIJVmC7xfQYgoDbiaqcSlC+HY5DNxPVD8=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=z+S4WaXbI/59BadH7pdoVChsmU5TriITWkeRIELv7wPG3UT6wTBUWda7XrQt13oEDmyKtqxyBaVbeAjyrwWG5+zfSiAdPZNxih8gF86Xg8YtlGZ4kHke4pd41blD8dpmdkhSujsmN2E11p80zDBB5Md76Q9E5Bf3WkKpojagsqI= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=AxWKWYD7/Z5U0u/eFGRMPN4gtFZug2CQ3SZ8/1Etgrd1nn3J9jSwp3x3KmoG30gkYCoRhvy8CJygBbJj1XJe6FuwMuEQ/tq7CHgrQmRDABJRrhvV5EmxgB+/cvO263eR5SBcV/dUd5A1sE8CX9C7Dh0i28neZTezCRS2Cx+km0s=; Message-ID: <14584.70267.qm@web34403.mail.mud.yahoo.com> X-YMail-OSG: hqIw1EUVM1nL7_JdkyUhG89SAdNGkZBt770dvWBs6jy5Th3Pky6EYhhBGTWjkYsFfkFD6OO6cQrHb2F7KCJgDmgvoSEwrmL91hTVKwff9l9HxwT0QWozO11lLDD6JsDTWZcrkqwrwuk6uKTkSLSdrFMVOAiIHnMYDvSZ4dNxsW3v2CBG0u.qmKgrRXlvsBthmR2mrcBiiijau2gluKWUUlWnmHWuE1KdXIIFAktrNsxHEPri.sgq0NnMlAu6JGohH8bHHJW8INyuoaeeZl4IXwyDznWwU5g.0_IyzqwqMRuKsOPRxvAJ3iEfRQ7G3IruTgW4zDcAFhB_Fm0DJcUS6zXZQlHKn12eFHaUkL0- Received: from [198.95.226.228] by web34403.mail.mud.yahoo.com via HTTP; Tue, 30 Jun 2009 21:42:27 PDT X-Mailer: YahooMailClassic/5.4.17 YahooMailWebService/0.7.289.15 Date: Tue, 30 Jun 2009 21:42:27 -0700 (PDT) From: Neelkanth Natu To: freebsd-mips@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Machine Check exception during bootup X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2009 04:42:29 -0000 Hi, I was seeing machine check exception with the 'TLB Shutdown' bit set in the Status register during bootup. This would happen about 30% of the time at exactly the same place in Mips_TLBUpdate(). I was able to track this down to a bug in Mips_TLBFlush() which was using whatever address happened to be in the EntryHi register to initialize the TLB. If this address happened to be one that the system would subsequently instantiate in the TLB we would hit a machine check exception in Mips_TLBUpdate(). At first glance it appears that the code in Mips_TLBUpdate() should deal with this since it does a TLB probe and if the probe is successful it will do a 'tlbwi' to avoid the machine check. But 'tlbp' can only look at the 'asid' and 'vpn2' fields to do its job - it does not know if you are planning to install a TLB entry with 'Global' scope. IMO this is why we trip up on a machine check exception at the 'tlbwr' instruction in Mips_TLBUpdate(). I am attaching the diff to tlb.S that fixes this problem. best Neel ==== //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/tlb.S#1 - /amd/svlusr02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/tlb.S ==== @@ -81,14 +81,14 @@ #define _MFC0 dmfc0 #define _MTC0 dmtc0 #define WIRED_SHIFT 34 -#define PAGE_SHIFT 34 +#define PAGE_SHIFT 12 #else #define _SLL sll #define _SRL srl #define _MFC0 mfc0 #define _MTC0 mtc0 #define WIRED_SHIFT 2 -#define PAGE_SHIFT 2 +#define PAGE_SHIFT 12 #endif .set noreorder # Noreorder is default style! #if defined(ISA_MIPS32) @@ -232,22 +232,30 @@ mtc0 zero, COP_0_STATUS_REG # Disable interrupts ITLBNOPFIX mfc0 t1, COP_0_TLB_WIRED - li v0, MIPS_KSEG3_START + 0x0fff0000 # invalid address _MFC0 t0, COP_0_TLB_HI # Save the PID - _MTC0 v0, COP_0_TLB_HI # Mark entry high as invalid _MTC0 zero, COP_0_TLB_LO0 # Zero out low entry0. _MTC0 zero, COP_0_TLB_LO1 # Zero out low entry1. mtc0 zero, COP_0_TLB_PG_MASK # Zero out mask entry. + + # + # Load invalid entry, each TLB entry should have it's own bogus + # address calculated by following expression: + # MIPS_KSEG0_START + 0x0fff0000 + 2 * i * PAGE_SIZE; + # One bogus value for every TLB entry might cause MCHECK exception + # + sll t3, t1, PAGE_SHIFT + 1 + li v0, MIPS_KSEG0_START + 0x0fff0000 # invalid address + addu v0, t3 /* * Align the starting value (t1) and the upper bound (a0). */ 1: mtc0 t1, COP_0_TLB_INDEX # Set the index register. ITLBNOPFIX - _MTC0 t0, COP_0_TLB_HI # Restore the PID + _MTC0 v0, COP_0_TLB_HI # Mark entry high as invalid addu t1, t1, 1 # Increment index. - addu t0, t0, 8 * 1024 + addu v0, v0, 8 * 1024 MIPS_CPU_NOP_DELAY tlbwi # Write the TLB entry. MIPS_CPU_NOP_DELAY @@ -473,7 +481,17 @@ _MFC0 t4, COP_0_TLB_HI # Get current PID move t2, a0 mfc0 t1, COP_0_TLB_WIRED + + # + # Load invalid entry, each TLB entry should have it's own bogus + # address calculated by following expression: + # MIPS_KSEG0_START + 0x0fff0000 + 2 * i * PAGE_SIZE; + # One bogus value for every TLB entry might cause MCHECK exception + # + sll t3, t1, PAGE_SHIFT + 1 li v0, MIPS_KSEG0_START + 0x0fff0000 # invalid address + addu v0, t3 + mfc0 t3, COP_0_TLB_PG_MASK # save current pgMask # do {} while (t1 < t2) From owner-freebsd-mips@FreeBSD.ORG Wed Jul 1 14:40:45 2009 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A371106566C for ; Wed, 1 Jul 2009 14:40:45 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id BB1378FC1F for ; Wed, 1 Jul 2009 14:40:44 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n61EcXPb033956; Wed, 1 Jul 2009 08:38:34 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 01 Jul 2009 08:39:00 -0600 (MDT) Message-Id: <20090701.083900.1346819654.imp@bsdimp.com> To: neelnatu@yahoo.com From: "M. Warner Losh" In-Reply-To: <14584.70267.qm@web34403.mail.mud.yahoo.com> References: <14584.70267.qm@web34403.mail.mud.yahoo.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-mips@freebsd.org Subject: Re: Machine Check exception during bootup X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2009 14:40:45 -0000 In message: <14584.70267.qm@web34403.mail.mud.yahoo.com> Neelkanth Natu writes: : r02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/tlb.S ==== : @@ -81,14 +81,14 @@ : #define _MFC0 dmfc0 : #define _MTC0 dmtc0 : #define WIRED_SHIFT 34 : -#define PAGE_SHIFT 34 : +#define PAGE_SHIFT 12 : #else : #define _SLL sll : #define _SRL srl : #define _MFC0 mfc0 : #define _MTC0 mtc0 : #define WIRED_SHIFT 2 : -#define PAGE_SHIFT 2 : +#define PAGE_SHIFT 12 : #endif These are wrong. PAGE_SHIFT is supposed to be the bit position in the TLB, not the size of the page for multiplication. At least in thoery, but looking at the manual doesn't even bear that out... However, it appears it isn't used that way at all in the rest of the code. This means we should move it outside of the #ifdef, since it has nothing to do with ISA we're compiling for. : .set noreorder # Noreorder is default style! : #if defined(ISA_MIPS32) : @@ -232,22 +232,30 @@ : mtc0 zero, COP_0_STATUS_REG # Disable interrupts : ITLBNOPFIX : mfc0 t1, COP_0_TLB_WIRED : - li v0, MIPS_KSEG3_START + 0x0fff0000 # invalid address : _MFC0 t0, COP_0_TLB_HI # Save the PID : : - _MTC0 v0, COP_0_TLB_HI # Mark entry high as invalid : _MTC0 zero, COP_0_TLB_LO0 # Zero out low entry0. : _MTC0 zero, COP_0_TLB_LO1 # Zero out low entry1. : mtc0 zero, COP_0_TLB_PG_MASK # Zero out mask entry. : + : + # : + # Load invalid entry, each TLB entry should have it's own bogus : + # address calculated by following expression: : + # MIPS_KSEG0_START + 0x0fff0000 + 2 * i * PAGE_SIZE; : + # One bogus value for every TLB entry might cause MCHECK exception : + # : + sll t3, t1, PAGE_SHIFT + 1 : + li v0, MIPS_KSEG0_START + 0x0fff0000 # invalid address : + addu v0, t3 I'll note that NetBSD doesn't add the 0x0fff0000 on the end here. I don't understand why we do it, even though I likely added this to the port. Does it work without it? Warner From owner-freebsd-mips@FreeBSD.ORG Thu Jul 2 03:28:11 2009 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 479F7106564A for ; Thu, 2 Jul 2009 03:28:11 +0000 (UTC) (envelope-from neelnatu@yahoo.com) Received: from web34401.mail.mud.yahoo.com (web34401.mail.mud.yahoo.com [66.163.178.150]) by mx1.freebsd.org (Postfix) with SMTP id 131DB8FC17 for ; Thu, 2 Jul 2009 03:28:11 +0000 (UTC) (envelope-from neelnatu@yahoo.com) Received: (qmail 33027 invoked by uid 60001); 2 Jul 2009 03:28:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1246505290; bh=6Tf2DogkCAvKzzlqKN3YBe2qLZALjAqzvgLzHKJmZ/I=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type; b=DEgJX+1vScuh94OLhVRSgCQcivVHd3EXXvRB7Hrv+ULkyI6B9e3QAsJiiRGI+ftqEW0irI4b/2O5bP0wlP17TXjK9/GCuB7vpej6ZLIxHBx0pNdylcFvLXPxoSirEEhPU/STAH1PIDcuGF1t/TNLWkrXNkK4iP9QKn/fUljRf3Q= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type; b=A8u6Edu2ZwCqsaY9HjqY77WyV4PvJvsqb+ubR34EOeRPvWgo8ZBF65Ml9QEErT4PtnEgm6ABNNGdfhUadYJeOmoEjGL/83ilylj99KaNie73Ei0Mh5sfsCPRhKWxJLcElJ1/1kfoNvpOSRaVMkHefHjduF5km90cUofTloprsKc=; Message-ID: <646809.32414.qm@web34401.mail.mud.yahoo.com> X-YMail-OSG: 89RUPf0VM1m19KlXv8D6UZy7Q2KwZWrHk.ULd4nPXnnzfIKmQn9ZAKNSDHdLgFjbJds4XzHdzqEIyb89BHYFjOWUz0U2IHwnCTx8u8E_bEOBRPzK_wZUpmRlhLe8Pmz3ryasVfl6Kei_N.VOl3x1wUtySHlflao1ML_OBz6SXWoFnbSuAGj1XpIBr8D9POOGDstkYCHyOh0B_Xfr4jJo5JoQOVWlJwNKte19Yenpm6SugBKS1CT4Ml0X_2e8wLRiZ6MUzaKyxSet.bR19VcmuO8M8vtr0LNdsPKRSz9a9xsOztW_WVpKOyfuAiGbArsM9.yemhrskeLEuI86Yw4RUxqdLw-- Received: from [198.95.226.228] by web34401.mail.mud.yahoo.com via HTTP; Wed, 01 Jul 2009 20:28:10 PDT X-Mailer: YahooMailClassic/5.4.17 YahooMailWebService/0.7.289.15 Date: Wed, 1 Jul 2009 20:28:10 -0700 (PDT) From: Neelkanth Natu To: "M. Warner Losh" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-mips@freebsd.org Subject: Re: Machine Check exception during bootup X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2009 03:28:11 -0000 Hi Warner, Thanks for reviewing the diff. I have made the changes you suggested in the review. The new diffs are at the end of this email. - No need to have redefine PAGE_SIZE in tlb.S. I am now generating this macro via genassym.c - Remove the offset 0x0fff0000 used when invalidating tlb entries. I have tested this on MALTA as well as SWARM and it seems to work fine. best Neel ==== //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/genassym.c#1 - /amd/svlusr02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/genassym.c ==== 93a94 > ASSYM(PAGE_SHIFT, PAGE_SHIFT); ==== //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/tlb.S#1 - /amd/svlusr02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/tlb.S ==== 84d83 < #define PAGE_SHIFT 34 91d89 < #define PAGE_SHIFT 2 235d232 < li v0, MIPS_KSEG3_START + 0x0fff0000 # invalid address 238d234 < _MTC0 v0, COP_0_TLB_HI # Mark entry high as invalid 241a238,247 > > # > # Load invalid entry, each TLB entry should have it's own bogus > # address calculated by following expression: > # MIPS_KSEG0_START + 2 * i * PAGE_SIZE; > # One bogus value for every TLB entry might cause MCHECK exception > # > sll t3, t1, PAGE_SHIFT + 1 > li v0, MIPS_KSEG0_START # invalid address > addu v0, t3 248c254 < _MTC0 t0, COP_0_TLB_HI # Restore the PID --- > _MTC0 v0, COP_0_TLB_HI # Mark entry high as invalid 250c256 < addu t0, t0, 8 * 1024 --- > addu v0, v0, 8 * 1024 292c298 < li t1, MIPS_KSEG0_START + 0x0fff0000 --- > li t1, MIPS_KSEG0_START 297c303 < # MIPS_KSEG0_START + 0x0fff0000 + 2 * i * PAGE_SIZE; --- > # MIPS_KSEG0_START + 2 * i * PAGE_SIZE; 476c482,492 < li v0, MIPS_KSEG0_START + 0x0fff0000 # invalid address --- > > # > # Load invalid entry, each TLB entry should have it's own bogus > # address calculated by following expression: > # MIPS_KSEG0_START + 2 * i * PAGE_SIZE; > # One bogus value for every TLB entry might cause MCHECK exception > # > sll t3, t1, PAGE_SHIFT + 1 > li v0, MIPS_KSEG0_START # invalid address > addu v0, t3 > ==== //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/swtch.S#1 - /amd/svlusr02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/swtch.S ==== 84d83 < #define PAGE_SHIFT 34 91d89 < #define PAGE_SHIFT 2 364c362 < li t1, MIPS_KSEG0_START + 0x0fff0000 # invalidate tlb entry --- > li t1, MIPS_KSEG0_START # invalidate tlb entry --- On Wed, 7/1/09, M. Warner Losh wrote: > From: M. Warner Losh > Subject: Re: Machine Check exception during bootup > To: neelnatu@yahoo.com > Cc: freebsd-mips@freebsd.org > Date: Wednesday, July 1, 2009, 7:39 AM > In message: <14584.70267.qm@web34403.mail.mud.yahoo.com> > Neelkanth Natu > > writes: > : > r02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/tlb.S > ==== > : @@ -81,14 +81,14 @@ > : #define _MFC0 > dmfc0 > : #define _MTC0 > dmtc0 > : #define WIRED_SHIFT 34 > : -#define PAGE_SHIFT 34 > : +#define PAGE_SHIFT 12 > : #else > : #define _SLL sll > : #define _SRL > srl > : #define _MFC0 > mfc0 > : #define _MTC0 > mtc0 > : #define WIRED_SHIFT 2 > : -#define PAGE_SHIFT 2 > : +#define PAGE_SHIFT 12 > : #endif > > These are wrong. PAGE_SHIFT is supposed to be the bit > position in the > TLB, not the size of the page for multiplication. At > least in thoery, > but looking at the manual doesn't even bear that out... > > However, it appears it isn't used that way at all in the > rest of the > code. This means we should move it outside of the > #ifdef, since it > has nothing to do with ISA we're compiling for. > > : .set > noreorder > # Noreorder is default style! > : #if defined(ISA_MIPS32) > : @@ -232,22 +232,30 @@ > : mtc0 zero, > COP_0_STATUS_REG # > Disable interrupts > : ITLBNOPFIX > : mfc0 t1, > COP_0_TLB_WIRED > : - li v0, > MIPS_KSEG3_START + 0x0fff0000 # invalid address > : _MFC0 t0, > COP_0_TLB_HI # Save the > PID > : > : - _MTC0 v0, > COP_0_TLB_HI # Mark > entry high as invalid > : _MTC0 zero, > COP_0_TLB_LO0 # Zero > out low entry0. > : _MTC0 zero, > COP_0_TLB_LO1 # Zero > out low entry1. > : mtc0 zero, > COP_0_TLB_PG_MASK # Zero out mask entry. > : + > : + # > : + # Load invalid entry, each TLB entry > should have it's own bogus > : + # address calculated by following > expression: > : + # MIPS_KSEG0_START + 0x0fff0000 + 2 * > i * PAGE_SIZE; > : + # One bogus value for every TLB entry > might cause MCHECK exception > : + # > : + sll t3, t1, > PAGE_SHIFT + 1 > : + li v0, > MIPS_KSEG0_START + 0x0fff0000 # invalid > address > : + addu v0, t3 > > I'll note that NetBSD doesn't add the 0x0fff0000 on the end > here. I > don't understand why we do it, even though I likely added > this to the > port. Does it work without it? > > Warner > From owner-freebsd-mips@FreeBSD.ORG Thu Jul 2 03:40:23 2009 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83449106564A for ; Thu, 2 Jul 2009 03:40:23 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 271318FC13 for ; Thu, 2 Jul 2009 03:40:23 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n623cll7042929; Wed, 1 Jul 2009 21:38:47 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 01 Jul 2009 21:39:14 -0600 (MDT) Message-Id: <20090701.213914.656669320.imp@bsdimp.com> To: neelnatu@yahoo.com From: "M. Warner Losh" In-Reply-To: <646809.32414.qm@web34401.mail.mud.yahoo.com> References: <646809.32414.qm@web34401.mail.mud.yahoo.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-mips@freebsd.org Subject: Re: Machine Check exception during bootup X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2009 03:40:23 -0000 In message: <646809.32414.qm@web34401.mail.mud.yahoo.com> Neelkanth Natu writes: : : Hi Warner, : : Thanks for reviewing the diff. : : I have made the changes you suggested in the review. The new diffs are : at the end of this email. : : - No need to have redefine PAGE_SIZE in tlb.S. I am now generating : this macro via genassym.c : : - Remove the offset 0x0fff0000 used when invalidating tlb entries. I have : tested this on MALTA as well as SWARM and it seems to work fine. Yes. You fixed the real bug, I think, when you moved from KSEG3 to KSEG0. I think there's still some things wrong with some of these routines. I'll send what I have, if I have something better, in a few. I think this is an excellent start. : best : Neel : : ==== //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/genassym.c#1 - /amd/svlusr02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/genassym.c ==== : 93a94 : > ASSYM(PAGE_SHIFT, PAGE_SHIFT); : ==== //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/tlb.S#1 - /amd/svlusr02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/tlb.S ==== : 84d83 : < #define PAGE_SHIFT 34 Can you resend as a unified diff? Warner : 91d89 : < #define PAGE_SHIFT 2 : 235d232 : < li v0, MIPS_KSEG3_START + 0x0fff0000 # invalid address : 238d234 : < _MTC0 v0, COP_0_TLB_HI # Mark entry high as invalid : 241a238,247 : > : > # : > # Load invalid entry, each TLB entry should have it's own bogus : > # address calculated by following expression: : > # MIPS_KSEG0_START + 2 * i * PAGE_SIZE; : > # One bogus value for every TLB entry might cause MCHECK exception : > # : > sll t3, t1, PAGE_SHIFT + 1 : > li v0, MIPS_KSEG0_START # invalid address : > addu v0, t3 : 248c254 : < _MTC0 t0, COP_0_TLB_HI # Restore the PID : --- : > _MTC0 v0, COP_0_TLB_HI # Mark entry high as invalid : 250c256 : < addu t0, t0, 8 * 1024 : --- : > addu v0, v0, 8 * 1024 : 292c298 : < li t1, MIPS_KSEG0_START + 0x0fff0000 : --- : > li t1, MIPS_KSEG0_START : 297c303 : < # MIPS_KSEG0_START + 0x0fff0000 + 2 * i * PAGE_SIZE; : --- : > # MIPS_KSEG0_START + 2 * i * PAGE_SIZE; : 476c482,492 : < li v0, MIPS_KSEG0_START + 0x0fff0000 # invalid address : --- : > : > # : > # Load invalid entry, each TLB entry should have it's own bogus : > # address calculated by following expression: : > # MIPS_KSEG0_START + 2 * i * PAGE_SIZE; : > # One bogus value for every TLB entry might cause MCHECK exception : > # : > sll t3, t1, PAGE_SHIFT + 1 : > li v0, MIPS_KSEG0_START # invalid address : > addu v0, t3 : > : ==== //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/swtch.S#1 - /amd/svlusr02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/swtch.S ==== : 84d83 : < #define PAGE_SHIFT 34 : 91d89 : < #define PAGE_SHIFT 2 : 364c362 : < li t1, MIPS_KSEG0_START + 0x0fff0000 # invalidate tlb entry : --- : > li t1, MIPS_KSEG0_START # invalidate tlb entry : : : --- On Wed, 7/1/09, M. Warner Losh wrote: : : > From: M. Warner Losh : > Subject: Re: Machine Check exception during bootup : > To: neelnatu@yahoo.com : > Cc: freebsd-mips@freebsd.org : > Date: Wednesday, July 1, 2009, 7:39 AM : > In message: <14584.70267.qm@web34403.mail.mud.yahoo.com> : > Neelkanth Natu : > : > writes: : > : : > r02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/tlb.S : > ==== : > : @@ -81,14 +81,14 @@ : > : #define _MFC0 : > dmfc0 : > : #define _MTC0 : > dmtc0 : > : #define WIRED_SHIFT 34 : > : -#define PAGE_SHIFT 34 : > : +#define PAGE_SHIFT 12 : > : #else : > : #define _SLL sll : > : #define _SRL : > srl : > : #define _MFC0 : > mfc0 : > : #define _MTC0 : > mtc0 : > : #define WIRED_SHIFT 2 : > : -#define PAGE_SHIFT 2 : > : +#define PAGE_SHIFT 12 : > : #endif : > : > These are wrong. PAGE_SHIFT is supposed to be the bit : > position in the : > TLB, not the size of the page for multiplication. At : > least in thoery, : > but looking at the manual doesn't even bear that out... : > : > However, it appears it isn't used that way at all in the : > rest of the : > code. This means we should move it outside of the : > #ifdef, since it : > has nothing to do with ISA we're compiling for. : > : > : .set : > noreorder : > # Noreorder is default style! : > : #if defined(ISA_MIPS32) : > : @@ -232,22 +232,30 @@ : > : mtc0 zero, : > COP_0_STATUS_REG # : > Disable interrupts : > : ITLBNOPFIX : > : mfc0 t1, : > COP_0_TLB_WIRED : > : - li v0, : > MIPS_KSEG3_START + 0x0fff0000 # invalid address : > : _MFC0 t0, : > COP_0_TLB_HI # Save the : > PID : > : : > : - _MTC0 v0, : > COP_0_TLB_HI # Mark : > entry high as invalid : > : _MTC0 zero, : > COP_0_TLB_LO0 # Zero : > out low entry0. : > : _MTC0 zero, : > COP_0_TLB_LO1 # Zero : > out low entry1. : > : mtc0 zero, : > COP_0_TLB_PG_MASK # Zero out mask entry. : > : + : > : + # : > : + # Load invalid entry, each TLB entry : > should have it's own bogus : > : + # address calculated by following : > expression: : > : + # MIPS_KSEG0_START + 0x0fff0000 + 2 * : > i * PAGE_SIZE; : > : + # One bogus value for every TLB entry : > might cause MCHECK exception : > : + # : > : + sll t3, t1, : > PAGE_SHIFT + 1 : > : + li v0, : > MIPS_KSEG0_START + 0x0fff0000 # invalid : > address : > : + addu v0, t3 : > : > I'll note that NetBSD doesn't add the 0x0fff0000 on the end : > here. I : > don't understand why we do it, even though I likely added : > this to the : > port. Does it work without it? : > : > Warner : > : : : : : From owner-freebsd-mips@FreeBSD.ORG Thu Jul 2 03:49:01 2009 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9C5D106566C for ; Thu, 2 Jul 2009 03:49:01 +0000 (UTC) (envelope-from neelnatu@yahoo.com) Received: from web34403.mail.mud.yahoo.com (web34403.mail.mud.yahoo.com [66.163.178.152]) by mx1.freebsd.org (Postfix) with SMTP id B401C8FC17 for ; Thu, 2 Jul 2009 03:49:01 +0000 (UTC) (envelope-from neelnatu@yahoo.com) Received: (qmail 50632 invoked by uid 60001); 2 Jul 2009 03:49:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1246506541; bh=0Op1feFGq0uzLeC3Vn5kI+2D9PFfW9nzA/Bml3VQ8Es=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type; b=HRUurr76ZN1edrOew90F/eTb/FLzdXQ4sQ2khmxKcM3Y5ET3omlq0CDCIRs2NtEJA4j/NC1ny4hc5NFT6qfsfEb/2Qx+cgNpBabRwH9sczt7VL98ausnrtG390J9EO/yczTCVgFfj9481ArlsrfKAvpqmrL2whmzdzGXw3lTlNc= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type; b=6Aiw/AiztiIjWDkt2bReUKmsPRrkAk7mP5r/jRO0ina+LXD9Ll6NpT4dEo9BG6v0khYygf2M6Uh6m+veXVxu3D+4SzNKUOqrNzfVZzyMBrBzFcpz6e8ttEvNBOxTg4rYk+rFCCWtr45lIn7rVUQeRMSpO+WN2WOb/w+HPiE/2o4=; Message-ID: <122643.47019.qm@web34403.mail.mud.yahoo.com> X-YMail-OSG: hdkwIFsVM1nX4hR7XF5XbYWWhp.SDwSunA6a74Mt.gmY75ACIVyqg06EPm6QtuaAF.nq_jtruu4YIzrVfGSHXxzkwn65J5R_c4TANsHqWnNnDS3HO41W2AisEam4aeG6YwN6MZekrCor_sUxzWcQ.lJQ1wCjSvcrD5Jzwgs2MgtNTYVr2g.eIGi_7Nu.FCu0nXESvxKHPyHi5zto3YdJ6QCjkF6Gkg44e_G.fk3EVGxkcjlic.pSiwwdrxLdbS2qeGAQmT1RqfUzXx14DshNMYJg__jTB9XZom1BCGcyVQizFtcOu6Gk0eln5zKijnXHz_oCsGPHJP4XmDQ8FdYKY2LPcw-- Received: from [198.95.226.228] by web34403.mail.mud.yahoo.com via HTTP; Wed, 01 Jul 2009 20:49:01 PDT X-Mailer: YahooMailClassic/5.4.17 YahooMailWebService/0.7.289.15 Date: Wed, 1 Jul 2009 20:49:01 -0700 (PDT) From: Neelkanth Natu To: "M. Warner Losh" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-mips@freebsd.org Subject: Re: Machine Check exception during bootup X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2009 03:49:02 -0000 Hi Warner, Here is the unified diff: ==== //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/genassym.c#1 - /u/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/genassym.c ==== @@ -91,6 +91,7 @@ ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); ASSYM(SIGFPE, SIGFPE); ASSYM(PGSHIFT, PGSHIFT); +ASSYM(PAGE_SHIFT, PAGE_SHIFT); ASSYM(NBPG, NBPG); ASSYM(SEGSHIFT, SEGSHIFT); ASSYM(NPTEPG, NPTEPG); ==== //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/tlb.S#1 - /u/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/tlb.S ==== @@ -81,14 +81,12 @@ #define _MFC0 dmfc0 #define _MTC0 dmtc0 #define WIRED_SHIFT 34 -#define PAGE_SHIFT 34 #else #define _SLL sll #define _SRL srl #define _MFC0 mfc0 #define _MTC0 mtc0 #define WIRED_SHIFT 2 -#define PAGE_SHIFT 2 #endif .set noreorder # Noreorder is default style! #if defined(ISA_MIPS32) @@ -232,22 +230,30 @@ mtc0 zero, COP_0_STATUS_REG # Disable interrupts ITLBNOPFIX mfc0 t1, COP_0_TLB_WIRED - li v0, MIPS_KSEG3_START + 0x0fff0000 # invalid address _MFC0 t0, COP_0_TLB_HI # Save the PID - _MTC0 v0, COP_0_TLB_HI # Mark entry high as invalid _MTC0 zero, COP_0_TLB_LO0 # Zero out low entry0. _MTC0 zero, COP_0_TLB_LO1 # Zero out low entry1. mtc0 zero, COP_0_TLB_PG_MASK # Zero out mask entry. + + # + # Load invalid entry, each TLB entry should have it's own bogus + # address calculated by following expression: + # MIPS_KSEG0_START + 2 * i * PAGE_SIZE; + # One bogus value for every TLB entry might cause MCHECK exception + # + sll t3, t1, PAGE_SHIFT + 1 + li v0, MIPS_KSEG0_START # invalid address + addu v0, t3 /* * Align the starting value (t1) and the upper bound (a0). */ 1: mtc0 t1, COP_0_TLB_INDEX # Set the index register. ITLBNOPFIX - _MTC0 t0, COP_0_TLB_HI # Restore the PID + _MTC0 v0, COP_0_TLB_HI # Mark entry high as invalid addu t1, t1, 1 # Increment index. - addu t0, t0, 8 * 1024 + addu v0, v0, 8 * 1024 MIPS_CPU_NOP_DELAY tlbwi # Write the TLB entry. MIPS_CPU_NOP_DELAY @@ -289,12 +295,12 @@ tlbp # Probe for the entry. MIPS_CPU_NOP_DELAY mfc0 v0, COP_0_TLB_INDEX # See what we got - li t1, MIPS_KSEG0_START + 0x0fff0000 + li t1, MIPS_KSEG0_START bltz v0, 1f # index < 0 => !found nop # Load invalid entry, each TLB entry should have it's own bogus # address calculated by following expression: - # MIPS_KSEG0_START + 0x0fff0000 + 2 * i * PAGE_SIZE; + # MIPS_KSEG0_START + 2 * i * PAGE_SIZE; # One bogus value for every TLB entry might cause MCHECK exception sll v0, PAGE_SHIFT + 1 addu t1, v0 @@ -473,7 +479,17 @@ _MFC0 t4, COP_0_TLB_HI # Get current PID move t2, a0 mfc0 t1, COP_0_TLB_WIRED - li v0, MIPS_KSEG0_START + 0x0fff0000 # invalid address + + # + # Load invalid entry, each TLB entry should have it's own bogus + # address calculated by following expression: + # MIPS_KSEG0_START + 2 * i * PAGE_SIZE; + # One bogus value for every TLB entry might cause MCHECK exception + # + sll t3, t1, PAGE_SHIFT + 1 + li v0, MIPS_KSEG0_START # invalid address + addu v0, t3 + mfc0 t3, COP_0_TLB_PG_MASK # save current pgMask # do {} while (t1 < t2) ==== //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/swtch.S#1 - /u/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/swtch.S ==== @@ -81,14 +81,12 @@ #define _MFC0 dmfc0 #define _MTC0 dmtc0 #define WIRED_SHIFT 34 -#define PAGE_SHIFT 34 #else #define _SLL sll #define _SRL srl #define _MFC0 mfc0 #define _MTC0 mtc0 #define WIRED_SHIFT 2 -#define PAGE_SHIFT 2 #endif .set noreorder # Noreorder is default style! #if defined(ISA_MIPS32) @@ -361,7 +359,7 @@ nop pgm: bltz s0, entry0set - li t1, MIPS_KSEG0_START + 0x0fff0000 # invalidate tlb entry + li t1, MIPS_KSEG0_START # invalidate tlb entry sll s0, PAGE_SHIFT + 1 addu t1, s0 mtc0 t1, COP_0_TLB_HI --- On Wed, 7/1/09, M. Warner Losh wrote: > From: M. Warner Losh > Subject: Re: Machine Check exception during bootup > To: neelnatu@yahoo.com > Cc: freebsd-mips@freebsd.org > Date: Wednesday, July 1, 2009, 8:39 PM > In message: <646809.32414.qm@web34401.mail.mud.yahoo.com> > Neelkanth Natu > > writes: > : > : Hi Warner, > : > : Thanks for reviewing the diff. > : > : I have made the changes you suggested in the review. The > new diffs are > : at the end of this email. > : > : - No need to have redefine PAGE_SIZE in tlb.S. I am now > generating > : this macro via genassym.c > : > : - Remove the offset 0x0fff0000 used when invalidating tlb > entries. I have > : tested this on MALTA as well as SWARM > and it seems to work fine. > > Yes. You fixed the real bug, I think, when you moved > from KSEG3 to > KSEG0. I think there's still some things wrong with > some of these > routines. I'll send what I have, if I have something > better, in a > few. I think this is an excellent start. > > : best > : Neel > : > : ==== > //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/genassym.c#1 > - > /amd/svlusr02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/genassym.c > ==== > : 93a94 > : > ASSYM(PAGE_SHIFT, PAGE_SHIFT); > : ==== > //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/tlb.S#1 > - > /amd/svlusr02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/tlb.S > ==== > : 84d83 > : < #define PAGE_SHIFT 34 > > Can you resend as a unified diff? > > Warner > > > : 91d89 > : < #define PAGE_SHIFT 2 > : 235d232 > : < li v0, > MIPS_KSEG3_START + 0x0fff0000 # invalid address > : 238d234 > : < _MTC0 v0, > COP_0_TLB_HI # Mark > entry high as invalid > : 241a238,247 > : > > : > # > : > # Load invalid entry, each TLB > entry should have it's own bogus > : > # address calculated by following > expression: > : > # MIPS_KSEG0_START + 2 * i * > PAGE_SIZE; > : > # One bogus value for every TLB > entry might cause MCHECK exception > : > # > : > sll t3, t1, > PAGE_SHIFT + 1 > : > li v0, > MIPS_KSEG0_START # > invalid address > : > addu v0, t3 > : 248c254 > : < _MTC0 t0, > COP_0_TLB_HI # Restore > the PID > : --- > : > _MTC0 v0, > COP_0_TLB_HI # Mark > entry high as invalid > : 250c256 > : < addu t0, t0, 8 > * 1024 > : --- > : > addu v0, v0, 8 > * 1024 > : 292c298 > : < li t1, > MIPS_KSEG0_START + 0x0fff0000 > : --- > : > li t1, > MIPS_KSEG0_START > : 297c303 > : < # MIPS_KSEG0_START + 0x0fff0000 + > 2 * i * PAGE_SIZE; > : --- > : > # MIPS_KSEG0_START + 2 * i * > PAGE_SIZE; > : 476c482,492 > : < li v0, > MIPS_KSEG0_START + 0x0fff0000 # invalid > address > : --- > : > > : > # > : > # Load invalid entry, each TLB > entry should have it's own bogus > : > # address calculated by following > expression: > : > # MIPS_KSEG0_START + 2 * i * > PAGE_SIZE; > : > # One bogus value for every TLB > entry might cause MCHECK exception > : > # > : > sll t3, t1, > PAGE_SHIFT + 1 > : > li v0, > MIPS_KSEG0_START # > invalid address > : > addu v0, t3 > : > > : ==== > //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/swtch.S#1 > - > /amd/svlusr02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/swtch.S > ==== > : 84d83 > : < #define PAGE_SHIFT 34 > : 91d89 > : < #define PAGE_SHIFT 2 > : 364c362 > : < li t1, > MIPS_KSEG0_START + 0x0fff0000 # invalidate > tlb entry > : --- > : > li t1, > MIPS_KSEG0_START # > invalidate tlb entry > : > : > : --- On Wed, 7/1/09, M. Warner Losh > wrote: > : > : > From: M. Warner Losh > : > Subject: Re: Machine Check exception during bootup > : > To: neelnatu@yahoo.com > : > Cc: freebsd-mips@freebsd.org > : > Date: Wednesday, July 1, 2009, 7:39 AM > : > In message: <14584.70267.qm@web34403.mail.mud.yahoo.com> > : > > Neelkanth Natu > : > > : > writes: > : > : > : > > r02.eng.netapp.com/vol/home24/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/tlb.S > : > ==== > : > : @@ -81,14 +81,14 @@ > : > : #define > _MFC0 > : > dmfc0 > : > : #define > _MTC0 > : > dmtc0 > : > : #define WIRED_SHIFT 34 > : > : -#define PAGE_SHIFT 34 > : > : +#define PAGE_SHIFT 12 > : > : #else > : > : #define _SLL sll > : > : #define _SRL > : > srl > : > : #define > _MFC0 > : > mfc0 > : > : #define > _MTC0 > : > mtc0 > : > : #define WIRED_SHIFT 2 > : > : -#define PAGE_SHIFT 2 > : > : +#define PAGE_SHIFT 12 > : > : #endif > : > > : > These are wrong. PAGE_SHIFT is supposed to be > the bit > : > position in the > : > TLB, not the size of the page for > multiplication. At > : > least in thoery, > : > but looking at the manual doesn't even bear that > out... > : > > : > However, it appears it isn't used that way at all in > the > : > rest of the > : > code. This means we should move it outside of > the > : > #ifdef, since it > : > has nothing to do with ISA we're compiling for. > : > > : > : .set > : > noreorder > : > # Noreorder is default > style! > : > : #if defined(ISA_MIPS32) > : > : @@ -232,22 +232,30 @@ > : > : mtc0 zero, > : > COP_0_STATUS_REG # > : > Disable interrupts > : > : ITLBNOPFIX > : > : mfc0 t1, > : > COP_0_TLB_WIRED > : > : - li v0, > : > MIPS_KSEG3_START + 0x0fff0000 # invalid address > : > : _MFC0 t0, > : > COP_0_TLB_HI # Save the > : > PID > : > : > : > : - _MTC0 v0, > : > COP_0_TLB_HI # Mark > : > entry high as invalid > : > : _MTC0 zero, > : > COP_0_TLB_LO0 # Zero > : > out low entry0. > : > : _MTC0 zero, > : > COP_0_TLB_LO1 # Zero > : > out low entry1. > : > : mtc0 zero, > : > COP_0_TLB_PG_MASK # Zero out > mask entry. > : > : + > : > : + # > : > : + # Load invalid entry, each TLB > entry > : > should have it's own bogus > : > : + # address calculated by following > : > expression: > : > : + # MIPS_KSEG0_START + 0x0fff0000 + 2 > * > : > i * PAGE_SIZE; > : > : + # One bogus value for every TLB > entry > : > might cause MCHECK exception > : > : + # > : > : + sll t3, t1, > : > PAGE_SHIFT + 1 > : > : + li v0, > : > MIPS_KSEG0_START + 0x0fff0000 # > invalid > : > address > : > : + addu v0, t3 > : > > : > I'll note that NetBSD doesn't add the 0x0fff0000 on > the end > : > here. I > : > don't understand why we do it, even though I likely > added > : > this to the > : > port. Does it work without it? > : > > : > Warner > : > > : > : > : > : > : > From owner-freebsd-mips@FreeBSD.ORG Sat Jul 4 03:13:32 2009 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4915106564A for ; Sat, 4 Jul 2009 03:13:32 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 595028FC19 for ; Sat, 4 Jul 2009 03:13:32 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n643BDuj073369; Fri, 3 Jul 2009 21:11:13 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 03 Jul 2009 21:11:43 -0600 (MDT) Message-Id: <20090703.211143.1622554029.imp@bsdimp.com> To: neelnatu@yahoo.com From: "M. Warner Losh" In-Reply-To: <122643.47019.qm@web34403.mail.mud.yahoo.com> References: <122643.47019.qm@web34403.mail.mud.yahoo.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-mips@freebsd.org Subject: Re: Machine Check exception during bootup X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jul 2009 03:13:33 -0000 In message: <122643.47019.qm@web34403.mail.mud.yahoo.com> Neelkanth Natu writes: : ==== //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/genassym.c#1 - /u/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/genassym.c ==== : @@ -91,6 +91,7 @@ : ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); : ASSYM(SIGFPE, SIGFPE); : ASSYM(PGSHIFT, PGSHIFT); : +ASSYM(PAGE_SHIFT, PAGE_SHIFT); : ASSYM(NBPG, NBPG); : ASSYM(SEGSHIFT, SEGSHIFT); : ASSYM(NPTEPG, NPTEPG); How do PAGE_SHIFT and PGSHIFT differ? Warner From owner-freebsd-mips@FreeBSD.ORG Sat Jul 4 05:04:34 2009 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E9D2106564A for ; Sat, 4 Jul 2009 05:04:34 +0000 (UTC) (envelope-from neelnatu@yahoo.com) Received: from web34404.mail.mud.yahoo.com (web34404.mail.mud.yahoo.com [66.163.178.153]) by mx1.freebsd.org (Postfix) with SMTP id F3B218FC17 for ; Sat, 4 Jul 2009 05:04:33 +0000 (UTC) (envelope-from neelnatu@yahoo.com) Received: (qmail 13049 invoked by uid 60001); 4 Jul 2009 05:04:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1246683873; bh=O3JQGv1gIygBtVW90wSrV/C7ofOChzofugx7ARKf/k0=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type; b=rtOcgH2ytUY85BHmybBUDa29hbb3XXeh12YWdPkwLdiBVAe3SS2uW8VkwtH016rIoXk08u39Gs2Gkz4oo4KvlBtO7W320UTQ4LTX6lZs6mjdNdQGcR5ntioawap71rF5a7h5gmEX7c4jATUtM7g98BnK7/mLw+yRuPRaUXOBNPE= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type; b=SaL7StWQFc6gnEDR2+P3ecHBHPQ9RMjJEUBX5r2MtqFrPsApo98JPzmRDgFduVQ9qY25ufuxz6jbq4dQX79vpuf5kvHNUkjCkZyfhvxnNYd+g149puN5jaOPm1FjUToeS0HWnf19kgQEOa0JUKPl+qUPL6o3HZsqSWhF1G06r7g=; Message-ID: <385015.11949.qm@web34404.mail.mud.yahoo.com> X-YMail-OSG: pdcJ6rAVM1ljAz_IO_rsKnJ.KrRoaL4Z7KXax8GdiFBUpsNjlk3cAXpr240awzp5QpJ27nKwd6FkJMWzNvLvc05alhvWUmH0OEJV8iZCcqCgjwuMiTRP5VtmDwWEHR_sugQ.yW0BeC6Rk3FVbSW4F3TkWixDxZ2hD0xufoI6WDJs__daV9wrUO0jPDTB3TiL227yDj6Yr1xqvCrrbOQq0OyOEkzv1w2I6kd81rj.FMoMOsfi_h23V18mvvuwF1U7OgNKC7TrlEIP0vSz4pIy7UYQmRYOFKczkJ5K0b.FKEggdMNBPmKyaKSna8VOZeDvmpUkcjMYqqvMXi.tUsKv_Fc9 Received: from [198.95.226.230] by web34404.mail.mud.yahoo.com via HTTP; Fri, 03 Jul 2009 22:04:33 PDT X-Mailer: YahooMailClassic/5.4.17 YahooMailWebService/0.7.289.15 Date: Fri, 3 Jul 2009 22:04:33 -0700 (PDT) From: Neelkanth Natu To: "M. Warner Losh" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-mips@freebsd.org Subject: Re: Machine Check exception during bootup X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jul 2009 05:04:34 -0000 Hi Warner, --- On Fri, 7/3/09, M. Warner Losh wrote: > From: M. Warner Losh > Subject: Re: Machine Check exception during bootup > To: neelnatu@yahoo.com > Cc: freebsd-mips@freebsd.org > Date: Friday, July 3, 2009, 8:11 PM > In message: <122643.47019.qm@web34403.mail.mud.yahoo.com> > Neelkanth Natu > > writes: > : ==== > //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/genassym.c#1 > - /u/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/genassym.c > ==== > : @@ -91,6 +91,7 @@ > : ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); > : ASSYM(SIGFPE, SIGFPE); > : ASSYM(PGSHIFT, PGSHIFT); > : +ASSYM(PAGE_SHIFT, PAGE_SHIFT); > : ASSYM(NBPG, NBPG); > : ASSYM(SEGSHIFT, SEGSHIFT); > : ASSYM(NPTEPG, NPTEPG); > > How do PAGE_SHIFT and PGSHIFT differ? They are identical. I looked at other architectures and it seems that PGSHIFT is a macro defined for mips alone. The same is true for PGOFSET and PAGE_MASK. So I went with the obvious macro - PAGE_SHIFT. I think we should toast PGSHIFT and PGOFFSET and replace them with PAGE_SHIFT and PAGE_MASK respectively. What do you think? best Neel > > Warner > From owner-freebsd-mips@FreeBSD.ORG Sat Jul 4 15:28:54 2009 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A3A2106566C for ; Sat, 4 Jul 2009 15:28:54 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id CF60C8FC0A for ; Sat, 4 Jul 2009 15:28:53 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n64FPSgV080144; Sat, 4 Jul 2009 09:25:28 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sat, 04 Jul 2009 09:25:59 -0600 (MDT) Message-Id: <20090704.092559.353389034.imp@bsdimp.com> To: neelnatu@yahoo.com From: "M. Warner Losh" In-Reply-To: <385015.11949.qm@web34404.mail.mud.yahoo.com> References: <385015.11949.qm@web34404.mail.mud.yahoo.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-mips@freebsd.org Subject: Re: Machine Check exception during bootup X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jul 2009 15:28:54 -0000 In message: <385015.11949.qm@web34404.mail.mud.yahoo.com> Neelkanth Natu writes: : : Hi Warner, : : --- On Fri, 7/3/09, M. Warner Losh wrote: : : > From: M. Warner Losh : > Subject: Re: Machine Check exception during bootup : > To: neelnatu@yahoo.com : > Cc: freebsd-mips@freebsd.org : > Date: Friday, July 3, 2009, 8:11 PM : > In message: <122643.47019.qm@web34403.mail.mud.yahoo.com> : > Neelkanth Natu : > : > writes: : > : ==== : > //depot/user/neelnatu/freebsd_sibyte/src/sys/mips/mips/genassym.c#1 : > - /u/neelnatu/p4/freebsd_sibyte/src/sys/mips/mips/genassym.c : > ==== : > : @@ -91,6 +91,7 @@ : > : ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); : > : ASSYM(SIGFPE, SIGFPE); : > : ASSYM(PGSHIFT, PGSHIFT); : > : +ASSYM(PAGE_SHIFT, PAGE_SHIFT); : > : ASSYM(NBPG, NBPG); : > : ASSYM(SEGSHIFT, SEGSHIFT); : > : ASSYM(NPTEPG, NPTEPG); : > : > How do PAGE_SHIFT and PGSHIFT differ? : : They are identical. I looked at other architectures and it seems that : PGSHIFT is a macro defined for mips alone. The same is true for : PGOFSET and PAGE_MASK. : : So I went with the obvious macro - PAGE_SHIFT. : : I think we should toast PGSHIFT and PGOFFSET and replace them with : PAGE_SHIFT and PAGE_MASK respectively. What do you think? This sounds like a good cleanup item... Warner