ARM: tegra: Ensure entire dcache is flushed on entering LP0/1
Subsystems (3)
Jon Hunter
maintainerPATCH 1/1 ARM: tegra: Ensure entire dcache is flushed on entering LP0/1
Tegra support several low-power (LPx) states, which are:
- LP0: CPU + Core voltage off and DRAM in self-refresh
- LP1: CPU voltage off and DRAM in self-refresh
- LP2: CPU voltage off
When entering any of the above states the tegra_disable_clean_inv_dcache() function is called to flush the dcache. The function tegra_disable_clean_inv_dcache() will either flush the entire data cache or up to the Level of Unification Inner Shareable (LoUIS) depending on the value in r0. When tegra_disable_clean_inv_dcache() is called by tegra20_sleep_core_finish() or tegra30_sleep_core_finish(), to enter LP0 and LP1 power state, the r0 register contains a physical memory address which will not be equal to TEGRA_FLUSH_CACHE_ALL (1) and so the data cache will be only flushed to the LoUIS. However, when tegra_disable_clean_inv_dcache() called by tegra_sleep_cpu_finish() to enter to LP2 power state, r0 is set to TEGRA_FLUSH_CACHE_ALL to flush the entire dcache.
Please note that tegra20_sleep_core_finish(), tegra30_sleep_core_finish() and tegra_sleep_cpu_finish() are called by the boot CPU once all other CPUs have been disabled and so it seems appropriate to flush the entire cache at this stage.
Therefore, ensure that r0 is set to TEGRA_FLUSH_CACHE_ALL when calling tegra_disable_clean_inv_dcache() from tegra20_sleep_core_finish() and tegra30_sleep_core_finish().
---
Please note that I have not encountered any problems without this change so far, but I noticed this from reviewing the suspend sequence. I have tested this on tegra20, tegra30, tegra114 and tegra124 and verified that suspend/resume to LP1 is working fine.
arch/arm/mach-tegra/sleep-tegra20.S | 3 +++ arch/arm/mach-tegra/sleep-tegra30.S | 3 +++ 2 files changed, 6 insertions(+)
arch/arm/mach-tegra/sleep-tegra20.S +3 -0
@@ -231,8 +231,11 @@ ENDPROC(tegra20_cpu_is_resettable_soon) * tegra20_tear_down_core in IRAM */ ENTRY(tegra20_sleep_core_finish) + mov r4, r0 /* Flush, disable the L1 data cache and exit SMP */ + mov r0, #TEGRA_FLUSH_CACHE_ALL bl tegra_disable_clean_inv_dcache + mov r0, r4 mov32 r3, tegra_shut_off_mmu add r3, r3, r0
arch/arm/mach-tegra/sleep-tegra30.S +3 -0
@@ -242,8 +242,11 @@ ENDPROC(tegra30_cpu_shutdown) * tegra30_tear_down_core in IRAM */ ENTRY(tegra30_sleep_core_finish) + mov r4, r0 /* Flush, disable the L1 data cache and exit SMP */ + mov r0, #TEGRA_FLUSH_CACHE_ALL bl tegra_disable_clean_inv_dcache + mov r0, r4 /* * Preload all the address literals that are needed for the
Signature · 1 line
2.1.4
Hi Jon,
Quoted 23 lines · Jon Hunter
Tegra support several low-power (LPx) states, which are:
- LP0: CPU + Core voltage off and DRAM in self-refresh
- LP1: CPU voltage off and DRAM in self-refresh
- LP2: CPU voltage offWhen entering any of the above states the
tegra_disable_clean_inv_dcache()function is called to flush the dcache. The functiontegra_disable_clean_inv_dcache()will either flush the entire data cache or up to the Level of Unification Inner Shareable (LoUIS) depending on the value in r0. Whentegra_disable_clean_inv_dcache()is called bytegra20_sleep_core_finish()ortegra30_sleep_core_finish(), to enter LP0 and LP1 power state, the r0 register contains a physical memory address which will not be equal toTEGRA_FLUSH_CACHE_ALL(1) and so the data cache will be only flushed to the LoUIS. However, whentegra_disable_clean_inv_dcache()called bytegra_sleep_cpu_finish()to enter to LP2 power state, r0 is set toTEGRA_FLUSH_CACHE_ALLto flush the entire dcache.Please note that
tegra20_sleep_core_finish(),tegra30_sleep_core_finish()andtegra_sleep_cpu_finish()are called by the boot CPU once all other CPUs have been disabled and so it seems appropriate to flush the entire cache at this stage.
Quoted 6 lines
Therefore, ensure that r0 is set to
TEGRA_FLUSH_CACHE_ALLwhen callingtegra_disable_clean_inv_dcache()fromtegra20_sleep_core_finish()andtegra30_sleep_core_finish().Signed-off-by Jon Hunter <[email protected]>---
Thanks for the fix.
Quoted 43 lines
Please note that I have not encountered any problems without this change so far, but I noticed this from reviewing the suspend sequence. I have tested this on tegra20, tegra30, tegra114 and tegra124 and verified that suspend/resume to LP1 is working fine.
arch/arm/mach-tegra/sleep-tegra20.S | 3 +++ arch/arm/mach-tegra/sleep-tegra30.S | 3 +++ 2 files changed, 6 insertions(+)arch/arm/mach-tegra/sleep-tegra20.S +3
-0@@ -231,8 +231,11 @@ ENDPROC(tegra20_cpu_is_resettable_soon) * tegra20_tear_down_core in IRAM */ ENTRY(tegra20_sleep_core_finish) + mov r4, r0 /* Flush, disable the L1 data cache and exit SMP */ + mov r0, #TEGRA_FLUSH_CACHE_ALL bl tegra_disable_clean_inv_dcache + mov r0, r4 mov32 r3, tegra_shut_off_mmu add r3, r3, r0arch/arm/mach-tegra/sleep-tegra30.S +3
-0@@ -242,8 +242,11 @@ ENDPROC(tegra30_cpu_shutdown) * tegra30_tear_down_core in IRAM */ ENTRY(tegra30_sleep_core_finish) + mov r4, r0 /* Flush, disable the L1 data cache and exit SMP */ + mov r0, #TEGRA_FLUSH_CACHE_ALL bl tegra_disable_clean_inv_dcache + mov r0, r4 /* * Preload all the address literals that are needed for the
Thierry Reding
AppliedQuoted 30 lines · Jon Hunter
Tegra support several low-power (LPx) states, which are:
- LP0: CPU + Core voltage off and DRAM in self-refresh
- LP1: CPU voltage off and DRAM in self-refresh
- LP2: CPU voltage offWhen entering any of the above states the
tegra_disable_clean_inv_dcache()function is called to flush the dcache. The functiontegra_disable_clean_inv_dcache()will either flush the entire data cache or up to the Level of Unification Inner Shareable (LoUIS) depending on the value in r0. Whentegra_disable_clean_inv_dcache()is called bytegra20_sleep_core_finish()ortegra30_sleep_core_finish(), to enter LP0 and LP1 power state, the r0 register contains a physical memory address which will not be equal toTEGRA_FLUSH_CACHE_ALL(1) and so the data cache will be only flushed to the LoUIS. However, whentegra_disable_clean_inv_dcache()called bytegra_sleep_cpu_finish()to enter to LP2 power state, r0 is set toTEGRA_FLUSH_CACHE_ALLto flush the entire dcache.Please note that
tegra20_sleep_core_finish(),tegra30_sleep_core_finish()andtegra_sleep_cpu_finish()are called by the boot CPU once all other CPUs have been disabled and so it seems appropriate to flush the entire cache at this stage.Therefore, ensure that r0 is set to
TEGRA_FLUSH_CACHE_ALLwhen callingtegra_disable_clean_inv_dcache()fromtegra20_sleep_core_finish()andtegra30_sleep_core_finish().Signed-off-by Jon Hunter <[email protected]>---
Quoted 8 lines
Please note that I have not encountered any problems without this change so far, but I noticed this from reviewing the suspend sequence. I have tested this on tegra20, tegra30, tegra114 and tegra124 and verified that suspend/resume to LP1 is working fine.
arch/arm/mach-tegra/sleep-tegra20.S | 3 +++ arch/arm/mach-tegra/sleep-tegra30.S | 3 +++ 2 files changed, 6 insertions(+)
Applied, thanks.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151123/24f4fe94/attachment.sig>