Skip to content

Commit 4c00673

Browse files
roygerjgross1
authored andcommitted
x86/xen: fix memblock_reserve() usage on PVH
The current usage of memblock_reserve() in init_pvh_bootparams() is done before the .bss is zeroed, and that used to be fine when memblock_reserved_init_regions implicitly ended up in the .meminit.data section. However after commit 73db3ab memblock_reserved_init_regions ends up in the .bss section, thus breaking it's usage before the .bss is cleared. Move and rename the call to xen_reserve_extra_memory() so it's done in the x86_init.oem.arch_setup hook, which gets executed after the .bss has been zeroed, but before calling e820__memory_setup(). Fixes: 73db3ab ("init/modpost: conditionally check section mismatch to __meminit*") Signed-off-by: Roger Pau Monné <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Message-ID: <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent fc05ea8 commit 4c00673

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

arch/x86/include/asm/xen/hypervisor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ void xen_arch_unregister_cpu(int num);
6262
#ifdef CONFIG_PVH
6363
void __init xen_pvh_init(struct boot_params *boot_params);
6464
void __init mem_map_via_hcall(struct boot_params *boot_params_p);
65-
#ifdef CONFIG_XEN_PVH
66-
void __init xen_reserve_extra_memory(struct boot_params *bootp);
67-
#else
68-
static inline void xen_reserve_extra_memory(struct boot_params *bootp) { }
69-
#endif
7065
#endif
7166

7267
/* Lazy mode for batching updates / context switch */

arch/x86/platform/pvh/enlighten.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ static void __init init_pvh_bootparams(bool xen_guest)
7575
} else
7676
xen_raw_printk("Warning: Can fit ISA range into e820\n");
7777

78-
if (xen_guest)
79-
xen_reserve_extra_memory(&pvh_bootparams);
80-
8178
pvh_bootparams.hdr.cmd_line_ptr =
8279
pvh_start_info.cmdline_paddr;
8380

arch/x86/xen/enlighten_pvh.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <asm/io_apic.h>
1010
#include <asm/hypervisor.h>
1111
#include <asm/e820/api.h>
12+
#include <asm/setup.h>
1213

1314
#include <xen/xen.h>
1415
#include <asm/xen/interface.h>
@@ -41,8 +42,9 @@ EXPORT_SYMBOL_GPL(xen_pvh);
4142
* hypervisor should notify us which memory ranges are suitable for creating
4243
* foreign mappings, but that's not yet implemented.
4344
*/
44-
void __init xen_reserve_extra_memory(struct boot_params *bootp)
45+
static void __init pvh_reserve_extra_memory(void)
4546
{
47+
struct boot_params *bootp = &boot_params;
4648
unsigned int i, ram_pages = 0, extra_pages;
4749

4850
for (i = 0; i < bootp->e820_entries; i++) {
@@ -94,6 +96,14 @@ void __init xen_reserve_extra_memory(struct boot_params *bootp)
9496
}
9597
}
9698

99+
static void __init pvh_arch_setup(void)
100+
{
101+
pvh_reserve_extra_memory();
102+
103+
if (xen_initial_domain())
104+
xen_add_preferred_consoles();
105+
}
106+
97107
void __init xen_pvh_init(struct boot_params *boot_params)
98108
{
99109
u32 msr;
@@ -107,8 +117,7 @@ void __init xen_pvh_init(struct boot_params *boot_params)
107117
pfn = __pa(hypercall_page);
108118
wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
109119

110-
if (xen_initial_domain())
111-
x86_init.oem.arch_setup = xen_add_preferred_consoles;
120+
x86_init.oem.arch_setup = pvh_arch_setup;
112121
x86_init.oem.banner = xen_banner;
113122

114123
xen_efi_init(boot_params);

0 commit comments

Comments
 (0)