aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/pc_q35.c
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2015-08-07 16:55:51 -0300
committerMichael S. Tsirkin <mst@redhat.com>2015-08-13 14:08:28 +0300
commitc0aa4e1ecbcad29bb9f1d654f930300b975c3ba8 (patch)
tree5a5a80b5c57742efdfbab6fcf73fe4008a3e1c76 /hw/i386/pc_q35.c
parent62b160c02ca46f0b5a06cc4416c47708c7ffd76b (diff)
pc: Move {above,below}_4g_mem_size variables to PCMachineState
This will make the info readily available for the other initialization functions, and will allow us to simplify their argument list. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/i386/pc_q35.c')
-rw-r--r--hw/i386/pc_q35.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 6763f0de2f..489dfcb55b 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -66,7 +66,6 @@ static bool has_reserved_memory = true;
static void pc_q35_init(MachineState *machine)
{
PCMachineState *pcms = PC_MACHINE(machine);
- ram_addr_t below_4g_mem_size, above_4g_mem_size;
Q35PCIHost *q35_host;
PCIHostState *phb;
PCIBus *host_bus;
@@ -119,14 +118,15 @@ static void pc_q35_init(MachineState *machine)
}
if (machine->ram_size >= lowmem) {
- above_4g_mem_size = machine->ram_size - lowmem;
- below_4g_mem_size = lowmem;
+ pcms->above_4g_mem_size = machine->ram_size - lowmem;
+ pcms->below_4g_mem_size = lowmem;
} else {
- above_4g_mem_size = 0;
- below_4g_mem_size = machine->ram_size;
+ pcms->above_4g_mem_size = 0;
+ pcms->below_4g_mem_size = machine->ram_size;
}
- if (xen_enabled() && xen_hvm_init(&below_4g_mem_size, &above_4g_mem_size,
+ if (xen_enabled() && xen_hvm_init(&pcms->below_4g_mem_size,
+ &pcms->above_4g_mem_size,
&ram_memory) != 0) {
fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
exit(1);
@@ -151,7 +151,8 @@ static void pc_q35_init(MachineState *machine)
rom_memory = get_system_memory();
}
- guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);
+ guest_info = pc_guest_info_init(pcms->below_4g_mem_size,
+ pcms->above_4g_mem_size);
guest_info->isapc_ram_fw = false;
guest_info->has_acpi_build = has_acpi_build;
guest_info->has_reserved_memory = has_reserved_memory;
@@ -171,7 +172,7 @@ static void pc_q35_init(MachineState *machine)
/* allocate ram and load rom/bios */
if (!xen_enabled()) {
pc_memory_init(pcms, get_system_memory(),
- below_4g_mem_size, above_4g_mem_size,
+ pcms->below_4g_mem_size, pcms->above_4g_mem_size,
rom_memory, &ram_memory, guest_info);
}
@@ -193,8 +194,8 @@ static void pc_q35_init(MachineState *machine)
q35_host->mch.pci_address_space = pci_memory;
q35_host->mch.system_memory = get_system_memory();
q35_host->mch.address_space_io = get_system_io();
- q35_host->mch.below_4g_mem_size = below_4g_mem_size;
- q35_host->mch.above_4g_mem_size = above_4g_mem_size;
+ q35_host->mch.below_4g_mem_size = pcms->below_4g_mem_size;
+ q35_host->mch.above_4g_mem_size = pcms->above_4g_mem_size;
q35_host->mch.guest_info = guest_info;
/* pci */
qdev_init_nofail(DEVICE(q35_host));
@@ -277,7 +278,8 @@ static void pc_q35_init(MachineState *machine)
8, NULL, 0);
pc_cmos_init(pcms,
- below_4g_mem_size, above_4g_mem_size, machine->boot_order,
+ pcms->below_4g_mem_size, pcms->above_4g_mem_size,
+ machine->boot_order,
idebus[0], idebus[1], rtc_state);
/* the rest devices to which pci devfn is automatically assigned */