From c12f7299b5d1367b4647a506f6b1f9dfe5abf7c9 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao <xiantao.zhang@intel.com>
Date: Mon, 24 Dec 2007 14:06:31 +0800
Subject: [PATCH] kvm: qemu/ia64: guest with > 3G memory fix.

This patch fix boot issue with >3G memory. Currently, set
TARGET_PHYS_ADDR_SPACE_BITS to 36 bits, and safely support
<64G memory for guests.
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
---
 qemu/exec.c   |    2 ++
 qemu/hw/ipf.c |    2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/qemu/exec.c b/qemu/exec.c
index 69adc5e..de73fde 100644
--- a/qemu/exec.c
+++ b/qemu/exec.c
@@ -81,6 +81,8 @@
 #define TARGET_PHYS_ADDR_SPACE_BITS 32
 #elif TARGET_X86_64
 #define TARGET_PHYS_ADDR_SPACE_BITS 42
+#elif defined(TARGET_IA64)
+#define TARGET_PHYS_ADDR_SPACE_BITS 36
 #else
 #define TARGET_PHYS_ADDR_SPACE_BITS 32
 #endif
diff --git a/qemu/hw/ipf.c b/qemu/hw/ipf.c
index 9c74531..88a897d 100644
--- a/qemu/hw/ipf.c
+++ b/qemu/hw/ipf.c
@@ -443,7 +443,7 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
 		free(image);
 		flush_icache_range((unsigned long)fw_image_start,
 			(unsigned long)fw_image_start + image_size);
-		kvm_ia64_build_hob(ram_size, smp_cpus, fw_start);
+		kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus, fw_start);
 	}
 #endif
 
-- 
1.5.2

