Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753204AbbEKWaQ (ORCPT ); Mon, 11 May 2015 18:30:16 -0400 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:38084 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751310AbbEKWaN (ORCPT ); Mon, 11 May 2015 18:30:13 -0400 Date: Mon, 11 May 2015 23:29:55 +0100 From: Russell King - ARM Linux To: Sjoerd Simons Cc: Rob Herring , Tony Lindgren , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Javier Martinez Canillas Subject: Re: [PATCH 1/3] ARM: cache-l2c: Add flag to skip cache unlocking Message-ID: <20150511222955.GK2067@n2100.arm.linux.org.uk> References: <1431382651-15894-1-git-send-email-sjoerd.simons@collabora.co.uk> <1431382651-15894-2-git-send-email-sjoerd.simons@collabora.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1431382651-15894-2-git-send-email-sjoerd.simons@collabora.co.uk> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2284 Lines: 57 On Tue, May 12, 2015 at 12:17:29AM +0200, Sjoerd Simons wrote: > The L2C cache should only be unlocked when the cache is setup to allow > that. In the common case the l2x0 driver sets up the cache for that to > be the case (e.g. setting L310_AUX_CTRL_NS_LOCKDOWN on L2C-310), making > unlock safe. However when a secure firmware is in use, it may not be > possible for the L2c to be configured that way making unlocking unsafe. > > To handle that case add a flag to skip unlocking the cache for machine > where this can't be done safely. > > Signed-off-by: Sjoerd Simons > --- > arch/arm/include/asm/outercache.h | 1 + > arch/arm/mm/cache-l2x0.c | 4 +++- > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/include/asm/outercache.h b/arch/arm/include/asm/outercache.h > index 563b92f..d07ca82 100644 > --- a/arch/arm/include/asm/outercache.h > +++ b/arch/arm/include/asm/outercache.h > @@ -39,6 +39,7 @@ struct outer_cache_fns { > /* This is an ARM L2C thing */ > void (*write_sec)(unsigned long, unsigned); > void (*configure)(const struct l2x0_regs *); > + bool skip_unlock; > }; > > extern struct outer_cache_fns outer_cache; > diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c > index e309c8f..fff7888 100644 > --- a/arch/arm/mm/cache-l2x0.c > +++ b/arch/arm/mm/cache-l2x0.c > @@ -136,7 +136,8 @@ static void l2c_enable(void __iomem *base, u32 aux, unsigned num_lock) > l2x0_saved_regs.aux_ctrl = aux; > l2c_configure(base); > > - l2c_unlock(base, num_lock); > + if (!outer_cache.skip_unlock) > + l2c_unlock(base, num_lock); I think we can do better here. If the non-secure lockdown access bit has been set, then proceed with the unlock: if (readl_relaxed(base + L2X0_AUX_CTRL) & L310_AUX_CTRL_NS_LOCKDOWN) l2c_unlock(base, num_lock); I don't see any need to add a flag for this. This also eliminates your second patch. -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/