Re: [PATCH v9 07/18] arm64: trans_pgd: hibernate: idmap the single page that holds the copy page routines
From: Pavel Tatashin
Date: Fri Jan 22 2021 - 19:36:46 EST
On Wed, Apr 29, 2020 at 1:01 PM James Morse <james.morse@xxxxxxx> wrote:
> Hi Pavel,
> On 26/03/2020 03:24, Pavel Tatashin wrote:
> > From: James Morse <james.morse@xxxxxxx>
> > 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.
> > Pasha: The original patch from James
> > inux-arm-kernel/20200115143322.214247-4-james.morse@xxxxxxx
> The convention is to use a 'Link:' tag in the signed-off area.
> e.g. 5a3577039cbe
> > Adopted it to trans_pgd, so it can be commonly used by both Kexec
> > and Hibernate. Some minor clean-ups.
> Please describe your changes just before your SoB. This means each author sign's off on
> the stuff above their SoB, and its obvious who made which changes.
> Search for 'Lucky K Maintainer' in process/submitting-patches.rst for an example.
eed the maximum T0SZ.
> > + *
> > + * Returns 0 on success, and -ENOMEM on failure.
> > + * On success trans_ttbr0 contains page table with idmapped page, t0sz is set to
> > + * maxumum T0SZ for this page.