[PATCH 6/7] arm64: hibernate: only clean to PoC
From: Bradley Morgan
Date: Tue Aug 25 2026 - 17:01:09 EST
The hibernate code has to clean parts of the kernel to the PoC so they
can be used with the MMU off. We only need to clean to the PoC, but we
have been using dcache_clean_inval_poc(), which does a clean plus
invalidate, just because that is what was available.
When hibernate was added in commit 82869ac57b5d ("arm64: kernel: Add
support for hibernate/suspend-to-disk"), the only cache maintenance
exposed outside the DMA code was __flush_dcache_area(), so that is what
got used. Commit d34fdb7081394cbf ("arm64: mm: convert __dma_* routines to use start, size")
later exposed dcache_clean_area_poc(), and commit fade9c2c6ee2baea
("arm64: Rename arm64-internal cache maintenance functions") renamed
things again, but the hibernate code never switched over either time.
The invalidate is pointless anyway, since the mappings we clean through
are cacheable and the CPU can just pull the memory straight back into
cache right after. Use dcache_clean_poc() instead.
Signed-off-by: Bradley Morgan <brads@xxxxxxxxxxxxxx>
Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>
Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
Cc: James Morse <james.morse@xxxxxxx>
Cc: Marc Zyngier <maz@xxxxxxxxxx>
Cc: Will Deacon <will@xxxxxxxxxx>
---
arch/arm64/kernel/hibernate.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
index 30b02e39a397..60e264299a4d 100644
--- a/arch/arm64/kernel/hibernate.c
+++ b/arch/arm64/kernel/hibernate.c
@@ -367,18 +367,17 @@ int swsusp_arch_suspend(void)
swsusp_mte_free_storage();
} else {
/* Clean kernel core startup/idle code to PoC*/
- dcache_clean_inval_poc((unsigned long)__mmuoff_data_start,
- (unsigned long)__mmuoff_data_end);
- dcache_clean_inval_poc((unsigned long)__idmap_text_start,
- (unsigned long)__idmap_text_end);
+ dcache_clean_poc((unsigned long)__mmuoff_data_start,
+ (unsigned long)__mmuoff_data_end);
+ dcache_clean_poc((unsigned long)__idmap_text_start,
+ (unsigned long)__idmap_text_end);
/* Clean kvm setup code to PoC? */
if (el2_reset_needed()) {
- dcache_clean_inval_poc(
- (unsigned long)__hyp_idmap_text_start,
- (unsigned long)__hyp_idmap_text_end);
- dcache_clean_inval_poc((unsigned long)__hyp_text_start,
- (unsigned long)__hyp_text_end);
+ dcache_clean_poc((unsigned long)__hyp_idmap_text_start,
+ (unsigned long)__hyp_idmap_text_end);
+ dcache_clean_poc((unsigned long)__hyp_text_start,
+ (unsigned long)__hyp_text_end);
}
swsusp_mte_restore_tags();
--
2.47.3