From patchwork Mon May 11 22:17:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sjoerd Simons X-Patchwork-Id: 6384461 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5D920BEEE1 for ; Mon, 11 May 2015 22:21:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8DDFE2028D for ; Mon, 11 May 2015 22:21:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 BC62D2026F for ; Mon, 11 May 2015 22:20:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yrw2F-0005f5-Rz; Mon, 11 May 2015 22:18:51 +0000 Received: from bhuna.collabora.co.uk ([93.93.135.160]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yrw1P-0005CH-Ui for linux-arm-kernel@lists.infradead.org; Mon, 11 May 2015 22:18:01 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sjoerd) with ESMTPSA id 84EFC6007CB Received: by dusk.luon.net (Postfix, from userid 1000) id AF12921B91; Tue, 12 May 2015 00:17:31 +0200 (CEST) From: Sjoerd Simons To: Rob Herring , Russell King , Tony Lindgren Subject: [PATCH 1/3] ARM: cache-l2c: Add flag to skip cache unlocking Date: Tue, 12 May 2015 00:17:29 +0200 Message-Id: <1431382651-15894-2-git-send-email-sjoerd.simons@collabora.co.uk> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431382651-15894-1-git-send-email-sjoerd.simons@collabora.co.uk> References: <1431382651-15894-1-git-send-email-sjoerd.simons@collabora.co.uk> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150511_151800_175677_CE7E1EE5 X-CRM114-Status: GOOD ( 15.39 ) X-Spam-Score: -0.0 (/) Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Javier Martinez Canillas X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, 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 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); local_irq_save(flags); __l2c_op_way(base + L2X0_INV_WAY); @@ -849,6 +850,7 @@ static int __init __l2c_init(const struct l2c_init_data *data, fns = data->outer_cache; fns.write_sec = outer_cache.write_sec; fns.configure = outer_cache.configure; + fns.skip_unlock = outer_cache.skip_unlock; if (data->fixup) data->fixup(l2x0_base, cache_id, &fns);