Messages in this thread Patch in this message | | | From | Arvind Sankar <> | Subject | [PATCH 3/5] x86/boot/64: Change add_identity_map() to take size for ease of use | Date | Wed, 7 Oct 2020 15:53:49 -0400 |
| |
Change back the arguments of add_identity_map() to (start, size) instead of (start, end). This reverts
21cf2372618e ("x86/boot/compressed/64: Change add_identity_map() to take start and end")
since we will soon have more callers that know the size rather than the end address.
This also makes the #PF handler print the original CR2 value in case of error, instead of after aligning to PMD_SIZE.
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu> --- arch/x86/boot/compressed/ident_map_64.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/arch/x86/boot/compressed/ident_map_64.c b/arch/x86/boot/compressed/ident_map_64.c index 063a60edcf99..070cda70aef3 100644 --- a/arch/x86/boot/compressed/ident_map_64.c +++ b/arch/x86/boot/compressed/ident_map_64.c @@ -90,8 +90,9 @@ static struct x86_mapping_info mapping_info; /* * Adds the specified range to the identity mappings. */ -static void add_identity_map(unsigned long start, unsigned long end) +static void add_identity_map(unsigned long start, unsigned long size) { + unsigned long end = start + size; int ret; /* Align boundary to 2M. */ @@ -152,7 +153,7 @@ void initialize_identity_maps(void) * New page-table is set up - map the kernel image and load it * into cr3. */ - add_identity_map((unsigned long)_head, (unsigned long)_end); + add_identity_map((unsigned long)_head, (unsigned long)_end - (unsigned long)_head); write_cr3(top_level_pgt); } @@ -322,14 +323,10 @@ static void do_pf_error(const char *msg, unsigned long error_code, void do_boot_page_fault(struct pt_regs *regs, unsigned long error_code) { unsigned long address = native_read_cr2(); - unsigned long end; bool ghcb_fault; ghcb_fault = sev_es_check_ghcb_fault(address); - address &= PMD_MASK; - end = address + PMD_SIZE; - /* * Check for unexpected error codes. Unexpected are: * - Faults on present pages @@ -345,5 +342,5 @@ void do_boot_page_fault(struct pt_regs *regs, unsigned long error_code) * Error code is sane - now identity map the 2M region around * the faulting address. */ - add_identity_map(address, end); + add_identity_map(address & PMD_MASK, PMD_SIZE); } -- 2.26.2
| |