From patchwork Wed Jul 18 19:59:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 10533177 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 05429600F4 for ; Wed, 18 Jul 2018 20:00:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA9AA29CE7 for ; Wed, 18 Jul 2018 20:00:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE68429CED; Wed, 18 Jul 2018 20:00:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 77A5529CE7 for ; Wed, 18 Jul 2018 20:00:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=B+Jtesla7pvO+2OESTr4Nhgx4qsaPqaJdCgtObPb2FA=; b=ghd 0UMu5UoRjxaWY9HWEvgFKwyTc5vFCIs1COVHBk9FnymgFWrdreVjEwoxEGmiwHD765cG6PLbFHAe1 d6LXrgJFfmudwwFIJKdg8ko//lk0v80fWliUSy4aJ6Eaw4gOmxDUUJDfTkZBEVO0O/mKOojnyLTNz bsINgrpZ4J1Oy7ggB6Vw3rXkeLLP8Mwc18nfRh7442S3r0nIBX2A4ckgVQGIbmAdpXfHIthkSEfrM TfHJRPkYYrT/Tgq9ed6FMpihAfBkNjqzGuvMvir8lkRFne1EHU/J+lkQhBfbucnKske2GBbFL5mmz TSOFn6Yu+3/+/zx32SCvx6OwTgz8LVA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ffscR-0007hA-Rc; Wed, 18 Jul 2018 20:00:15 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ffscO-0006dZ-Un for linux-arm-kernel@lists.infradead.org; Wed, 18 Jul 2018 20:00:14 +0000 Received: from localhost.localdomain (xdsl-188-155-58-14.adslplus.ch [188.155.58.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8215C2075E; Wed, 18 Jul 2018 19:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531944002; bh=Ig8IrYTGzMScTYPsqPbbWdZ1SYiNc6j6Lg7O1nRmCzs=; h=From:To:Cc:Subject:Date:From; b=Q71qw1u+oVoTujJAnH8FKc5ioIpUhOBl5Metv+0PYzFv1Iu8UKCgXXUD2a7Qst3hX IpLeKxErcEm/LVRq7t+2ReHBUeyTv6VK5y8y2WkXlhW48EUW04DPw0r3y7JlCxC1Zu 1kGJkwx2NqDNoXK8wD0l6405sw7QtpdjVULEdQI0= From: Krzysztof Kozlowski To: Kukjin Kim , Krzysztof Kozlowski , Russell King , Marek Szyprowski , Pankaj Dubey , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC] ARM: exynos: Fix imprecise abort during Exynos5422 suspend to RAM Date: Wed, 18 Jul 2018 21:59:29 +0200 Message-Id: <20180718195929.5852-1-krzk@kernel.org> X-Mailer: git-send-email 2.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180718_130013_044195_1D925084 X-CRM114-Status: GOOD ( 14.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chanwoo Choi , Alim Akhtar , Bartlomiej Zolnierkiewicz MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Suspend to RAM on Odroid XU3/XU4/HC1 family (Exynos5422) causes imprecise abort: PM: Syncing filesystems ... done. Freezing user space processes ... (elapsed 0.003 seconds) done. OOM killer disabled. Freezing remaining freezable tasks ... (elapsed 0.003 seconds) done. wake enabled for irq 139 Disabling non-boot CPUs ... IRQ51 no longer affine to CPU1 IRQ52 no longer affine to CPU2 IRQ53 no longer affine to CPU3 IRQ54 no longer affine to CPU4 IRQ55 no longer affine to CPU5 IRQ56 no longer affine to CPU6 cpu cpu4: Dropping the link to regulator.40 IRQ57 no longer affine to CPU7 Unhandled fault: external abort on non-linefetch (0x1008) at 0xf081a028 Internal error: : 1008 [#1] PREEMPT SMP ARM with last call trace in exynos_suspend_enter(). The abort is caused by writing to register in secure part of sysram. All Exynos5422 devices, including Hardkernel Odroid boards, boot with TrustZone in non-secure mode therefore they should access non-secure sysram. Signed-off-by: Krzysztof Kozlowski --- Comments, whether my understanding is correct, are welcomed! --- Documentation/arm/Samsung/Bootloader-interface.txt | 1 + arch/arm/mach-exynos/suspend.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/arm/Samsung/Bootloader-interface.txt b/Documentation/arm/Samsung/Bootloader-interface.txt index ed494ac0beb2..d17ed518a7ea 100644 --- a/Documentation/arm/Samsung/Bootloader-interface.txt +++ b/Documentation/arm/Samsung/Bootloader-interface.txt @@ -26,6 +26,7 @@ Offset Value Purpose 0x20 0xfcba0d10 (Magic cookie) AFTR 0x24 exynos_cpu_resume_ns AFTR 0x28 + 4*cpu 0x8 (Magic cookie, Exynos3250) AFTR +0x28 0x0 or last value during resume (Exynos542x) System suspend 2. Secure mode diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c index d3db306a5a70..0ec52f442b97 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c @@ -256,7 +256,7 @@ static int exynos5420_cpu_suspend(unsigned long arg) unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); - writel_relaxed(0x0, sysram_base_addr + EXYNOS5420_CPU_STATE); + writel_relaxed(0x0, sysram_ns_base_addr + EXYNOS5420_CPU_STATE); if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM)) { mcpm_set_entry_vector(cpu, cluster, exynos_cpu_resume); @@ -328,7 +328,7 @@ static void exynos5420_pm_prepare(void) * needs to restore it back in case, the primary cpu fails to * suspend for any reason. */ - exynos5420_cpu_state = readl_relaxed(sysram_base_addr + + exynos5420_cpu_state = readl_relaxed(sysram_ns_base_addr + EXYNOS5420_CPU_STATE); exynos_pm_enter_sleep_mode(); @@ -448,7 +448,7 @@ static void exynos5420_pm_resume(void) /* Restore the sysram cpu state register */ writel_relaxed(exynos5420_cpu_state, - sysram_base_addr + EXYNOS5420_CPU_STATE); + sysram_ns_base_addr + EXYNOS5420_CPU_STATE); pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL, S5P_CENTRAL_SEQ_OPTION);