From owner-freebsd-arm@freebsd.org Thu Dec 15 20:09:10 2016 Return-Path: Delivered-To: freebsd-arm@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 87D5BC815D7 for ; Thu, 15 Dec 2016 20:09:10 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6593B984 for ; Thu, 15 Dec 2016 20:09:10 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 5e6c6a55-c302-11e6-9f67-d3961ed5a660 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 5e6c6a55-c302-11e6-9f67-d3961ed5a660; Thu, 15 Dec 2016 20:09:22 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id uBFK964l001746; Thu, 15 Dec 2016 13:09:06 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1481832546.1972.31.camel@freebsd.org> Subject: Re: Cubieboard2 with custom bootloader From: Ian Lepore To: Emmanuel Vadot Cc: Nicolae-Alexandru Ivan , freebsd-arm@freebsd.org Date: Thu, 15 Dec 2016 13:09:06 -0700 In-Reply-To: <20161215210115.b224a164cb32abef56b86e7d@bidouilliste.com> References: <20161212160553.dee9d435125f9c6b67355d21@bidouilliste.com> <20161215123900.f141d13bd9814d43feb3f736@bidouilliste.com> <20161215133505.a7ffa64924f3be052840b828@bidouilliste.com> <1481817793.1972.2.camel@freebsd.org> <20161215194847.efbfcd94694e6c71dacdc16a@bidouilliste.com> <1481831623.1972.24.camel@freebsd.org> <20161215210115.b224a164cb32abef56b86e7d@bidouilliste.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Dec 2016 20:09:10 -0000 On Thu, 2016-12-15 at 21:01 +0100, Emmanuel Vadot wrote: > On Thu, 15 Dec 2016 12:53:43 -0700 > Ian Lepore wrote: > > > > > On Thu, 2016-12-15 at 19:48 +0100, Emmanuel Vadot wrote: > > > > > > On Thu, 15 Dec 2016 09:03:13 -0700 > > > Ian Lepore wrote: > > > > > > > > > > > > > > > On Thu, 2016-12-15 at 13:35 +0100, Emmanuel Vadot wrote: > > > > > > > > > > > > > > > On Thu, 15 Dec 2016 14:26:48 +0200 > > > > > Nicolae-Alexandru Ivan wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  For 1 and 2, as Ganbold said ubldr is broken since clang > > > > > > > 3.9 > > > > > > > import > > > > > > > (well only ubldr.bin for me ...) > > > > > > >  For 3 and 4 I've never tested booting kernel directly, > > > > > > > I'll > > > > > > > try > > > > > > > that. > > > > > > >  Does your kernel have a static dtb compiled in ? > > > > > > Yes, we included the device tree in the kernel binary. > > > > > > The options below are included in our conf. > > > > > > > > > > > > #FDT > > > > > > options FDT > > > > > > options FDT_DTB_STATIC > > > > > > makeoptions FDT_DTS_FILE=cubieboard2.dts > > > > >  Oh I might now, my patches introduce a FreeBSD option for > > > > > uboot > > > > > that > > > > > disable the dcache while it's strictly disable in the ports. > > > > >  Do a gmake menuconfig in uboot before compiling but after > > > > > gmake > > > > > cubieboard2_defconfig to enable this. > > > > > > > > > It shouldn't be necessary to disable dcache, but it does need > > > > to be > > > > flushed before launching ubldr or the kernel; especially, it > > > > needs > > > > the > > > > icache sync'd.  The stock uboot does the needed cache work only > > > > in > > > > the > > > > path that launches linux that has been packaged as an image > > > > file > > > > (and > > > > before launching vxworks I think).  For freebsd the needed > > > > cache > > > > ops > > > > must be patched into two places, the bootelf path and the go > > > > path. > > > > > > > > -- Ian > > >  Well the dcache has been strictly disabled in most of our port > > > for > > > quite some times now. > > >  I'll run some test so see if it's still needed and update the > > > port > > > if > > > it's not. > > >  And it raise a question: Why couldn't we flush the dcache at the > > > start > > > of ubldr for arm if it's needed ? > > >  I'm gonna try to upstream by "FreeBSD config" v2 patches soon so > > > I > > > want to do it right. > > > > > Dcache has been enabled in the uboot ports I was taking care of for > > a > > long time; any of those ports have the needed patches for cache > > maintenance before launching ubldr or the kernel.  See for example > > u- > > boot-rpi, the patches for cmd_boot and cmd_elf. >  Yes I've seen that, I'll confirm that it isn't needed on Allwinner > and > do some patch. > > > > > The cache maintenance must be done *before* jumping to the ubldr or > > kernel entry point, or else it's possible to jump to bad code > > (stale > > cached data) that hangs or crashes. >  Ok, so newbie question on cache here, why does Linux doesn't need > this ? and what can we do (if possible) to avoid the need of cache > flush ? > I should mention, btw, that enabling the cache does make a huge difference.  For a wandboard with caches disabled, loading and launching the kernel takes 8 or 9 seconds, with dcache enabled it's less than 1 second. -- Ian