From patchwork Fri Mar 21 14:03:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 3874581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 88F0B9F370 for ; Fri, 21 Mar 2014 14:04:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 18EB820279 for ; Fri, 21 Mar 2014 14:04:21 +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 89FFE20213 for ; Fri, 21 Mar 2014 14:04:19 +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 1WR03N-0006z7-S0; Fri, 21 Mar 2014 14:04:09 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WR03L-0006rj-Jx; Fri, 21 Mar 2014 14:04:07 +0000 Received: from pandora.arm.linux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WR03I-0006qq-8y for linux-arm-kernel@lists.infradead.org; Fri, 21 Mar 2014 14:04:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=CSzk8dRPUYrfabThCeEWBPUzhVC8bAbQAxz5iK9fIVM=; b=lec58R0EYak/7oKD63GIiTP19gvc1lFmsGoyZJInThPS+7MYDuDnj4MbyZmXQVLOJlA+j3b+vgDn8IeM+/YCbwepIh5/H+XwLJ4wIZqcu+0gxEr9dKvy0zzu3Fb35lK708WGEcqzQVv8StgN0zgGhZv3OtoCZI8iijYlPzxTSIc=; Received: from n2100.arm.linux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:54324) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1WR02X-0005Xx-RH; Fri, 21 Mar 2014 14:03:18 +0000 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1WR02P-0005l9-JW; Fri, 21 Mar 2014 14:03:09 +0000 Date: Fri, 21 Mar 2014 14:03:09 +0000 From: Russell King - ARM Linux To: Linus Walleij Subject: Re: [PATCH] ARM: ux500: remove pointless cache setup args Message-ID: <20140321140308.GJ7528@n2100.arm.linux.org.uk> References: <1395410113-19965-1-git-send-email-linus.walleij@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1395410113-19965-1-git-send-email-linus.walleij@linaro.org> User-Agent: Mutt/1.5.19 (2009-01-05) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140321_100404_776530_BBC3E2C3 X-CRM114-Status: GOOD ( 22.77 ) X-Spam-Score: -2.0 (--) Cc: linux-arm-kernel@lists.infradead.org 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Fri, Mar 21, 2014 at 02:55:13PM +0100, Linus Walleij wrote: > This removes the setup of the l2x0 lines that are essentially > just noops bouncing on the hardware as the cache registers are > protected in the secure world and there is no point in writing > them. Put in (0, ~0) to the l2x0_of_init() function as > suggested by Russell and cut the complex code out. > > Reported-by: Russell King > Signed-off-by: Linus Walleij > --- > Russell: I don't know how this fits with other changes hitting > the l2x0 code, this file is pretty much stand-alone and > orthogonal to any other stuff hitting the Ux500 code, so I > can put it in your patch tracker if you want to take it or > some version of it into your tree. I already have something which does a similar modification. Here's the existing commits in order (copy'n'pasted with gpm so whitespace damaged): Author: Russell King Date: Sun Mar 16 19:15:21 2014 +0000 ARM: l2c: ux500: implement dummy write_sec method ux500 can't write to any of the secure registers on the L2C controllers, so provide a dummy handler which ignores all writes. Signed-off-by: Russell King So the only difference between what you've ended up with is that I've kept the l2x0_base stuff around and the legacy init. If you want the legacy init to be killed, I'd be more than happy to add another patch on top of my existing series to do that. diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.cindex 264f894c0e3d..5cc7e3625d8c 100644 --- a/arch/arm/mach-ux500/cache-l2x0.c +++ b/arch/arm/mach-ux500/cache-l2x0.c @@ -35,6 +35,14 @@ static int __init ux500_l2x0_unlock(void) return 0; } +static void ux500_l2c310_write_sec(unsigned long val, unsigned reg) +{ + /* + * We can't write to secure registers as we are in non-secure + * mode, until we have some SMI service available. + */ +} + static int __init ux500_l2x0_init(void) { u32 aux_val = 0x3e000000; @@ -56,21 +64,14 @@ static int __init ux500_l2x0_init(void) /* 64KB way size */ aux_val |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT); + outer_cache.write_sec = ux500_l2c310_write_sec; + /* 64KB way size, 8 way associativity, force WA */ if (of_have_populated_dt()) l2x0_of_init(aux_val, 0xc0000fff); else l2x0_init(l2x0_base, aux_val, 0xc0000fff); - /* - * We can't disable l2 as we are in non secure mode, currently - * this seems be called only during kexec path. So let's - * override outer.disable with nasty assignment until we have - * some SMI service available. - */ - outer_cache.disable = NULL; - outer_cache.set_debug = NULL; - return 0; } Author: Russell King Date: Sun Mar 16 20:52:25 2014 +0000 ARM: l2c: fix register naming We have a mixture of different devices with different register layouts, but we group all the bits together in an opaque mess. Split them out into those which are L2C-310 specific and ones which refer to earlier devices. Provide full auxiliary control register definitions. Signed-off-by: Russell King diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.cindex 5cc7e3625d8c..067c37a054fb 100644 --- a/arch/arm/mach-ux500/cache-l2x0.c +++ b/arch/arm/mach-ux500/cache-l2x0.c @@ -59,10 +59,10 @@ static int __init ux500_l2x0_init(void) /* DBx540's L2 has 128KB way size */ if (cpu_is_ux540_family()) /* 128KB way size */ - aux_val |= (0x4 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT); + aux_val |= L2C_AUX_CTRL_WAY_SIZE(4); else /* 64KB way size */ - aux_val |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT); + aux_val |= L2C_AUX_CTRL_WAY_SIZE(3); outer_cache.write_sec = ux500_l2c310_write_sec; Author: Russell King Date: Wed Mar 19 01:22:05 2014 +0000 ARM: l2c: ux500: remove associativity and way size from aux_ctrl Signed-off-by: Russell King diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.cindex 067c37a054fb..5b891d051054 100644 --- a/arch/arm/mach-ux500/cache-l2x0.c +++ b/arch/arm/mach-ux500/cache-l2x0.c @@ -45,8 +45,6 @@ static void ux500_l2c310_write_sec(unsigned long val, unsigned static int __init ux500_l2x0_init(void) { - u32 aux_val = 0x3e000000; - if (cpu_is_u8500_family() || cpu_is_ux540_family()) l2x0_base = __io_address(U8500_L2CC_BASE); else @@ -56,21 +54,12 @@ static int __init ux500_l2x0_init(void) /* Unlock before init */ ux500_l2x0_unlock(); - /* DBx540's L2 has 128KB way size */ - if (cpu_is_ux540_family()) - /* 128KB way size */ - aux_val |= L2C_AUX_CTRL_WAY_SIZE(4); - else - /* 64KB way size */ - aux_val |= L2C_AUX_CTRL_WAY_SIZE(3); - outer_cache.write_sec = ux500_l2c310_write_sec; - /* 64KB way size, 8 way associativity, force WA */ if (of_have_populated_dt()) - l2x0_of_init(aux_val, 0xc0000fff); + l2x0_of_init(0x3e000000, 0xc00f0fff); else - l2x0_init(l2x0_base, aux_val, 0xc0000fff); + l2x0_init(l2x0_base, 0x3e000000, 0xc00f0fff); return 0; } Author: Russell King Date: Wed Mar 19 12:47:58 2014 +0000 ARM: l2c: ux500: don't try to change the L2 cache auxiliary control register ux500 can't change the auxiliary control register, so there's no point passing values to try and modify it to the l2x0 init functions. Signed-off-by: Russell King diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.cindex 5b891d051054..842ebedbdd1c 100644 --- a/arch/arm/mach-ux500/cache-l2x0.c +++ b/arch/arm/mach-ux500/cache-l2x0.c @@ -57,9 +57,9 @@ static int __init ux500_l2x0_init(void) outer_cache.write_sec = ux500_l2c310_write_sec; if (of_have_populated_dt()) - l2x0_of_init(0x3e000000, 0xc00f0fff); + l2x0_of_init(0, ~0); else - l2x0_init(l2x0_base, 0x3e000000, 0xc00f0fff); + l2x0_init(l2x0_base, 0, ~0); return 0; }