From patchwork Mon Feb 18 14:34:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 158620 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2563513jaa; Mon, 18 Feb 2019 06:34:27 -0800 (PST) X-Google-Smtp-Source: AHgI3IbGG/rnrWZjTGcsjfz4g+YCoybNxYZ27ZSBjLT3E3RvIpveyoylsCj+OO2lVP2zpifpupOO X-Received: by 2002:a17:902:b904:: with SMTP id bf4mr11325237plb.273.1550500467029; Mon, 18 Feb 2019 06:34:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550500467; cv=none; d=google.com; s=arc-20160816; b=u43U0fIX+Jmd9EXrh00xN9PajrheEFBv7mUptyfYChtY7+8f6JKsyOGrecgkR7gEm/ BM9qsYwWqFxSe3gzzxAolqe3kQPe12i5/0WykIweNOuBnvxO9bC6wDwZMTK9TD73MzX0 K5pPHfM62E/qY7938Trbk7TTXnjtx6HLpPPvTmMmOP/SCXIlTs1s5KiCiV0CD+j0/aBy sL0vBNPB736VgSSq34UyRNfPn+hGjbavTXQ/MrOxDw39O3IrIe+X0Iy8uk3puF3RYe1m H1/ZfM4yjpwWUtB/OG2UW8XmnOjjp5tpswql7w25bsVG7YGK+ZmxJBFo7uYDF82RXO/9 V2yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=CtZaeO6HKavnUMNvWElW4sGJfjbpT1+04kXGfhTWtvQ=; b=vCKhI7wkWHsx17jdsT7/aau9WNj2AN5CUYRod4FyK7QZN/K4H+mpPvJhpjaVH/6jTZ 17GzTnrSx83Gp0O5O9IJH0cGnu+rmLGH9rb22RnexsTT8fRfT1FmqMYA/5pgTRhT+4Wc VeC0BskRVJ+UvijBmgfiytQJf56muoz2WlG+4V2LsjYIOC32oh8PkxJGkjYhmese8bzH lKNpnzdxd3jo4ntrbbH8omVCvpCy82jp5lFStm0u8wPFWXJ/QEpT4JVCs6J/dqeCU4+r AdgAutJ29I4211O9piULq6zeZU/Vg8is1yFhaZkfPcSzBz6jtDLlXHZ7t+uQn29WucGJ VBDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=VDhlyIOb; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si12953854pgk.56.2019.02.18.06.34.26; Mon, 18 Feb 2019 06:34:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=VDhlyIOb; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387891AbfBROeZ (ORCPT + 3 others); Mon, 18 Feb 2019 09:34:25 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:59701 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388197AbfBROeZ (ORCPT ); Mon, 18 Feb 2019 09:34:25 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190218143424euoutp021963fe83856fd9c25f3be71be7e84bff~Ee-UKA3CJ1530015300euoutp02M; Mon, 18 Feb 2019 14:34:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190218143424euoutp021963fe83856fd9c25f3be71be7e84bff~Ee-UKA3CJ1530015300euoutp02M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1550500464; bh=CtZaeO6HKavnUMNvWElW4sGJfjbpT1+04kXGfhTWtvQ=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=VDhlyIObbDpGIKlQYcsROIFdX5vlCrTCP+YZyZjwCCAG9wsmiuuF3J1DR3vHyiaeV eBbvz9ItnVO3ILcaToffx2fnhdJlaMLntdEI5in3SBbKIjm/8YXRs9nl433kHK8CZO /2zpLmun3BKum6+5k1UWgcgToC73FxCZIHC2AzHA= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190218143423eucas1p2cd3969c27f6244cd2612ec7493c2ef0d~Ee-Tkh3-z2788227882eucas1p2s; Mon, 18 Feb 2019 14:34:23 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id AE.66.04806.F62CA6C5; Mon, 18 Feb 2019 14:34:23 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190218143422eucas1p2992ce94ddab3db3de9534719e7e3d986~Ee-S7ENu83177231772eucas1p2a; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-28-5c6ac26fe55d Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 33.8B.04284.E62CA6C5; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PN400ECCLT2NV10@eusync1.samsung.com>; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Joonyoung Shim , Krzysztof Kozlowski , Chanwoo Choi , Bartlomiej Zolnierkiewicz , Seung-Woo Kim Subject: [PATCH 4/4] ARM: exynos: Fix undefined instruction during Exynos5422 resume Date: Mon, 18 Feb 2019 15:34:12 +0100 Message-id: <20190218143412.6865-5-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190218143412.6865-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCIsWRmVeSWpSXmKPExsWy7djPc7r5h7JiDM585rbYOGM9q8X1L89Z LV7cu8hicf78BnaLGef3MVmsPXIXyJr8ks2B3WPTqk42j74tqxg9Pm+SC2CO4rJJSc3JLEst 0rdL4MqYOO0nW8Ep2YpTp8QaGCdKdjFyckgImEisXv2NtYuRi0NIYAWjROOWZ4wQzmdGib+r rzPDVN0/MA2qahmjxJY3M6CqGpgkujq+soFUsQkYSnS97QKzRQRUJT63LWAHKWIW6GKSaNs5 nRUkISwQJnHl2zKwsSxARSt2vGABsXkFbCTWf77IBLFOXmL1hgNgNZwCthLbezexgAySEPjI KvF720VWiCIXiUnbFrFA2DISnR0HmSCKmhkl2mfMYodwehglts7ZwQZRZS1x+DhEN7MAH1D3 dKAVHEBxXomONiGIEg+JT2cfM4LYQgITGCUmHTMBkgsYGVYxiqeWFuempxYb56WW6xUn5haX 5qXrJefnbmIExtXpf8e/7mDc9yfpEKMAB6MSD++C5VkxQqyJZcWVuYcYJTiYlUR4Tx0ACvGm JFZWpRblxxeV5qQWH2KU5mBREuetZngQLSSQnliSmp2aWpBaBJNl4uCUamAMv9jI/lo+eI7c OyedqyKPVrxQnfZr9yHn/FM6cnJcHTzuR5ST3s3s7VTnPfuw91N915sXa/o0H/NNPJ8TM6/8 otPBY0+VJBl+X963qT3csUuYVU/rlvpzcz/N41kuz42XPWO4u59NsJZR+9/FeQuMHMQ2in3q mVZ3lWXTA3fz+/u8BFl9z+orsRRnJBpqMRcVJwIAZInF0acCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDJMWRmVeSWpSXmKPExsVy+t/xy7p5h7JiDOas1LXYOGM9q8X1L89Z LV7cu8hicf78BnaLGef3MVmsPXIXyJr8ks2B3WPTqk42j74tqxg9Pm+SC2CO4rJJSc3JLEst 0rdL4MqYOO0nW8Ep2YpTp8QaGCdKdjFyckgImEjcPzCNtYuRi0NIYAmjxPb7+6GcJiaJ959f s4NUsQkYSnS97WIDsUUEVCU+ty1gByliFuhhkrj/6RELSEJYIEyi9cIMZhCbBahoxY4XYHFe ARuJ9Z8vMkGsk5dYveEAWA2ngK3E9t5NQDUcQNtsJFYvq57AyLOAkWEVo0hqaXFuem6xoV5x Ym5xaV66XnJ+7iZGYJhsO/Zz8w7GSxuDDzEKcDAq8fAuWJ4VI8SaWFZcmXuIUYKDWUmE99QB oBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHe8waVUUIC6YklqdmpqQWpRTBZJg5OqQZGLn+XPl1T GZMrSidZjwi3F0ZMyb4hrfHwwq24xYyFq288tXT6KB8p2lxh8m7NZoXY/bOmZSz/c17nk0Ic g/X29ufqLL9Kp+3x+OtREmQZtqVQ+L/Cpp+78z7wJi4/W+WeMHHChJ/lkuu++Bx4z+lZ9q/m 2ooj3o8j7jXHMUVwX9pWOlXfYYuhEktxRqKhFnNRcSIAZ1ftvw8CAAA= X-CMS-MailID: 20190218143422eucas1p2992ce94ddab3db3de9534719e7e3d986 CMS-TYPE: 201P X-CMS-RootMailID: 20190218143422eucas1p2992ce94ddab3db3de9534719e7e3d986 References: <20190218143412.6865-1-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org During early system resume on Exynos5422 with performance counters enabled the following kernel oops happens: Internal error: Oops - undefined instruction: 0 [#1] PREEMPT SMP ARM Modules linked in: CPU: 0 PID: 1433 Comm: bash Tainted: G W 5.0.0-rc5-next-20190208-00023-gd5fb5a8a13e6-dirty #5480 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) PC is at reset_ctrl_regs+0x128/0x354 LR is at reset_ctrl_regs+0x124/0x354 pc : [] lr : [] psr: 600001d3 ... Flags: nZCv IRQs off FIQs off Mode SVC_32 ISA ARM Segment none Control: 10c5387d Table: 4451006a DAC: 00000051 Process bash (pid: 1433, stack limit = 0xb7e0e22f) ... [] (reset_ctrl_regs) from [] (dbg_cpu_pm_notify+0x1c/0x24) [] (dbg_cpu_pm_notify) from [] (notifier_call_chain+0x44/0x84) [] (notifier_call_chain) from [] (__atomic_notifier_call_chain+0x7c/0x128) [] (__atomic_notifier_call_chain) from [] (cpu_pm_notify+0x30/0x54) [] (cpu_pm_notify) from [] (syscore_resume+0x98/0x3f4) [] (syscore_resume) from [] (suspend_devices_and_enter+0x97c/0xe74) [] (suspend_devices_and_enter) from [] (pm_suspend+0x770/0xc04) [] (pm_suspend) from [] (state_store+0x6c/0xcc) [] (state_store) from [] (kobj_attr_store+0x14/0x20) [] (kobj_attr_store) from [] (sysfs_kf_write+0x4c/0x50) [] (sysfs_kf_write) from [] (kernfs_fop_write+0xfc/0x1e0) [] (kernfs_fop_write) from [] (__vfs_write+0x2c/0x160) [] (__vfs_write) from [] (vfs_write+0xa4/0x16c) [] (vfs_write) from [] (ksys_write+0x40/0x8c) [] (ksys_write) from [] (ret_fast_syscall+0x0/0x28) ... ---[ end trace 03fc9866185939bf ]--- Undefined instruction is triggered during CP14 reset, because bits: #16 (Secure privileged invasive debug disabled) and #17 (Secure privileged noninvasive debug disable) are set in DSCR. Those bits depend on SPNIDEN and SPIDEN lines, which are provided by Secure JTAG hardware block. That block in turn is powered from cluster 0 (big/Eagle), but the Exynos5422 boots on cluster 1 (LITTLE/KFC). To fix this issue it is enough to turn on the power on the cluster 0 for a while. This lets the Secure JTAG block to propagate the needed signals to LITTLE/KFC cores and change their DSCR. Signed-off-by: Marek Szyprowski --- arch/arm/mach-exynos/suspend.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.17.1 diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c index 3ac84f621d99..ef0c750f746c 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c @@ -449,8 +449,27 @@ static void exynos3250_pm_resume(void) static void exynos5420_prepare_pm_resume(void) { + unsigned int mpidr, cluster; + + mpidr = read_cpuid_mpidr(); + cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); + if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM)) WARN_ON(mcpm_cpu_powered_up()); + + if (IS_ENABLED(CONFIG_HW_PERF_EVENTS) && cluster != 0) { + /* + * When system is resumed on the LITTLE/KFC core (cluster 1), + * the DSCR is not properly updated until the power is turned + * on also for the cluster 0. Enable it for a while to + * propagate the SPNIDEN and SPIDEN signals from Secure JTAG + * block and avoid undefined instruction issue on CP14 reset. + */ + pmu_raw_writel(S5P_CORE_LOCAL_PWR_EN, + EXYNOS_COMMON_CONFIGURATION(0)); + pmu_raw_writel(0, + EXYNOS_COMMON_CONFIGURATION(0)); + } } static void exynos5420_pm_resume(void)