From 52cd57fed265d71cfb2817045d44915ad31e8953 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Tue, 4 Dec 2018 18:11:33 +0900 Subject: [PATCH] memory/x86_64: fix linux safe_kernel_map init_linux_kernel_mapping is called in setup_x86_phase1 way before arguments are setup, but we can access kernel boot args directly and use that, so ugly fix for now. Change-Id: I285ecc31c6646d6d18566d411b09ae3190e8101e Refs: #1228 --- arch/x86_64/kernel/memory.c | 6 +++--- kernel/init.c | 7 ------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/arch/x86_64/kernel/memory.c b/arch/x86_64/kernel/memory.c index 17ed6e45..32225975 100644 --- a/arch/x86_64/kernel/memory.c +++ b/arch/x86_64/kernel/memory.c @@ -39,8 +39,6 @@ extern char _head[], _end[]; extern unsigned long x86_kernel_phys_base; -int safe_kernel_map = 0; - /* Arch specific early allocation routine */ void *early_alloc_pages(int nr_pages) { @@ -2543,6 +2541,8 @@ static void init_normal_area(struct page_table *pt) } } +extern char *find_command_line(char *name); + static void init_linux_kernel_mapping(struct page_table *pt) { unsigned long map_start, map_end, phys; @@ -2552,7 +2552,7 @@ static void init_linux_kernel_mapping(struct page_table *pt) /* In case of safe_kernel_map option (safe_kernel_map == 1), * processing to prevent destruction of the memory area on Linux side * is executed */ - if (safe_kernel_map == 0) { + if (find_command_line("safe_kernel_map") == NULL) { kprintf("Straight-map entire physical memory\n"); /* Map 2 TB for now */ diff --git a/kernel/init.c b/kernel/init.c index 1b5a3761..db0f811d 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -130,8 +130,6 @@ char *find_command_line(char *name) return strstr(cmdline, name); } -extern int safe_kernel_map; - static void parse_kargs(void) { char *ptr; @@ -152,11 +150,6 @@ static void parse_kargs(void) } ihk_mc_set_dump_level(dump_level); - ptr = find_command_line("safe_kernel_map"); - if (ptr) { - safe_kernel_map = 1; - } - /* idle_halt option */ ptr = find_command_line("idle_halt"); if (ptr) {