From patchwork Thu Jan 2 23:08:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 3427771 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0D23EC02DC for ; Thu, 2 Jan 2014 23:09:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 313C120148 for ; Thu, 2 Jan 2014 23:09:14 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D6B120136 for ; Thu, 2 Jan 2014 23:09:13 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VyrNz-00045q-5i; Thu, 02 Jan 2014 23:09:07 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VyrNw-0000yR-Mj; Thu, 02 Jan 2014 23:09:04 +0000 Received: from quartz.orcorp.ca ([184.70.90.242]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VyrNt-0000xn-Th for linux-arm-kernel@lists.infradead.org; Thu, 02 Jan 2014 23:09:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=obsidianresearch.com; s=rsa1; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=Hvah4lBvilLvVfjUYCO9rmdqADu7gcIdXIHUrrNs0+8=; b=I0Pvi0L7ZsPP8TPSUponWiYZqAVRT+q3xvoEEtCFMAlSUrnZjDqI3MuO+90NBEhBryYJ1HxxuRFmNHZy+pX74XnEgQXVV5Ds4EGBRAfb/xcLtotPUNxIz1hSE9OmpLC0rarMOZS17VyL4KNra2QV5+UYAp4u1tdyvucBS/6LD10=; Received: from [10.0.0.161] (helo=jggl.edm.orcorp.ca) by quartz.orcorp.ca with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1VyrNQ-0003w0-Hr; Thu, 02 Jan 2014 16:08:32 -0700 Received: from jgg by jggl.edm.orcorp.ca with local (Exim 4.80) (envelope-from ) id 1VyrNQ-000364-6M; Thu, 02 Jan 2014 16:08:32 -0700 Date: Thu, 2 Jan 2014 16:08:32 -0700 From: Jason Gunthorpe To: Ian Campbell Subject: Re: [PATCH] ARM: Kirkwood: Add support for Excito Bubba B3 Message-ID: <20140102230832.GB9339@obsidianresearch.com> References: <1388247131-19301-1-git-send-email-andrew@lunn.ch> <20131228170114.GH19878@titan.lakedaemon.net> <20140102194924.GA3321@obsidianresearch.com> <1388702192.16958.54.camel@hastur.hellion.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1388702192.16958.54.camel@hastur.hellion.org.uk> User-Agent: Mutt/1.5.21 (2010-09-15) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.161 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140102_180902_125507_4447A5CF X-CRM114-Status: GOOD ( 28.17 ) X-Spam-Score: -2.0 (--) Cc: Gregory Clement , Andrew Lunn , Sebastian Hesselbarth , Jason Cooper , linux ARM X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Jan 02, 2014 at 10:36:32PM +0000, Ian Campbell wrote: > On Thu, 2014-01-02 at 12:49 -0700, Jason Gunthorpe wrote: > > On Sat, Dec 28, 2013 at 12:01:14PM -0500, Jason Cooper wrote: > > > > > > + * Note: This requires a new'ish version of u-boot, which disables the > > > > + * L2 cache. If your B3 silently fails to boot, u-boot is probably too > > > > + * old. Either upgrade, or consider the following email: > > > > + * > > > > + * http://lists.debian.org/debian-arm/2012/08/msg00128.html > > > > > > Nice, thanks for adding this. > > > > Nifty.. But what is the root cause for the above? > > > > I'm guessing that at some point the the L1 icache has been enabled, > > the L1 dcache disabled, and the L2 cache enabled? > > > > If the pv_fixup runs with both L1 caches off and an empty L2 then it > > shouldn't cause a problem. > > I'm not 100% sure but I think the issue is that the kernel expects to be > running with all of the caches off, but u-boot incorrectly left the l2 > on. The L2 is probably not empty (because u-boot was using it). I think I see the problem now.. The decompressor turns on the L1 dcache, which populates the enabled L2 with write through data. When the decompressor turns the dcache off again the L2 retains some of the kernel image and any data writes done in head.S while the dcache is off could be corrupted if they overlap the L2's retention, specifically the pv_fixup stuff, but other elements could potentially be mangled too. So all Marvell platforms with their L2 cache controller must boot into the decompressor with the L2 cache completely off, or the kernel needs additional Marvell L2 specific flushing code prior to enabling the MMU :( .. and since the problem only shows obviously with multiplatform kernels that have been relocated it could be a broader, subtler issue than just your one board ... Jason C: What do you think about applying this [untested]? Or do you think the kernel should support booting with L2 on (this is just two instructions, but they need to be conditional on the CPU type :( :( )? ----- arm: Kirkwood: Log a FW_BUG if the L2 cache is turned on at boot Linux can't cope if the the L2 cache is enabled at boot. It works sometimes, if the data writes head.S does during the L1 cache-off period do not overlap with lines in the L2. This is unlikely if CONFIG_ARM_PATCH_PHYS_VIRT is used, as the decompressor will pull a chunk of the kernel code into L2 cache. Signed-off-by: Jason Gunthorpe Jason diff --git a/arch/arm/mm/cache-feroceon-l2.c b/arch/arm/mm/cache-feroceon-l2.c index 48bc3c0..68781a4 100644 --- a/arch/arm/mm/cache-feroceon-l2.c +++ b/arch/arm/mm/cache-feroceon-l2.c @@ -331,7 +331,8 @@ static void __init enable_l2(void) enable_icache(); if (d) enable_dcache(); - } + } else + pr_err(FW_BUG "Feroceon L2: bootloader left the L2 cache on!\n"); } void __init feroceon_l2_init(int __l2_wt_override)