render / rpms / qemu

Forked from rpms/qemu 7 months ago
Clone

Blame 0028-pc-Initializing-ram_memory-under-Xen.patch

298366
From 755ec4ca0f92188458ad7ca549a75161cbdcf6ff Mon Sep 17 00:00:00 2001
298366
From: Anthony PERARD <anthony.perard@citrix.com>
298366
Date: Mon, 9 Sep 2013 16:15:52 +0000
298366
Subject: [PATCH] pc: Initializing ram_memory under Xen.
298366
298366
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
298366
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
298366
Acked-by: Michael S. Tsirkin <mst@redhat.com>
298366
CC: qemu-stable@nongnu.org
298366
(cherry picked from commit 04d7bad8a4fb23e6d9af9d06ce3ddc28a251d94d)
298366
298366
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
298366
---
298366
 hw/i386/pc_piix.c    | 2 +-
298366
 include/hw/xen/xen.h | 4 +---
298366
 xen-all.c            | 7 ++++---
298366
 xen-stub.c           | 2 +-
298366
 4 files changed, 7 insertions(+), 8 deletions(-)
298366
298366
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
298366
index 6e1e654..3df2ff9 100644
298366
--- a/hw/i386/pc_piix.c
298366
+++ b/hw/i386/pc_piix.c
298366
@@ -93,7 +93,7 @@ static void pc_init1(MemoryRegion *system_memory,
298366
     FWCfgState *fw_cfg = NULL;
298366
     PcGuestInfo *guest_info;
298366
 
298366
-    if (xen_enabled() && xen_hvm_init() != 0) {
298366
+    if (xen_enabled() && xen_hvm_init(&ram_memory) != 0) {
298366
         fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
298366
         exit(1);
298366
     }
298366
diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
298366
index 6d42dd1..e1f88bf 100644
298366
--- a/include/hw/xen/xen.h
298366
+++ b/include/hw/xen/xen.h
298366
@@ -37,17 +37,15 @@ void xen_cmos_set_s3_resume(void *opaque, int irq, int level);
298366
 qemu_irq *xen_interrupt_controller_init(void);
298366
 
298366
 int xen_init(void);
298366
-int xen_hvm_init(void);
298366
+int xen_hvm_init(MemoryRegion **ram_memory);
298366
 void xenstore_store_pv_console_info(int i, struct CharDriverState *chr);
298366
 
298366
 #if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY)
298366
-struct MemoryRegion;
298366
 void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
298366
                    struct MemoryRegion *mr);
298366
 void xen_modified_memory(ram_addr_t start, ram_addr_t length);
298366
 #endif
298366
 
298366
-struct MemoryRegion;
298366
 void xen_register_framebuffer(struct MemoryRegion *mr);
298366
 
298366
 #if defined(CONFIG_XEN) && CONFIG_XEN_CTRL_INTERFACE_VERSION < 400
298366
diff --git a/xen-all.c b/xen-all.c
298366
index 21246e0..e1d0694 100644
298366
--- a/xen-all.c
298366
+++ b/xen-all.c
298366
@@ -154,7 +154,7 @@ qemu_irq *xen_interrupt_controller_init(void)
298366
 
298366
 /* Memory Ops */
298366
 
298366
-static void xen_ram_init(ram_addr_t ram_size)
298366
+static void xen_ram_init(ram_addr_t ram_size, MemoryRegion **ram_memory_p)
298366
 {
298366
     MemoryRegion *sysmem = get_system_memory();
298366
     ram_addr_t below_4g_mem_size, above_4g_mem_size = 0;
298366
@@ -168,6 +168,7 @@ static void xen_ram_init(ram_addr_t ram_size)
298366
         block_len += HVM_BELOW_4G_MMIO_LENGTH;
298366
     }
298366
     memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len);
298366
+    *ram_memory_p = &ram_memory;
298366
     vmstate_register_ram_global(&ram_memory);
298366
 
298366
     if (ram_size >= HVM_BELOW_4G_RAM_END) {
298366
@@ -1059,7 +1060,7 @@ static void xen_read_physmap(XenIOState *state)
298366
     free(entries);
298366
 }
298366
 
298366
-int xen_hvm_init(void)
298366
+int xen_hvm_init(MemoryRegion **ram_memory)
298366
 {
298366
     int i, rc;
298366
     unsigned long ioreq_pfn;
298366
@@ -1134,7 +1135,7 @@ int xen_hvm_init(void)
298366
 
298366
     /* Init RAM management */
298366
     xen_map_cache_init(xen_phys_offset_to_gaddr, state);
298366
-    xen_ram_init(ram_size);
298366
+    xen_ram_init(ram_size, ram_memory);
298366
 
298366
     qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state);
298366
 
298366
diff --git a/xen-stub.c b/xen-stub.c
298366
index 47c8e73..ad189a6 100644
298366
--- a/xen-stub.c
298366
+++ b/xen-stub.c
298366
@@ -64,7 +64,7 @@ void xen_modified_memory(ram_addr_t start, ram_addr_t length)
298366
 {
298366
 }
298366
 
298366
-int xen_hvm_init(void)
298366
+int xen_hvm_init(MemoryRegion **ram_memory)
298366
 {
298366
     return 0;
298366
 }