ARM: exynos: Fix undefined instruction during Exynos5422 resume 88/199788/2
authorMarek Szyprowski <m.szyprowski@samsung.com>
Thu, 14 Feb 2019 10:12:46 +0000 (11:12 +0100)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 18 Feb 2019 04:55:39 +0000 (04:55 +0000)
commitcc96612c12ef0833a332f21c6b6605894a91bead
treef3697d567c71faa8680c5cc53d71730c1b079a0d
parentfd05744784293aec511d0472f3e897846a17303d
ARM: exynos: Fix undefined instruction during Exynos5422 resume

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 : [<c0112814>]    lr : [<c0112810>]    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)
...
[<c0112814>] (reset_ctrl_regs) from [<c0112ad0>] (dbg_cpu_pm_notify+0x1c/0x24)
[<c0112ad0>] (dbg_cpu_pm_notify) from [<c014c840>] (notifier_call_chain+0x44/0x84)
[<c014c840>] (notifier_call_chain) from [<c014cbc0>] (__atomic_notifier_call_chain+0x7c/0x128)
[<c014cbc0>] (__atomic_notifier_call_chain) from [<c01ffaac>] (cpu_pm_notify+0x30/0x54)
[<c01ffaac>] (cpu_pm_notify) from [<c055116c>] (syscore_resume+0x98/0x3f4)
[<c055116c>] (syscore_resume) from [<c0189350>] (suspend_devices_and_enter+0x97c/0xe74)
[<c0189350>] (suspend_devices_and_enter) from [<c0189fb8>] (pm_suspend+0x770/0xc04)
[<c0189fb8>] (pm_suspend) from [<c0187740>] (state_store+0x6c/0xcc)
[<c0187740>] (state_store) from [<c09fa698>] (kobj_attr_store+0x14/0x20)
[<c09fa698>] (kobj_attr_store) from [<c030159c>] (sysfs_kf_write+0x4c/0x50)
[<c030159c>] (sysfs_kf_write) from [<c0300620>] (kernfs_fop_write+0xfc/0x1e0)
[<c0300620>] (kernfs_fop_write) from [<c0282be8>] (__vfs_write+0x2c/0x160)
[<c0282be8>] (__vfs_write) from [<c0282ea4>] (vfs_write+0xa4/0x16c)
[<c0282ea4>] (vfs_write) from [<c0283080>] (ksys_write+0x40/0x8c)
[<c0283080>] (ksys_write) from [<c0101000>] (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 <m.szyprowski@samsung.com>
Change-Id: I0fa6618740853169bd96efeb33975f0289ac3706
arch/arm/mach-exynos/suspend.c