From owner-svn-src-all@FreeBSD.ORG Wed Oct 23 02:27:24 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8745224F; Wed, 23 Oct 2013 02:27:24 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-qa0-x235.google.com (mail-qa0-x235.google.com [IPv6:2607:f8b0:400d:c00::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 06063298F; Wed, 23 Oct 2013 02:27:23 +0000 (UTC) Received: by mail-qa0-f53.google.com with SMTP id k15so194076qaq.19 for ; Tue, 22 Oct 2013 19:27:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=R50FHdl7rDcsrouzTPFxVCDquo6GTXfPG6MNhKrvl1s=; b=TGjLAbf0uUtmqh5UJYFz1WN24kR+2blXS4ET6+WMOQaihyuP5Zynw/XUky+uVS7g6K vr6ZtDLyJ/7+xgCRj5YCBetONcvVI4xvH2wA0uckIleu/2V+5cAHOElfSWi5BZLtIfog on4blKrypQDDg7xxEcl5yO4dH0PrFMluBXizkVBmpWdbHq31Mq0Rp9wYImLm3NwDMDAs NwgXLdG9gwOjCl2GNzb2BN1IWTPGTpNiC8hmk6cmF04vDW3TLIXowwqYzrkPef1eaGqx hVwNN5kaDwLASKwb3X8NYEla96Himd6GxnRZvKfzJDnfOE7sPcDswhMSNNT814Gr67QI OAMA== MIME-Version: 1.0 X-Received: by 10.49.25.1 with SMTP id y1mr34363216qef.22.1382495243205; Tue, 22 Oct 2013 19:27:23 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.207.66 with HTTP; Tue, 22 Oct 2013 19:27:23 -0700 (PDT) In-Reply-To: References: <201310222106.r9ML6Rhn048212@svn.freebsd.org> Date: Tue, 22 Oct 2013 19:27:23 -0700 X-Google-Sender-Auth: oIhjb5Xnx4h7iPH4_wlFM_YMbJM Message-ID: Subject: Re: svn commit: r256934 - head/sys/mips/include From: Adrian Chadd To: Brooks Davis Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 02:27:24 -0000 .. and it didn't compile because TLBLO_SWBITS_CLEAR_SHIFT is just plain not defined in the 32-bit mips platform case. Did you attempt to do a tinderbox build on this? Or even build a 32 bit kernel? -adrian On 22 October 2013 19:20, Adrian Chadd wrote: > This fails to build: > > cc -c -x assembler-with-cpp -DLOCORE -O -pipe -march=mips32 -std=c99 -g > -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes > -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef > -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs > -fdiagnostics-show-option -nostdinc -I. > -I/usr/home/adrian/work/freebsd/svn/head/src/sys > -I/usr/home/adrian/work/freebsd/svn/head/src/sys/contrib/altq > -I/usr/home/adrian/work/freebsd/svn/head/src/sys/contrib/libfdt -D_KERNEL > -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common > -finline-limit=8000 --param inline-unit-growth=10000 --param > large-function-growth=100000 --param max-inline-insns-single=10000 > -fno-pic -mno-abicalls -G0 -DKERNLOADADDR=0x80050000 -march=mips32 > -msoft-float -ffreestanding -O -pipe -march=mips32 -std=c99 -g -Wall > -Wredundant-decls -Wnested-externs -Wstrict-prototypes > -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef > -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs > -fdiagnostics-show-option -nostdinc -I. > -I/usr/home/adrian/work/freebsd/svn/head/src/sys > -I/usr/home/adrian/work/freebsd/svn/head/src/sys/contrib/altq > -I/usr/home/adrian/work/freebsd/svn/head/src/sys/contrib/libfdt -D_KERNEL > -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common > -finline-limit=8000 --param inline-unit-growth=10000 --param > large-function-growth=100000 --param max-inline-insns-single=10000 > -fno-pic -mno-abicalls -G0 -DKERNLOADADDR=0x80050000 -march=mips32 > -msoft-float -ffreestanding -D_LOCORE -DLOCORE -Werror > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/locore.S > --- exception.o --- > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S: > Assembler messages: > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:157: > Error: Instruction sll requires absolute expression > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:157: > Error: Instruction srl requires absolute expression > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:160: > Error: Instruction sll requires absolute expression > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:160: > Error: Instruction srl requires absolute expression > --- support.o --- > --- exception.o --- > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:907: > Error: Instruction sll requires absolute expression > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:907: > Error: Instruction srl requires absolute expression > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:910: > Error: Instruction sll requires absolute expression > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:910: > Error: Instruction srl requires absolute expression > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:920: > Error: Instruction sll requires absolute expression > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:920: > Error: Instruction srl requires absolute expression > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:923: > Error: Instruction sll requires absolute expression > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:923: > Error: Instruction srl requires absolute expression > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:1064: > Error: Instruction sll requires absolute expression > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:1064: > Error: Instruction srl requires absolute expression > --- support.o --- > cc -c -x assembler-with-cpp -DLOCORE -O -pipe -march=mips32 -std=c99 -g > -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes > -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef > -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs > -fdiagnostics-show-option -nostdinc -I. > -I/usr/home/adrian/work/freebsd/svn/head/src/sys > -I/usr/home/adrian/work/freebsd/svn/head/src/sys/contrib/altq > -I/usr/home/adrian/work/freebsd/svn/head/src/sys/contrib/libfdt -D_KERNEL > -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common > -finline-limit=8000 --param inline-unit-growth=10000 --param > large-function-growth=100000 --param max-inline-insns-single=10000 > -fno-pic -mno-abicalls -G0 -DKERNLOADADDR=0x80050000 -march=mips32 > -msoft-float -ffreestanding -O -pipe -march=mips32 -std=c99 -g -Wall > -Wredundant-decls -Wnested-externs -Wstrict-prototypes > -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef > -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs > -fdiagnostics-show---- exception.o --- > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:1067: > Error: Instruction sll requires absolute expression > /usr/home/adrian/work/freebsd/svn/head/src/sys/mips/mips/exception.S:1067: > Error: Instruction srl requires absolute expression > > > > > -adrian > > > On 22 October 2013 14:06, Brooks Davis wrote: > >> Author: brooks >> Date: Tue Oct 22 21:06:27 2013 >> New Revision: 256934 >> URL: http://svnweb.freebsd.org/changeset/base/256934 >> >> Log: >> MFP4: >> Change 221534 by rwatson@rwatson_zenith_cl_cam_ac_uk on 2013/01/27 >> 16:05:30 >> >> FreeBSD/mips stores page-table entries in a near-identical >> format >> to MIPS TLB entries -- only it overrides certain "reserved" bits >> in the MIPS-defined EntryLo register to hold software-defined >> bits >> (swbits) to avoid significantly increasing the page table memory >> footprint. On n32 and n64, these bits were (a) colliding with >> MIPS64r2 physical memory extensions and (b) being improperly >> cleared. >> >> Attempt to fix both of these problems by pushing swbits further >> along 64-bit EntryLo registers into the reserved space, and >> improving consistency between C-based and assembly-based >> clearing >> of swbits -- in particular, to use the same definition. This >> should stop swbits from leaking into TLB entries -- while >> ignored >> by most current MIPS hardware, this would cause a problem with >> (much) larger physical memory sizes, and also leads to confusing >> hardware-level tracing as physical addresses contain unexpected >> (and inconsistent) higher bits. >> >> Discussed with: imp, jmallett >> >> MFC after: 3 days >> Sponsored by: DARPA/AFRL >> >> Modified: >> head/sys/mips/include/pte.h >> >> Modified: head/sys/mips/include/pte.h >> >> ============================================================================== >> --- head/sys/mips/include/pte.h Tue Oct 22 20:58:23 2013 (r256933) >> +++ head/sys/mips/include/pte.h Tue Oct 22 21:06:27 2013 (r256934) >> @@ -56,16 +56,26 @@ typedef pt_entry_t *pd_entry_t; >> #define TLBMASK_MASK ((PAGE_MASK >> TLBMASK_SHIFT) << >> TLBMASK_SHIFT) >> >> /* >> - * PFN for EntryLo register. Upper bits are 0, which is to say that >> - * bit 28 is the last hardware bit; Bits 29 and upwards (EntryLo is >> - * 64 bit though it can be referred to in 32-bits providing 3 software >> - * bits safely. We use it as 64 bits to get many software bits, and >> - * god knows what else.) are unacknowledged by hardware. They may be >> - * written as anything, but otherwise they have as much meaning as >> - * other 0 fields. >> + * FreeBSD/mips page-table entries take a near-identical format to MIPS >> TLB >> + * entries, each consisting of two 32-bit or 64-bit values ("EntryHi" and >> + * "EntryLo"). MIPS4k and MIPS64 both define certain bits in TLB >> entries as >> + * reserved, and these must be zero-filled by software. We overload >> these >> + * bits in PTE entries to hold PTE_ flags such as RO, W, and MANAGED. >> + * However, we must mask these out when writing to TLB entries to ensure >> that >> + * they do not become visible to hardware -- especially on MIPS64r2 >> which has >> + * an extended physical memory space. >> + * >> + * When using n64 and n32, shift software-defined bits into the MIPS64r2 >> + * reserved range, which runs from bit 55 ... 63. In other >> configurations >> + * (32-bit MIPS4k and compatible), shift them out to bits 29 ... 31. >> + * >> + * NOTE: This means that for 32-bit use of CP0, we aren't able to set >> the top >> + * bit of PFN to a non-zero value, as software is using it! This >> physical >> + * memory size limit may not be sufficiently enforced elsewhere. >> */ >> #if defined(__mips_n64) || defined(__mips_n32) /* PHYSADDR_64_BIT */ >> -#define TLBLO_SWBITS_SHIFT (34) >> +#define TLBLO_SWBITS_SHIFT (55) >> +#define TLBLO_SWBITS_CLEAR_SHIFT (9) >> #define TLBLO_PFN_MASK 0x3FFFFFFC0ULL >> #else >> #define TLBLO_SWBITS_SHIFT (29) >> @@ -133,6 +143,9 @@ typedef pt_entry_t *pd_entry_t; >> * listen to requests to write to it. >> * W: Wired. ??? >> * MANAGED:Managed. This PTE maps a managed page. >> + * >> + * These bits should not be written into the TLB, so must first be >> masked out >> + * explicitly in C, or using CLEAR_PTE_SWBITS() in assembly. >> */ >> #define PTE_RO ((pt_entry_t)0x01 << >> TLBLO_SWBITS_SHIFT) >> #define PTE_W ((pt_entry_t)0x02 << >> TLBLO_SWBITS_SHIFT) >> @@ -162,7 +175,7 @@ typedef pt_entry_t *pd_entry_t; >> #define PTESIZE 4 >> #define PTE_L lw >> #define PTE_MTC0 mtc0 >> -#define CLEAR_PTE_SWBITS(r) sll r, 3; srl r, 3 /* remove 3 >> high bits */ >> +#define CLEAR_PTE_SWBITS(r) LONG_SLL r, >> TLBLO_SWBITS_CLEAR_SHIFT; LONG_SRL r, TLBLO_SWBITS_CLEAR_SHIFT /* remove >> swbits */ >> #endif /* defined(__mips_n64) || defined(__mips_n32) */ >> >> #if defined(__mips_n64) >> > >