summaryrefslogtreecommitdiffstats
path: root/arch/arm64/include/asm/trans_pgd.h
diff options
context:
space:
mode:
authorJames Morse <james.morse@arm.com>2021-01-25 14:19:13 -0500
committerWill Deacon <will@kernel.org>2021-01-27 15:41:12 +0000
commit7018d467ff2d6a6d3c820a7ad4e897fe2430b040 (patch)
tree173ce4cf4d47c3f783be5ff33d7e7a1febddcecc /arch/arm64/include/asm/trans_pgd.h
parent1401bef703a48cf79c674215f702a1435362beae (diff)
downloadlinux-stable-7018d467ff2d6a6d3c820a7ad4e897fe2430b040.tar.gz
linux-stable-7018d467ff2d6a6d3c820a7ad4e897fe2430b040.tar.bz2
linux-stable-7018d467ff2d6a6d3c820a7ad4e897fe2430b040.zip
arm64: trans_pgd: hibernate: idmap the single page that holds the copy page routines
To resume from hibernate, the contents of memory are restored from the swap image. This may overwrite any page, including the running kernel and its page tables. Hibernate copies the code it uses to do the restore into a single page that it knows won't be overwritten, and maps it with page tables built from pages that won't be overwritten. Today the address it uses for this mapping is arbitrary, but to allow kexec to reuse this code, it needs to be idmapped. To idmap the page we must avoid the kernel helpers that have VA_BITS baked in. Convert create_single_mapping() to take a single PA, and idmap it. The page tables are built in the reverse order to normal using pfn_pte() to stir in any bits between 52:48. T0SZ is always increased to cover 48bits, or 52 if the copy code has bits 52:48 in its PA. Signed-off-by: James Morse <james.morse@arm.com> [Adopted the original patch from James to trans_pgd interface, so it can be commonly used by both Kexec and Hibernate. Some minor clean-ups.] Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com> Link: https://lore.kernel.org/linux-arm-kernel/20200115143322.214247-4-james.morse@arm.com/ Link: https://lore.kernel.org/r/20210125191923.1060122-9-pasha.tatashin@soleen.com Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch/arm64/include/asm/trans_pgd.h')
-rw-r--r--arch/arm64/include/asm/trans_pgd.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/trans_pgd.h b/arch/arm64/include/asm/trans_pgd.h
index 7fbf6a3ccff7..5d08e5adf3d5 100644
--- a/arch/arm64/include/asm/trans_pgd.h
+++ b/arch/arm64/include/asm/trans_pgd.h
@@ -33,4 +33,7 @@ int trans_pgd_create_copy(struct trans_pgd_info *info, pgd_t **trans_pgd,
int trans_pgd_map_page(struct trans_pgd_info *info, pgd_t *trans_pgd,
void *page, unsigned long dst_addr, pgprot_t pgprot);
+int trans_pgd_idmap_page(struct trans_pgd_info *info, phys_addr_t *trans_ttbr0,
+ unsigned long *t0sz, void *page);
+
#endif /* _ASM_TRANS_TABLE_H */