From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: jsnow@redhat.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH 2/6] pc: load the kernel after ACPI tables are built
Date: Thu, 18 Sep 2014 18:17:50 +0200 [thread overview]
Message-ID: <1411057074-11157-3-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1411057074-11157-1-git-send-email-pbonzini@redhat.com>
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(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index b95ac18..863a40e 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -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;
}
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 103d756..2aa2b6d 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -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));
--
2.1.0
next prev parent reply other threads:[~2014-09-18 16:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-18 16:17 [Qemu-devel] [PATCH 0/6] pc: bring ACPI table size below to 2.0 levels, try fixing -initrd for good Paolo Bonzini
2014-09-18 16:17 ` [Qemu-devel] [PATCH 1/6] pc: initialize fw_cfg earlier Paolo Bonzini
2014-09-18 16:17 ` Paolo Bonzini [this message]
2014-09-18 16:17 ` [Qemu-devel] [PATCH 3/6] pc: redo sizing of reserved high memory area for -kernel/-initrd Paolo Bonzini
2014-09-18 16:17 ` [Qemu-devel] [PATCH 4/6] pc: introduce new ACPI table sizing algorithm Paolo Bonzini
2014-09-18 16:17 ` [Qemu-devel] [PATCH 5/6] pc: go back to smaller ACPI tables Paolo Bonzini
2014-09-18 16:17 ` [Qemu-devel] [PATCH 6/6] pc: clean up pre-2.1 compatibility code Paolo Bonzini
2014-09-19 7:36 ` [Qemu-devel] [PATCH 0/6] pc: bring ACPI table size below to 2.0 levels, try fixing -initrd for good Gerd Hoffmann
2014-09-19 8:06 ` Paolo Bonzini
2014-09-19 13:09 ` Paolo Bonzini
2014-10-02 12:11 ` Michael S. Tsirkin
2014-10-02 12:44 ` Paolo Bonzini
2014-10-02 13:30 ` Paolo Bonzini
2014-10-02 13:41 ` Michael S. Tsirkin
2014-10-02 13:43 ` Paolo Bonzini
2014-10-02 13:49 ` Michael S. Tsirkin
2014-10-06 13:42 ` Paolo Bonzini
2014-10-06 13:52 ` Michael S. Tsirkin
2014-10-06 13:55 ` Paolo Bonzini
2014-10-06 14:12 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1411057074-11157-3-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=jsnow@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).