]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
arm64: trans_pgd: hibernate: idmap the single page that holds the copy page routines
authorJames Morse <james.morse@arm.com>
Mon, 25 Jan 2021 19:19:13 +0000 (14:19 -0500)
committerWill Deacon <will@kernel.org>
Wed, 27 Jan 2021 15:41:12 +0000 (15:41 +0000)
commit7018d467ff2d6a6d3c820a7ad4e897fe2430b040
tree173ce4cf4d47c3f783be5ff33d7e7a1febddcecc
parent1401bef703a48cf79c674215f702a1435362beae
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>
arch/arm64/include/asm/trans_pgd.h
arch/arm64/kernel/hibernate.c
arch/arm64/mm/trans_pgd.c