Skip to content

Commit e5f0581

Browse files
roygergregkh
authored andcommitted
x86/xen: fix memblock_reserve() usage on PVH
commit 4c00673 upstream. 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]> [ Context fixup for hypercall_page removal ] Signed-off-by: Jason Andryuk <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent fa1103f commit e5f0581

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
@@ -74,9 +74,6 @@ static void __init init_pvh_bootparams(bool xen_guest)
7474
} else
7575
xen_raw_printk("Warning: Can fit ISA range into e820\n");
7676

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

arch/x86/xen/enlighten_pvh.c

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

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

4749
for (i = 0; i < bootp->e820_entries; i++) {
@@ -93,14 +95,21 @@ void __init xen_reserve_extra_memory(struct boot_params *bootp)
9395
}
9496
}
9597

98+
static void __init pvh_arch_setup(void)
99+
{
100+
pvh_reserve_extra_memory();
101+
102+
if (xen_initial_domain())
103+
xen_add_preferred_consoles();
104+
}
105+
96106
void __init xen_pvh_init(struct boot_params *boot_params)
97107
{
98108
xen_pvh = 1;
99109
xen_domain_type = XEN_HVM_DOMAIN;
100110
xen_start_flags = pvh_start_info.flags;
101111

102-
if (xen_initial_domain())
103-
x86_init.oem.arch_setup = xen_add_preferred_consoles;
112+
x86_init.oem.arch_setup = pvh_arch_setup;
104113
x86_init.oem.banner = xen_banner;
105114

106115
xen_efi_init(boot_params);

0 commit comments

Comments
 (0)