[Qemu-devel] Re: [kvm-devel] [PATCH 1/5] Use correct types to enable 2G support (v3)

2008-02-04 Thread Anthony Liguori

Izik Eidus wrote:

On Mon, 2008-02-04 at 09:11 -0600, Anthony Liguori wrote:
  

KVM supports more than 2GB of memory for x86_64 hosts.  The following patch
fixes a number of type related issues where int's were being used when they
shouldn't have been.  It also introduces CMOS support so the BIOS can build
the appropriate e820 tables.



again, you need patch the bios for this, as the bochs bios doesnt know
how to map memory above 4 giga, and it doesnt know about this CMOS
addresses, (look at the patch that i sent)
  


Right, but the important point is, that in the absence of the bochs 
BIOS, this patch does no harm.


Regards,

Anthony Liguori





[Qemu-devel] Re: [kvm-devel] [PATCH 1/5] Use correct types to enable 2G support (v3)

2008-02-04 Thread Izik Eidus

On Mon, 2008-02-04 at 09:11 -0600, Anthony Liguori wrote:
 KVM supports more than 2GB of memory for x86_64 hosts.  The following patch
 fixes a number of type related issues where int's were being used when they
 shouldn't have been.  It also introduces CMOS support so the BIOS can build
 the appropriate e820 tables.

