The helper complements kernel_ident_mapping_init(): it frees the identity mapping that was previously allocated. It will be used in the error path to free a partially allocated mapping or if the mapping is no longer needed. The caller provides a struct x86_mapping_info with the free_pgd_page() callback hooked up and the pgd_t to free. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Acked-by: Kai Huang <kai.huang@intel.com> Tested-by: Tao Liu <ltao@redhat.com> Link: https://lore.kernel.org/r/20240614095904.1345461-18-kirill.shutemov@linux.intel.com
22 lines
818 B
C
22 lines
818 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_X86_INIT_H
|
|
#define _ASM_X86_INIT_H
|
|
|
|
#define __head __section(".head.text")
|
|
|
|
struct x86_mapping_info {
|
|
void *(*alloc_pgt_page)(void *); /* allocate buf for page table */
|
|
void (*free_pgt_page)(void *, void *); /* free buf for page table */
|
|
void *context; /* context for alloc_pgt_page */
|
|
unsigned long page_flag; /* page flag for PMD or PUD entry */
|
|
unsigned long offset; /* ident mapping offset */
|
|
bool direct_gbpages; /* PUD level 1GB page support */
|
|
unsigned long kernpg_flag; /* kernel pagetable flag override */
|
|
};
|
|
|
|
int kernel_ident_mapping_init(struct x86_mapping_info *info, pgd_t *pgd_page,
|
|
unsigned long pstart, unsigned long pend);
|
|
|
|
void kernel_ident_mapping_free(struct x86_mapping_info *info, pgd_t *pgd);
|
|
|
|
#endif /* _ASM_X86_INIT_H */
|