mirror of https://github.com/proxmox/mirror_qemu
pc: Don't prematurely explode QEMUMachineInitArgs
Don't explode QEMUMachineInitArgs before passing it to pc_init1(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>master
parent
9223836745
commit
5650f5f48b
|
@ -61,14 +61,9 @@ static bool has_pvpanic;
|
||||||
static bool has_pci_info = true;
|
static bool has_pci_info = true;
|
||||||
|
|
||||||
/* PC hardware initialisation */
|
/* PC hardware initialisation */
|
||||||
static void pc_init1(MemoryRegion *system_memory,
|
static void pc_init1(QEMUMachineInitArgs *args,
|
||||||
|
MemoryRegion *system_memory,
|
||||||
MemoryRegion *system_io,
|
MemoryRegion *system_io,
|
||||||
ram_addr_t ram_size,
|
|
||||||
const char *boot_device,
|
|
||||||
const char *kernel_filename,
|
|
||||||
const char *kernel_cmdline,
|
|
||||||
const char *initrd_filename,
|
|
||||||
const char *cpu_model,
|
|
||||||
int pci_enabled,
|
int pci_enabled,
|
||||||
int kvmclock_enabled)
|
int kvmclock_enabled)
|
||||||
{
|
{
|
||||||
|
@ -103,18 +98,18 @@ static void pc_init1(MemoryRegion *system_memory,
|
||||||
object_property_add_child(qdev_get_machine(), "icc-bridge",
|
object_property_add_child(qdev_get_machine(), "icc-bridge",
|
||||||
OBJECT(icc_bridge), NULL);
|
OBJECT(icc_bridge), NULL);
|
||||||
|
|
||||||
pc_cpus_init(cpu_model, icc_bridge);
|
pc_cpus_init(args->cpu_model, icc_bridge);
|
||||||
|
|
||||||
if (kvm_enabled() && kvmclock_enabled) {
|
if (kvm_enabled() && kvmclock_enabled) {
|
||||||
kvmclock_create();
|
kvmclock_create();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ram_size >= 0xe0000000 ) {
|
if (args->ram_size >= 0xe0000000) {
|
||||||
above_4g_mem_size = ram_size - 0xe0000000;
|
above_4g_mem_size = args->ram_size - 0xe0000000;
|
||||||
below_4g_mem_size = 0xe0000000;
|
below_4g_mem_size = 0xe0000000;
|
||||||
} else {
|
} else {
|
||||||
above_4g_mem_size = 0;
|
above_4g_mem_size = 0;
|
||||||
below_4g_mem_size = ram_size;
|
below_4g_mem_size = args->ram_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pci_enabled) {
|
if (pci_enabled) {
|
||||||
|
@ -133,7 +128,8 @@ static void pc_init1(MemoryRegion *system_memory,
|
||||||
/* allocate ram and load rom/bios */
|
/* allocate ram and load rom/bios */
|
||||||
if (!xen_enabled()) {
|
if (!xen_enabled()) {
|
||||||
fw_cfg = pc_memory_init(system_memory,
|
fw_cfg = pc_memory_init(system_memory,
|
||||||
kernel_filename, kernel_cmdline, initrd_filename,
|
args->kernel_filename, args->kernel_cmdline,
|
||||||
|
args->initrd_filename,
|
||||||
below_4g_mem_size, above_4g_mem_size,
|
below_4g_mem_size, above_4g_mem_size,
|
||||||
rom_memory, &ram_memory, guest_info);
|
rom_memory, &ram_memory, guest_info);
|
||||||
}
|
}
|
||||||
|
@ -149,7 +145,7 @@ static void pc_init1(MemoryRegion *system_memory,
|
||||||
|
|
||||||
if (pci_enabled) {
|
if (pci_enabled) {
|
||||||
pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
|
pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
|
||||||
system_memory, system_io, ram_size,
|
system_memory, system_io, args->ram_size,
|
||||||
below_4g_mem_size,
|
below_4g_mem_size,
|
||||||
0x100000000ULL - below_4g_mem_size,
|
0x100000000ULL - below_4g_mem_size,
|
||||||
above_4g_mem_size,
|
above_4g_mem_size,
|
||||||
|
@ -208,7 +204,7 @@ static void pc_init1(MemoryRegion *system_memory,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
|
pc_cmos_init(below_4g_mem_size, above_4g_mem_size, args->boot_device,
|
||||||
floppy, idebus[0], idebus[1], rtc_state);
|
floppy, idebus[0], idebus[1], rtc_state);
|
||||||
|
|
||||||
if (pci_enabled && usb_enabled(false)) {
|
if (pci_enabled && usb_enabled(false)) {
|
||||||
|
@ -237,17 +233,7 @@ static void pc_init1(MemoryRegion *system_memory,
|
||||||
|
|
||||||
static void pc_init_pci(QEMUMachineInitArgs *args)
|
static void pc_init_pci(QEMUMachineInitArgs *args)
|
||||||
{
|
{
|
||||||
ram_addr_t ram_size = args->ram_size;
|
pc_init1(args, get_system_memory(), get_system_io(), 1, 1);
|
||||||
const char *cpu_model = args->cpu_model;
|
|
||||||
const char *kernel_filename = args->kernel_filename;
|
|
||||||
const char *kernel_cmdline = args->kernel_cmdline;
|
|
||||||
const char *initrd_filename = args->initrd_filename;
|
|
||||||
const char *boot_device = args->boot_device;
|
|
||||||
pc_init1(get_system_memory(),
|
|
||||||
get_system_io(),
|
|
||||||
ram_size, boot_device,
|
|
||||||
kernel_filename, kernel_cmdline,
|
|
||||||
initrd_filename, cpu_model, 1, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pc_init_pci_1_6(QEMUMachineInitArgs *args)
|
static void pc_init_pci_1_6(QEMUMachineInitArgs *args)
|
||||||
|
@ -293,40 +279,21 @@ static void pc_init_pci_1_0(QEMUMachineInitArgs *args)
|
||||||
/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
|
/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
|
||||||
static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
|
static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
|
||||||
{
|
{
|
||||||
ram_addr_t ram_size = args->ram_size;
|
|
||||||
const char *cpu_model = args->cpu_model;
|
|
||||||
const char *kernel_filename = args->kernel_filename;
|
|
||||||
const char *kernel_cmdline = args->kernel_cmdline;
|
|
||||||
const char *initrd_filename = args->initrd_filename;
|
|
||||||
const char *boot_device = args->boot_device;
|
|
||||||
has_pci_info = false;
|
has_pci_info = false;
|
||||||
disable_kvm_pv_eoi();
|
disable_kvm_pv_eoi();
|
||||||
enable_compat_apic_id_mode();
|
enable_compat_apic_id_mode();
|
||||||
pc_init1(get_system_memory(),
|
pc_init1(args, get_system_memory(), get_system_io(), 1, 0);
|
||||||
get_system_io(),
|
|
||||||
ram_size, boot_device,
|
|
||||||
kernel_filename, kernel_cmdline,
|
|
||||||
initrd_filename, cpu_model, 1, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pc_init_isa(QEMUMachineInitArgs *args)
|
static void pc_init_isa(QEMUMachineInitArgs *args)
|
||||||
{
|
{
|
||||||
ram_addr_t ram_size = args->ram_size;
|
|
||||||
const char *cpu_model = args->cpu_model;
|
|
||||||
const char *kernel_filename = args->kernel_filename;
|
|
||||||
const char *kernel_cmdline = args->kernel_cmdline;
|
|
||||||
const char *initrd_filename = args->initrd_filename;
|
|
||||||
const char *boot_device = args->boot_device;
|
|
||||||
has_pci_info = false;
|
has_pci_info = false;
|
||||||
if (cpu_model == NULL)
|
if (!args->cpu_model) {
|
||||||
cpu_model = "486";
|
args->cpu_model = "486";
|
||||||
|
}
|
||||||
disable_kvm_pv_eoi();
|
disable_kvm_pv_eoi();
|
||||||
enable_compat_apic_id_mode();
|
enable_compat_apic_id_mode();
|
||||||
pc_init1(get_system_memory(),
|
pc_init1(args, get_system_memory(), get_system_io(), 0, 1);
|
||||||
get_system_io(),
|
|
||||||
ram_size, boot_device,
|
|
||||||
kernel_filename, kernel_cmdline,
|
|
||||||
initrd_filename, cpu_model, 0, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_XEN
|
#ifdef CONFIG_XEN
|
||||||
|
|
Loading…
Reference in New Issue