From owner-freebsd-arm@FreeBSD.ORG Sun Feb 2 23:30:53 2014 Return-Path: Delivered-To: freebsd-arm@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 ESMTPS id 6BC4BBE; Sun, 2 Feb 2014 23:30:53 +0000 (UTC) Received: from raven.bwct.de (raven.bwct.de [85.159.14.73]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E8A471107; Sun, 2 Feb 2014 23:30:52 +0000 (UTC) Received: from mail.cicely.de ([10.1.1.37]) by raven.bwct.de (8.13.4/8.13.4) with ESMTP id s12N52Y7020540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 3 Feb 2014 00:05:03 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (cicely7.cicely.de [10.1.1.9]) by mail.cicely.de (8.14.5/8.14.4) with ESMTP id s12N4o3F078106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 3 Feb 2014 00:04:50 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (localhost [127.0.0.1]) by cicely7.cicely.de (8.14.2/8.14.2) with ESMTP id s12N4o4A042392; Mon, 3 Feb 2014 00:04:50 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: (from ticso@localhost) by cicely7.cicely.de (8.14.2/8.14.2/Submit) id s12N4o2j042391; Mon, 3 Feb 2014 00:04:50 +0100 (CET) (envelope-from ticso) Date: Mon, 3 Feb 2014 00:04:50 +0100 From: Bernd Walter To: Ian Lepore Subject: Re: wandboard / imx6 / exynos4 / cortex-a9 "wrong-endian bug" fixed Message-ID: <20140202230450.GA42331@cicely7.cicely.de> References: <1391371204.13026.43.camel@revolution.hippie.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1391371204.13026.43.camel@revolution.hippie.lan> X-Operating-System: FreeBSD cicely7.cicely.de 7.0-STABLE i386 User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED=-1, BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 autolearn=unavailable version=3.3.0 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on spamd.cicely.de Cc: freebsd-arm , Bernd Walter X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: ticso@cicely.de List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Feb 2014 23:30:53 -0000 On Sun, Feb 02, 2014 at 01:00:04PM -0700, Ian Lepore wrote: > As some of you know from previous email or irc conversations, I've been > chasing a strange bug for months that affects some cortex-a9 chips, > which I've been calling the "wrong-endian bug", where some registers get > restored with wrong-endian values on return from an interrupt, leading > to a panic or crash during boot. This is very great news and a pretty amazing job to find this. Thank you very much! In the end it also exaplains the tempeerature dependency on the Wandboards and why it always happened on my MarSboard. Unfortunately I'm still time contrained, but likely I will at least find enough time to do some tests on my iMX6 board collection next weekend. I'm especially curious about the MarSboard, which never booted without the panic. > I finally tracked the cause down to our gnu assembler (gas), which > apparently thinks that when you say "msr spsr_all, r0" what you meant by > "_all" was "only restore 16 of the 32 bits". It's not a bug per se, > it's just how the gas authors think the assembler should behave. So, > when the chip powers on there may be some garbage bits in the spsr > register, and they would never get cleared out because only some of the > bits would get restored, and if the big-endian bit was among them Bad > Things Happened. I'm not sure why this only affected some cortex-a9 > chips such as imx6, but maybe some chips set those registers to zero and > some don't at power-on. > > I fixed the problem by updating our source code to use the newer arm > instruction syntax for msr and msr instructions, which ensures all 32 > bits get restored. That change happened in r261393, but because of > other changes and churn in the tree the first really stable revision > that includes the fix is r261410. So if you're working with wandboard > or another imx6-based system, please make sure to update to this rev. > > -- Ian > > -- B.Walter http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.