@@ -1082,10 +1082,22 @@ typedef struct PcGuestInfoState {
static
void pc_guest_info_machine_done(Notifier *notifier, void *data)
{
+ int i;
PcGuestInfoState *guest_info_state = container_of(notifier,
PcGuestInfoState,
machine_done);
- acpi_setup(&guest_info_state->info);
+ PcGuestInfo *guest_info = &guest_info_state->info;
+ acpi_setup(guest_info);
+
+ if (current_machine->kernel_filename != NULL) {
+ load_linux(guest_info->fw_cfg,
+ current_machine->kernel_filename, current_machine->initrd_filename,
+ current_machine->kernel_cmdline, guest_info->ram_size_below_4g);
+ }
+
+ for (i = 0; i < nb_option_roms; i++) {
+ rom_add_option(option_rom[i].name, option_rom[i].bootindex);
+ }
}
PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
@@ -1171,26 +1183,6 @@ void pc_acpi_init(const char *default_dsdt)
}
}
-FWCfgState *xen_load_linux(const char *kernel_filename,
- const char *kernel_cmdline,
- const char *initrd_filename,
- ram_addr_t below_4g_mem_size,
- PcGuestInfo *guest_info)
-{
- int i;
-
- assert(kernel_filename != NULL);
-
- load_linux(guest_info->fw_cfg, kernel_filename, initrd_filename,
- kernel_cmdline, below_4g_mem_size);
- for (i = 0; i < nb_option_roms; i++) {
- assert(!strcmp(option_rom[i].name, "linuxboot.bin") ||
- !strcmp(option_rom[i].name, "multiboot.bin"));
- rom_add_option(option_rom[i].name, option_rom[i].bootindex);
- }
- return guest_info->fw_cfg;
-}
-
FWCfgState *pc_memory_init(MachineState *machine,
MemoryRegion *system_memory,
ram_addr_t below_4g_mem_size,
@@ -1199,7 +1191,7 @@ FWCfgState *pc_memory_init(MachineState *machine,
MemoryRegion **ram_memory,
PcGuestInfo *guest_info)
{
- int linux_boot, i;
+ int i;
MemoryRegion *ram, *option_rom_mr;
MemoryRegion *ram_below_4g, *ram_above_4g;
FWCfgState *fw_cfg = guest_info->fw_cfg;
@@ -1207,8 +1199,6 @@ FWCfgState *pc_memory_init(MachineState *machine,
assert(machine->ram_size == below_4g_mem_size + above_4g_mem_size);
- linux_boot = (machine->kernel_filename != NULL);
-
/* Allocate RAM. We allocate it as a single memory region and use
* aliases to address portions of it, mostly for backwards compatibility
* with older qemus that used qemu_ram_alloc().
@@ -1286,14 +1276,6 @@ FWCfgState *pc_memory_init(MachineState *machine,
fw_cfg_add_file(fw_cfg, "etc/reserved-memory-end", val, sizeof(*val));
}
- if (linux_boot) {
- load_linux(fw_cfg, machine->kernel_filename, machine->initrd_filename,
- machine->kernel_cmdline, below_4g_mem_size);
- }
-
- for (i = 0; i < nb_option_roms; i++) {
- rom_add_option(option_rom[i].name, option_rom[i].bootindex);
- }
return fw_cfg;
}
@@ -180,13 +180,6 @@ static void pc_init1(MachineState *machine,
fw_cfg = pc_memory_init(machine, system_memory,
below_4g_mem_size, above_4g_mem_size,
rom_memory, &ram_memory, guest_info);
- } else if (machine->kernel_filename != NULL) {
- /* For xen HVM direct kernel boot, load linux here */
- fw_cfg = xen_load_linux(machine->kernel_filename,
- machine->kernel_cmdline,
- machine->initrd_filename,
- below_4g_mem_size,
- guest_info);
}
gsi_state = g_malloc0(sizeof(*gsi_state));
The initrd is placed at the top of RAM, just below some space left for the ACPI tables. In order to allow for large ACPI tables, we need to delay loading of the initrd until after the ACPI tables are built. We can use the existing pc_guest_info_machine_done notifier, and also subsume xen_load_linux into this function. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- hw/i386/pc.c | 46 ++++++++++++++-------------------------------- hw/i386/pc_piix.c | 7 ------- 2 files changed, 14 insertions(+), 39 deletions(-)