summaryrefslogtreecommitdiff
path: root/xen-hvm.c
diff options
context:
space:
mode:
authorDon Slutz <dslutz@verizon.com>2014-06-19 21:40:24 -0400
committerMichael S. Tsirkin <mst@redhat.com>2014-06-23 17:50:04 +0300
commit3c2a96699e9fc09b5712dacfe200cdaaff0bb55c (patch)
treedcc1588185a07439d9ec862bb25d92744d1599d6 /xen-hvm.c
parent20de98aff5471f4c849f456d2f9716c748a1c05c (diff)
downloadqemu-3c2a96699e9fc09b5712dacfe200cdaaff0bb55c.tar.gz
qemu-3c2a96699e9fc09b5712dacfe200cdaaff0bb55c.tar.bz2
qemu-3c2a96699e9fc09b5712dacfe200cdaaff0bb55c.zip
xen-hvm: Fix xen_hvm_init() to adjust pc memory layout
This is just below_4g_mem_size and above_4g_mem_size which is used later in QEMU. Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Don Slutz <dslutz@verizon.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'xen-hvm.c')
-rw-r--r--xen-hvm.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/xen-hvm.c b/xen-hvm.c
index aac38efb09..5bcebddf76 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -155,10 +155,11 @@ qemu_irq *xen_interrupt_controller_init(void)
/* Memory Ops */
-static void xen_ram_init(ram_addr_t ram_size, MemoryRegion **ram_memory_p)
+static void xen_ram_init(ram_addr_t *below_4g_mem_size,
+ ram_addr_t *above_4g_mem_size,
+ ram_addr_t ram_size, MemoryRegion **ram_memory_p)
{
MemoryRegion *sysmem = get_system_memory();
- ram_addr_t below_4g_mem_size, above_4g_mem_size = 0;
ram_addr_t block_len;
block_len = ram_size;
@@ -173,10 +174,11 @@ static void xen_ram_init(ram_addr_t ram_size, MemoryRegion **ram_memory_p)
vmstate_register_ram_global(&ram_memory);
if (ram_size >= HVM_BELOW_4G_RAM_END) {
- above_4g_mem_size = ram_size - HVM_BELOW_4G_RAM_END;
- below_4g_mem_size = HVM_BELOW_4G_RAM_END;
+ *above_4g_mem_size = ram_size - HVM_BELOW_4G_RAM_END;
+ *below_4g_mem_size = HVM_BELOW_4G_RAM_END;
} else {
- below_4g_mem_size = ram_size;
+ *above_4g_mem_size = 0;
+ *below_4g_mem_size = ram_size;
}
memory_region_init_alias(&ram_640k, NULL, "xen.ram.640k",
@@ -189,12 +191,13 @@ static void xen_ram_init(ram_addr_t ram_size, MemoryRegion **ram_memory_p)
* the Options ROM, so it is registered here as RAM.
*/
memory_region_init_alias(&ram_lo, NULL, "xen.ram.lo",
- &ram_memory, 0xc0000, below_4g_mem_size - 0xc0000);
+ &ram_memory, 0xc0000,
+ *below_4g_mem_size - 0xc0000);
memory_region_add_subregion(sysmem, 0xc0000, &ram_lo);
- if (above_4g_mem_size > 0) {
+ if (*above_4g_mem_size > 0) {
memory_region_init_alias(&ram_hi, NULL, "xen.ram.hi",
&ram_memory, 0x100000000ULL,
- above_4g_mem_size);
+ *above_4g_mem_size);
memory_region_add_subregion(sysmem, 0x100000000ULL, &ram_hi);
}
}
@@ -958,7 +961,8 @@ static void xen_wakeup_notifier(Notifier *notifier, void *data)
xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 0);
}
-int xen_hvm_init(MemoryRegion **ram_memory)
+int xen_hvm_init(ram_addr_t *below_4g_mem_size, ram_addr_t *above_4g_mem_size,
+ MemoryRegion **ram_memory)
{
int i, rc;
unsigned long ioreq_pfn;
@@ -1036,7 +1040,7 @@ int xen_hvm_init(MemoryRegion **ram_memory)
/* Init RAM management */
xen_map_cache_init(xen_phys_offset_to_gaddr, state);
- xen_ram_init(ram_size, ram_memory);
+ xen_ram_init(below_4g_mem_size, above_4g_mem_size, ram_size, ram_memory);
qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state);