qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH, RFC] More than 2G of memory on 64-bit hosts
@ 2007-06-25 20:16 Blue Swirl
  2007-06-25 20:26 ` Michal Schulz
  2007-06-25 20:28 ` Thiemo Seufer
  0 siblings, 2 replies; 17+ messages in thread
From: Blue Swirl @ 2007-06-25 20:16 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 306 bytes --]

This patch removes the restriction of 2G ram size on 64-bit hosts.
Theoretically Sparc32 on a SS-10 like machine could handle more than
62GB of memory.

There seems to be problems in the boot BIOSes to manage even >2G
memory sizes, I've found some in OpenBIOS but there are still many
left.

Any comments?

[-- Attachment #2: more_mem.diff --]
[-- Type: text/x-diff, Size: 7414 bytes --]

Index: qemu/exec.c
===================================================================
--- qemu.orig/exec.c	2007-06-25 14:50:03.000000000 +0000
+++ qemu/exec.c	2007-06-25 14:50:40.000000000 +0000
@@ -86,7 +86,7 @@
 uint8_t code_gen_buffer[CODE_GEN_BUFFER_SIZE] __attribute__((aligned (32)));
 uint8_t *code_gen_ptr;
 
-int phys_ram_size;
+unsigned long phys_ram_size;
 int phys_ram_fd;
 uint8_t *phys_ram_base;
 uint8_t *phys_ram_dirty;
@@ -111,7 +111,7 @@
 
 typedef struct PhysPageDesc {
     /* offset in host memory of the page + io_index in the low 12 bits */
-    uint32_t phys_offset;
+    unsigned long phys_offset;
 } PhysPageDesc;
 
 #define L2_BITS 10
@@ -1913,7 +1913,7 @@
 
 static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
                              int memory);
-static void *subpage_init (target_phys_addr_t base, uint32_t *phys,
+static void *subpage_init (target_phys_addr_t base, unsigned long *phys,
                            int orig_memory);
 #define CHECK_SUBPAGE(addr, start_addr, start_addr2, end_addr, end_addr2, \
                       need_subpage)                                     \
@@ -2358,7 +2358,7 @@
     return 0;
 }
 