again, you need patch the bios for this, as the bochs bios doesnt know
how to map memory above 4 giga, and it doesnt know about this CMOS
addresses, (look at the patch that i sent)

 
 For v2 of this patch, I've moved ram_addr_t to cpu-all.h and switched
 ram_size to be a ram_addr_t.  I've also removed the memory limit check for
 x86_64 (provided kqemu isn't enabled) and enabled the use of a 'M' or 'G'
 suffix for the -m option.  I've also tried to do a more thorough job of
 updating the code to use the proper types.
 
 This patch also includes support for setting up  2GB of memory for
 TARGET_I386.  KVM works quite happily with 5GB of ram but I suspect there
 are still some uint32_t's in the non-KVM does not work when using more than
 3GB of RAM.

yes, the patch for kvm was never desgiend to solve the problems qemu
would have with above 4 giga memory.





[Qemu-devel] Re: [kvm-devel] [PATCH 1/5] Use correct types to enable 2G support (v3)

2008-02-04 Thread Izik Eidus

On Mon, 2008-02-04 at 09:33 -0600, Anthony Liguori wrote:
 Izik Eidus wrote:
  On Mon, 2008-02-04 at 09:11 -0600, Anthony Liguori wrote:

  KVM supports more than 2GB of memory for x86_64 hosts.  The following patch
  fixes a number of type related issues where int's were being used when they
  shouldn't have been.  It also introduces CMOS support so the BIOS can build
  the appropriate e820 tables.
  
 
  again, you need patch the bios for this, as the bochs bios doesnt know
  how to map memory above 4 giga, and it doesnt know about this CMOS
  addresses, (look at the patch that i sent)

 
 Right, but the important point is, that in the absence of the bochs 
 BIOS, this patch does no harm.

yes, you are right, but beacuse that i saw that you patching the bios
i thought you wanted to do it as well and just didnt see my email...

 
 Regards,
 
 Anthony Liguori
 





[Qemu-devel] Re: [kvm-devel] [PATCH 1/5] Use correct types to enable 2G support (v3)

2008-02-04 Thread Anthony Liguori

Anthony Liguori wrote:

KVM supports more than 2GB of memory for x86_64 hosts.  The following patch
fixes a number of type related issues where int's were being used when they
shouldn't have been.  It also introduces CMOS support so the BIOS can build
the appropriate e820 tables.

For v2 of this patch, I've moved ram_addr_t to cpu-all.h and switched
ram_size to be a ram_addr_t.  I've also removed the memory limit check for
x86_64 (provided kqemu isn't enabled) and enabled the use of a 'M' or 'G'
suffix for the -m option.  I've also tried to do a more thorough job of
updating the code to use the proper types.

This patch also includes support for setting up  2GB of memory for
TARGET_I386.  KVM works quite happily with 5GB of ram but I suspect there
are still some uint32_t's in the non-KVM does not work when using more than
3GB of RAM.

Since v2, I got rid of an improper declaration of ram_size by moving it from
sysemu.h to cpu-all.h.  I also added some code to handle wrap around in the
'-m' option.  I also eliminated the unnecessary change to TARGET_PAGE_SIZE.
  


My apologies, there was a typo in this patch.  Please apply the attached 
patch (v4) instead.


Regards,

Anthony Liguori
Subject: [PATCH 1/5] Use correct types to enable  2G support (v4)
Cc: Avi Kivity [EMAIL PROTECTED]
Cc: Fabrice Bellard [EMAIL PROTECTED]
Cc: Paul Brook [EMAIL PROTECTED]
Cc: Andrzej Zaborowski [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]

KVM supports more than 2GB of memory for x86_64 hosts.  The following patch
fixes a number of type related issues where int's were being used when they
shouldn't have been.  It also introduces CMOS support so the BIOS can build
the appropriate e820 tables.

For v2 of this patch, I've moved ram_addr_t to cpu-all.h and switched
ram_size to be a ram_addr_t.  I've also removed the memory limit check for
x86_64 (provided kqemu isn't enabled) and enabled the use of a 'M' or 'G'
suffix for the -m option.  I've also tried to do a more thorough job of
updating the code to use the proper types.

This patch also includes support for setting up  2GB of memory for
TARGET_I386.  KVM works quite happily with 5GB of ram but I suspect there
are still some uint32_t's in the non-KVM does not work when using more than
3GB of RAM.

Since v2, I got rid of an improper declaration of ram_size by moving it from
sysemu.h to cpu-all.h.  I also added some code to handle wrap around in the
'-m' option.  I also eliminated the unnecessary change to TARGET_PAGE_SIZE.

Since v3, fix a typo in the -m option.

diff --git a/cpu-all.h b/cpu-all.h
index 7a7e655..cb03072 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -800,12 +800,16 @@ int cpu_inw(CPUState *env, int addr);
 int cpu_inl(CPUState *env, int addr);
 #endif
 
+/* address in the RAM (different from a physical address) */
+typedef unsigned long ram_addr_t;
+
 /* memory API */
 
-extern int phys_ram_size;
+extern ram_addr_t phys_ram_size;
 extern int phys_ram_fd;
 extern uint8_t *phys_ram_base;
 extern uint8_t *phys_ram_dirty;
+extern ram_addr_t ram_size;
 
 /* physical memory access */
 #define TLB_INVALID_MASK   (1  3)
@@ -830,7 +834,7 @@ void cpu_register_physical_memory(target_phys_addr_t start_addr,
   unsigned long size,
   unsigned long phys_offset);
 uint32_t cpu_get_physical_page_desc(target_phys_addr_t addr);
-ram_addr_t qemu_ram_alloc(unsigned int size);
+ram_addr_t qemu_ram_alloc(unsigned long size);
 void qemu_ram_free(ram_addr_t addr);
 int cpu_register_io_memory(int io_index,
CPUReadMemoryFunc **mem_read,
diff --git a/cpu-defs.h b/cpu-defs.h
index 6979c11..60ac4c6 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -76,9 +76,6 @@ typedef uint64_t target_phys_addr_t;
 #error TARGET_PHYS_ADDR_BITS undefined
 #endif
 
-/* address in the RAM (different from a physical address) */
-typedef unsigned long ram_addr_t;
-
 #define HOST_LONG_SIZE (HOST_LONG_BITS / 8)
 
 #define EXCP_INTERRUPT 	0x1 /* async interruption */
diff --git a/exec.c b/exec.c
index e9a5918..1e6ac97 100644
--- a/exec.c
+++ b/exec.c
@@ -73,6 +73,8 @@
 #define TARGET_VIRT_ADDR_SPACE_BITS 42
 #elif defined(TARGET_PPC64)
 #define TARGET_PHYS_ADDR_SPACE_BITS 42
+#elif defined(TARGET_X86_64)  !defined(USE_KQEMU)
+#define TARGET_PHYS_ADDR_SPACE_BITS 42
 #else
 /* Note: for compatibility with kqemu, we use 32 bits for x86_64 */
 #define TARGET_PHYS_ADDR_SPACE_BITS 32
@@ -87,7 +89,7 @@ spinlock_t tb_lock = SPIN_LOCK_UNLOCKED;
 uint8_t code_gen_buffer[CODE_GEN_BUFFER_SIZE] __attribute__((aligned (32)));
 uint8_t *code_gen_ptr;
 
-int phys_ram_size;
+ram_addr_t phys_ram_size;
 int phys_ram_fd;
 uint8_t *phys_ram_base;
 uint8_t *phys_ram_dirty;
@@ -112,7 +114,7 @@ typedef struct PageDesc {
 
 typedef struct PhysPageDesc {
 /* offset in host memory of the page + io_index in the low 12 bits */
-uint32_t phys_offset;
+ram_addr_t phys_offset;
 } PhysPageDesc;
 
 #define L2_BITS 10
@@ -1980,7 +1982,7 @@ static inline