From patchwork Wed Oct 29 09:23:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 39732 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9A9E824046 for ; Wed, 29 Oct 2014 09:25:51 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id n15sf1423891lbi.2 for ; Wed, 29 Oct 2014 02:25:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=es5kBZARETy9JGbTw5ZkoiY2JP+mcUolcOrQ29lG6h0=; b=evQJEAPBBnkVn5OmKG2lu2n5FjwgztYKJ30ruzzLADrPeBUlqEFrnrXSaPOriEjO+Y usRMVC0q8I3pedjjJc6ars393pyRw6jqEJC43YD+vwb4hNHi0xUGXYPatw1oWqCrYwnw An1hxfr9cXmikvXMQV1DnyTgxwcPGQEVSY4OpO5fXhIcHQ3CzR4iHZ/pg5Emup/Ggfxr nznQkWTngiEFldwPKcJhht6ntIqaETgZ8/nxbnrRp2/KE/rV2UVE2b5VqqHIZoLVkzJe 3xl80eC3U9sGjpb1kisa3RSPWHLPE/a7DyoLSugNYLk8zZubQv4L8vVSxfWKjMl/zjL6 ANog== X-Gm-Message-State: ALoCoQktqWK5/j4E46Ym6I4tiVguqZ7Q6IRxi4EnfKV1ZRat4G09ntkty4zne4w7fpTsCjNNlhtW X-Received: by 10.112.26.82 with SMTP id j18mr177114lbg.16.1414574750465; Wed, 29 Oct 2014 02:25:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.72 with SMTP id q8ls137397laq.98.gmail; Wed, 29 Oct 2014 02:25:50 -0700 (PDT) X-Received: by 10.112.173.199 with SMTP id bm7mr9953975lbc.54.1414574750323; Wed, 29 Oct 2014 02:25:50 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id uc5si6366803lbb.31.2014.10.29.02.25.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Oct 2014 02:25:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id z11so131099lbi.35 for ; Wed, 29 Oct 2014 02:25:50 -0700 (PDT) X-Received: by 10.153.8.164 with SMTP id dl4mr9972298lad.29.1414574749970; Wed, 29 Oct 2014 02:25:49 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp624999lbz; Wed, 29 Oct 2014 02:25:49 -0700 (PDT) X-Received: by 10.68.101.98 with SMTP id ff2mr9384628pbb.74.1414574748287; Wed, 29 Oct 2014 02:25:48 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id d13si3641251pat.20.2014.10.29.02.25.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Oct 2014 02:25:48 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; 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 1XjPUS-0002T9-EI; Wed, 29 Oct 2014 09:24:28 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XjPTc-00021R-Gp for linux-arm-kernel@lists.infradead.org; Wed, 29 Oct 2014 09:23:37 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NE70048B8VHUC60@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 29 Oct 2014 09:26:05 +0000 (GMT) X-AuditID: cbfec7f4-b7f6c6d00000120b-ed-5450b2019a04 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 1C.04.04619.102B0545; Wed, 29 Oct 2014 09:23:13 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NE700DWE8QECT50@eusync1.samsung.com>; Wed, 29 Oct 2014 09:23:13 +0000 (GMT) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v7 7/8] ARM: EXYNOS: Add support for non-secure L2X0 resume Date: Wed, 29 Oct 2014 10:23:00 +0100 Message-id: <1414574581-2320-8-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1414574581-2320-1-git-send-email-m.szyprowski@samsung.com> References: <1414574581-2320-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMLMWRmVeSWpSXmKPExsVy+t/xy7qMmwJCDM7MZrR4NP8xs0Xvgqts Fmeb3rBbbO+cwW4x5c9yJotNj6+xWlzeNYfNYvaSfhaLGef3MVncvsxrcW77FhaLtUfuslss vX6RyWLVrj+MFvuveDnwe6yZt4bRo6W5h83j29dJLB6X+3qZPBZ9z/LYOesuu8eda3vYPDYv qffo27KK0ePzJrkArigum5TUnMyy1CJ9uwSujPf3fzEX7BWouHDiPlMD4ybeLkZODgkBE4n3 65+zQthiEhfurWfrYuTiEBJYyiixfs85sISQQB+TxLVWfxCbTcBQouttFxuILSKQLfHj22QW kAZmgT5mifPTe5hBEsIC3hK3p/8Fa2YRUJVoW9UJZvMKuEss3j6PBWKbnMT/lyuYQGxOAQ+J 1ReWsEEsc5fYeLibbQIj7wJGhlWMoqmlyQXFSem5hnrFibnFpXnpesn5uZsYIQH9ZQfj4mNW hxgFOBiVeHg1dvuHCLEmlhVX5h5ilOBgVhLh3WEeECLEm5JYWZValB9fVJqTWnyIkYmDU6qB sdVs89OKVb+7dqxQMo1m7F5SXuUgfOQF440r4WUR25M37nvp9F1JWcvLPuXU0u6k33enPZzL VWzAf6anyPhYUs3ttJ1fSiebFrU0/eJo5lPwjqu7ou/jGH/XKv69YavU66en2Ni/H9sde5pn UfKy69+erdRI97HtzXNa3Ougx2hzU7NZ+ji7EktxRqKhFnNRcSIAOb75/UYCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141029_022336_780861_C6F544BE X-CRM114-Status: UNSURE ( 9.61 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.6 (-----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-5.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [210.118.77.13 listed in wl.mailspike.net] -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [210.118.77.13 listed in list.dnswl.org] -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Mark Rutland , Kukjin Kim , lauraa@codeaurora.org, tony@atomide.com, linus.walleij@linaro.org, Tomasz Figa , drake@endlessm.com, loeliger@gmail.com, Kyungmin Park , Russell King - ARM Linux , linux-omap@vger.kernel.org, Marek Szyprowski 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+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Tomasz Figa On Exynos SoCs it is necessary to resume operation of L2C early in assembly code, because otherwise certain systems will crash. This patch adds necessary code to non-secure resume handler. Signed-off-by: Tomasz Figa [rewrote the code accessing l2x0_saved_regs] Sigend-off-by: Marek Szyprowski --- arch/arm/mach-exynos/sleep.S | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/arch/arm/mach-exynos/sleep.S b/arch/arm/mach-exynos/sleep.S index e3c373082bbe..31d25834b9c4 100644 --- a/arch/arm/mach-exynos/sleep.S +++ b/arch/arm/mach-exynos/sleep.S @@ -16,6 +16,8 @@ */ #include +#include +#include #include "smc.h" #define CPU_MASK 0xff0ffff0 @@ -74,6 +76,45 @@ ENTRY(exynos_cpu_resume_ns) mov r0, #SMC_CMD_C15RESUME dsb smc #0 +#ifdef CONFIG_CACHE_L2X0 + adr r0, 1f + ldr r2, [r0] + add r0, r2, r0 + + /* Check that the address has been initialised. */ + ldr r1, [r0, #L2X0_R_PHY_BASE] + teq r1, #0 + beq skip_l2x0 + + /* Check if controller has been enabled. */ + ldr r2, [r1, #L2X0_CTRL] + tst r2, #0x1 + bne skip_l2x0 + + ldr r1, [r0, #L2X0_R_TAG_LATENCY] + ldr r2, [r0, #L2X0_R_DATA_LATENCY] + ldr r3, [r0, #L2X0_R_PREFETCH_CTRL] + mov r0, #SMC_CMD_L2X0SETUP1 + smc #0 + + /* Reload saved regs pointer because smc corrupts registers. */ + adr r0, 1f + ldr r2, [r0] + add r0, r2, r0 + + ldr r1, [r0, #L2X0_R_PWR_CTRL] + ldr r2, [r0, #L2X0_R_AUX_CTRL] + mov r0, #SMC_CMD_L2X0SETUP2 + smc #0 + + mov r0, #SMC_CMD_L2X0INVALL + smc #0 + + mov r1, #1 + mov r0, #SMC_CMD_L2X0CTRL + smc #0 +skip_l2x0: +#endif /* CONFIG_CACHE_L2X0 */ skip_cp15: b cpu_resume ENDPROC(exynos_cpu_resume_ns) @@ -83,3 +124,8 @@ cp15_save_diag: .globl cp15_save_power cp15_save_power: .long 0 @ cp15 power control + +#ifdef CONFIG_CACHE_L2X0 + .align +1: .long l2x0_saved_regs - . +#endif /* CONFIG_CACHE_L2X0 */