-static void *subpage_init (target_phys_addr_t base, uint32_t *phys,
+static void *subpage_init (target_phys_addr_t base, unsigned long *phys,
                            int orig_memory)
 {
     subpage_t *mmio;
Index: qemu/vl.c
===================================================================
--- qemu.orig/vl.c	2007-06-25 14:50:03.000000000 +0000
+++ qemu/vl.c	2007-06-25 14:50:40.000000000 +0000
@@ -116,7 +116,11 @@
 //#define DEBUG_UNUSED_IOPORT
 //#define DEBUG_IOPORT
 
+#if HOST_LONG_BITS < 64
 #define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024)
+#else
+#define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024 * 1024ULL)
+#endif
 
 #ifdef TARGET_PPC
 #define DEFAULT_RAM_SIZE 144
@@ -151,7 +155,7 @@
 const char* keyboard_layout = NULL;
 int64_t ticks_per_sec;
 int boot_device = 'c';
-int ram_size;
+unsigned long ram_size;
 int pit_min_timer_count = 0;
 int nb_nics;
 NICInfo nd_table[MAX_NICS];
@@ -7453,7 +7457,7 @@
                 help();
                 break;
             case QEMU_OPTION_m:
-                ram_size = atoi(optarg) * 1024 * 1024;
+                ram_size = (unsigned long)atoi(optarg) * 1024 * 1024;
                 if (ram_size <= 0)
                     help();
                 if (ram_size > PHYS_RAM_MAX_SIZE) {
Index: qemu/vl.h
===================================================================
--- qemu.orig/vl.h	2007-06-25 14:50:03.000000000 +0000
+++ qemu/vl.h	2007-06-25 14:50:40.000000000 +0000
@@ -145,7 +145,7 @@
 
 void main_loop_wait(int timeout);
 
-extern int ram_size;
+extern unsigned long ram_size;
 extern int bios_size;
 extern int rtc_utc;
 extern int cirrus_vga_enabled;
@@ -705,7 +705,7 @@
 
 #ifndef QEMU_TOOL
 
-typedef void QEMUMachineInitFunc(int ram_size, int vga_ram_size, 
+typedef void QEMUMachineInitFunc(unsigned long ram_size, int vga_ram_size,
                                  int boot_device,
              DisplayState *ds, const char **fd_filename, int snapshot,
              const char *kernel_filename, const char *kernel_cmdline,
Index: qemu/hw/sun4m.c
===================================================================
--- qemu.orig/hw/sun4m.c	2007-06-25 14:50:36.000000000 +0000
+++ qemu/hw/sun4m.c	2007-06-25 16:16:43.000000000 +0000
@@ -290,7 +290,7 @@
     env->halted = 1;
 }
 
-static void *sun4m_hw_init(const struct hwdef *hwdef, int RAM_size,
+static void *sun4m_hw_init(const struct hwdef *hwdef, unsigned long RAM_size,
                            DisplayState *ds, const char *cpu_model)
 
 {
@@ -390,7 +390,8 @@
     return nvram;
 }
 
-static void sun4m_load_kernel(long vram_size, int RAM_size, int boot_device,
+static void sun4m_load_kernel(long vram_size, unsigned long RAM_size,
+                              int boot_device,
                               const char *kernel_filename,
                               const char *kernel_cmdline,
                               const char *initrd_filename,
@@ -525,17 +526,20 @@
     },
 };
 
-static void sun4m_common_init(int RAM_size, int boot_device, DisplayState *ds,
-                              const char *kernel_filename, const char *kernel_cmdline,
-                              const char *initrd_filename, const char *cpu_model,
-                              unsigned int machine, int max_ram)
+static void sun4m_common_init(unsigned long RAM_size, int boot_device,
+                              DisplayState *ds,
+                              const char *kernel_filename,
+                              const char *kernel_cmdline,
+                              const char *initrd_filename,
+                              const char *cpu_model,
+                              unsigned int machine, unsigned long max_ram)
 {
     void *nvram;
 
-    if ((unsigned int)RAM_size > (unsigned int)max_ram) {
-        fprintf(stderr, "qemu: Too much memory for this machine: %d, maximum %d\n",
-                (unsigned int)RAM_size / (1024 * 1024),
-                (unsigned int)max_ram / (1024 * 1024));
+    if (RAM_size > max_ram) {
+        fprintf(stderr, "qemu: Too much memory for this machine: %ld, maximum %ld\n",
+                RAM_size / (1024 * 1024),
+                max_ram / (1024 * 1024));
         exit(1);
     }
     nvram = sun4m_hw_init(&hwdefs[machine], RAM_size, ds, cpu_model);
@@ -546,10 +550,10 @@
 }
 
 /* SPARCstation 5 hardware initialisation */
-static void ss5_init(int RAM_size, int vga_ram_size, int boot_device,
-                       DisplayState *ds, const char **fd_filename, int snapshot,
-                       const char *kernel_filename, const char *kernel_cmdline,
-                       const char *initrd_filename, const char *cpu_model)
+static void ss5_init(unsigned long RAM_size, int vga_ram_size, int boot_device,
+                     DisplayState *ds, const char **fd_filename, int snapshot,
+                     const char *kernel_filename, const char *kernel_cmdline,
+                     const char *initrd_filename, const char *cpu_model)
 {
     if (cpu_model == NULL)
         cpu_model = "Fujitsu MB86904";
@@ -559,10 +563,10 @@
 }
 
 /* SPARCstation 10 hardware initialisation */
-static void ss10_init(int RAM_size, int vga_ram_size, int boot_device,
-                            DisplayState *ds, const char **fd_filename, int snapshot,
-                            const char *kernel_filename, const char *kernel_cmdline,
-                            const char *initrd_filename, const char *cpu_model)
+static void ss10_init(unsigned long RAM_size, int vga_ram_size, int boot_device,
+                      DisplayState *ds, const char **fd_filename, int snapshot,
+                      const char *kernel_filename, const char *kernel_cmdline,
+                      const char *initrd_filename, const char *cpu_model)
 {
     if (cpu_model == NULL)
         cpu_model = "TI SuperSparc II";
Index: qemu/cpu-all.h
===================================================================
--- qemu.orig/cpu-all.h	2007-06-25 14:50:03.000000000 +0000
+++ qemu/cpu-all.h	2007-06-25 14:50:40.000000000 +0000
@@ -769,7 +769,7 @@
 
 /* memory API */
 
-extern int phys_ram_size;
+extern unsigned long phys_ram_size;
 extern int phys_ram_fd;
 extern uint8_t *phys_ram_base;
 extern uint8_t *phys_ram_dirty;

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2007-07-07  5:24 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-25 20:16 [Qemu-devel] [PATCH, RFC] More than 2G of memory on 64-bit hosts Blue Swirl
2007-06-25 20:26 ` Michal Schulz
2007-06-25 20:52   ` Blue Swirl
2007-06-25 21:08     ` Michal Schulz
2007-06-26  2:03     ` Karl Magdsick
2007-06-26  8:00       ` Thiemo Seufer
2007-06-26 13:54       ` Paul Brook
2007-06-27 10:26         ` Blue Swirl
2007-06-27 10:32           ` Julian Seward
2007-06-27 11:10             ` Thiemo Seufer
2007-06-27 11:20               ` Julian Seward
2007-06-27 12:18                 ` Marius Groeger
2007-06-27 12:32                   ` Thiemo Seufer
2007-07-06 19:20           ` Rob Landley
2007-06-29 14:26       ` Gwenole Beauchesne
2007-06-25 20:28 ` Thiemo Seufer
2007-06-25 20:53   ` Blue Swirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).