arm64: trans_pgd: make trans_pgd_map_page generic
kexec is going to use a different allocator, so make trans_pgd_map_page to accept allocator as an argument, and also kexec is going to use a different map protection, so also pass it via argument. Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com> Reviewed-by: Matthias Brugger <mbrugger@suse.com> Link: https://lore.kernel.org/r/20210125191923.1060122-5-pasha.tatashin@soleen.com Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
committed by
Will Deacon
parent
072e3d96a7
commit
50f53fb721
@@ -176,6 +176,11 @@ int arch_hibernation_header_restore(void *addr)
|
||||
}
|
||||
EXPORT_SYMBOL(arch_hibernation_header_restore);
|
||||
|
||||
static void *hibernate_page_alloc(void *arg)
|
||||
{
|
||||
return (void *)get_safe_page((gfp_t)(unsigned long)arg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copies length bytes, starting at src_start into an new page,
|
||||
* perform cache maintenance, then maps it at the specified address low
|
||||
@@ -192,6 +197,11 @@ static int create_safe_exec_page(void *src_start, size_t length,
|
||||
unsigned long dst_addr,
|
||||
phys_addr_t *phys_dst_addr)
|
||||
{
|
||||
struct trans_pgd_info trans_info = {
|
||||
.trans_alloc_page = hibernate_page_alloc,
|
||||
.trans_alloc_arg = (void *)GFP_ATOMIC,
|
||||
};
|
||||
|
||||
void *page = (void *)get_safe_page(GFP_ATOMIC);
|
||||
pgd_t *trans_pgd;
|
||||
int rc;
|
||||
@@ -206,7 +216,7 @@ static int create_safe_exec_page(void *src_start, size_t length,
|
||||
if (!trans_pgd)
|
||||
return -ENOMEM;
|
||||
|
||||
rc = trans_pgd_map_page(trans_pgd, page, dst_addr,
|
||||
rc = trans_pgd_map_page(&trans_info, trans_pgd, page, dst_addr,
|
||||
PAGE_KERNEL_EXEC);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
Reference in New Issue
Block a user