All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
@ 2009-04-28  9:29 ` Zhang, Xiantao
  0 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-04-28  9:29 UTC (permalink / raw)
  To: Avi Kivity, kvm-ia64; +Cc: kvm

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

>From aaf97331da3d6cd34522441218c8c9ab3c1067f6 Mon Sep 17 00:00:00 2001
From: Xiantao Zhang <xiantao.zhang@intel.com>
Date: Tue, 28 Apr 2009 16:55:47 +0800
Subject: [PATCH] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
 
Upstream has dropped phys_ram_base, so ia64 also remove
the dependency for that.
 
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
---
 hw/ipf.c               |   42 +++++++++++++++++++-----------------------
 target-ia64/firmware.c |   25 +++++++++++++++++--------
 target-ia64/firmware.h |    6 +++---
 3 files changed, 39 insertions(+), 34 deletions(-)
 
diff --git a/hw/ipf.c b/hw/ipf.c
index 5ed2667..ccd7665 100644
--- a/hw/ipf.c
+++ b/hw/ipf.c
@@ -54,7 +54,8 @@ static fdctrl_t *floppy_controller;
 static RTCState *rtc_state;
 static PCIDevice *i440fx_state;
 
-uint8_t *g_fw_start;
+ram_addr_t gfw_start;
+
 static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
 {
     return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
@@ -454,15 +455,15 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
     if (kvm_enabled()) {
         unsigned long  image_size;
         char *image = NULL;
-        uint8_t *fw_image_start;
+        ram_addr_t fw_image_start;
         unsigned long nvram_addr = 0;
         unsigned long nvram_fd = 0;
         unsigned long type = READ_FROM_NVRAM;
         unsigned long i = 0;
-        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
-        uint8_t *fw_start = phys_ram_base + fw_offset;
 
-        g_fw_start = fw_start;
+        ram_addr  = qemu_ram_alloc(GFW_SIZE);
+        gfw_start = (ram_addr_t)qemu_get_ram_ptr(ram_addr);
+
         snprintf(buf, sizeof(buf), "%s/%s", bios_dir, FW_FILENAME);
         image = read_image(buf, &image_size );
         if (NULL == image || !image_size) {
@@ -470,20 +471,20 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
             fprintf(stderr, "Please check Guest firmware at %s\n", buf);
             exit(1);
         }
-        fw_image_start = fw_start + GFW_SIZE - image_size;
-
-        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset);
-        memcpy(fw_image_start, image, image_size);
-
-        free(image);
+ /* Load Guest Firmware to the proper postion. */
+        fw_image_start = gfw_start + GFW_SIZE - image_size;
+        memcpy((void *)fw_image_start, image, image_size);
         flush_icache_range((unsigned long)fw_image_start,
                            (unsigned long)fw_image_start + image_size);
+        free(image);
+
+        cpu_register_physical_memory(GFW_START, GFW_SIZE, ram_addr);
 
-        nvram_addr = NVRAM_START;
         if (nvram) {
+            nvram_addr = NVRAM_START;
             nvram_fd = kvm_ia64_nvram_init(type);
             if (nvram_fd != -1) {
-                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, g_fw_start);
+                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, gfw_start);
                 close(nvram_fd);
             }
             i = atexit((void *)kvm_ia64_copy_from_GFW_to_nvram);
@@ -491,7 +492,7 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
                 fprintf(stderr, "cannot set exit function\n");
         }
         kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus,
-                           fw_start, nvram_addr);
+                           gfw_start, nvram_addr);
     }
 
     /*Register legacy io address space, size:64M*/
@@ -513,19 +514,15 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
 
     if (cirrus_vga_enabled) {
         if (pci_enabled) {
-            pci_cirrus_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
+            pci_cirrus_vga_init(pci_bus, vga_ram_size);
         } else {
-            isa_cirrus_vga_init(phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
+            isa_cirrus_vga_init(vga_ram_size);
         }
     } else {
         if (pci_enabled) {
-            pci_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size, 0, 0);
+            pci_vga_init(pci_bus, vga_ram_size, 0, 0);
         } else {
-            isa_vga_init(phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size);
+            isa_vga_init(vga_ram_size);
         }
     }
 
@@ -671,7 +668,6 @@ QEMUMachine ipf_machine = {
     .name = "itanium",
     .desc = "Itanium Platform",
     .init = (QEMUMachineInitFunc *)ipf_init_pci,
-    .ram_require = (ram_addr_t)(VGA_RAM_SIZE + GFW_SIZE),
     .max_cpus = 255,
 };
 
diff --git a/target-ia64/firmware.c b/target-ia64/firmware.c
index 87a8178..2ed2e0d 100644
--- a/target-ia64/firmware.c
+++ b/target-ia64/firmware.c
@@ -92,11 +92,11 @@ static int build_hob(void *hob_buf, unsigned long hob_buf_size,
                      unsigned long dom_mem_size, unsigned long vcpus,
                      unsigned long nvram_addr);
 static int load_hob(void *hob_buf,
-                    unsigned long dom_mem_size, void* hob_start);
+                    unsigned long dom_mem_size, ram_addr_t hob_start);
 
 int
 kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                   uint8_t *fw_start, unsigned long nvram_addr)
+                   ram_addr_t fw_start, unsigned long nvram_addr)
 {
     char   *hob_buf;
 
@@ -249,7 +249,7 @@ err_out:
     return -1;
 }
 static int
-load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
+load_hob(void *hob_buf, unsigned long dom_mem_size, ram_addr_t hob_start)
 {
     int hob_size;
 
@@ -263,7 +263,7 @@ load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
         Hob_Output("No enough memory for hob data");
         return -1;
     }
-    memcpy (hob_start, hob_buf, hob_size);
+    memcpy ((void *)hob_start, hob_buf, hob_size);
     return 0;
 }
 
@@ -644,7 +644,7 @@ out:
 
 int
 kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                const uint8_t *fw_start)
+                                const ram_addr_t fw_start)
 {
     struct stat file_stat;
     if ((fstat(nvram_fd, &file_stat) < 0) ||
@@ -659,8 +659,13 @@ int
 kvm_ia64_copy_from_GFW_to_nvram()
 {
     unsigned long nvram_fd;
+    void* real_nvram_start;
+    target_phys_addr_t nvram_size = NVRAM_SIZE;
     unsigned long type = WRITE_TO_NVRAM;
-    unsigned long *nvram_addr = (unsigned long *)(g_fw_start + NVRAM_OFFSET);
+    unsigned long *nvram_addr = (unsigned long *)(gfw_start + NVRAM_OFFSET);
+
+
+
     nvram_fd = kvm_ia64_nvram_init(type);
     if (nvram_fd  == -1)
         goto out;
@@ -669,11 +674,15 @@ kvm_ia64_copy_from_GFW_to_nvram()
         goto out;
     }
     lseek(nvram_fd, 0, SEEK_SET);
-    if (write(nvram_fd, ((void *)(((struct nvram_save_addr *)nvram_addr)->addr +
-        (char *)phys_ram_base)), NVRAM_SIZE) != NVRAM_SIZE) {
+
+    real_nvram_start = cpu_physical_memory_map(((struct nvram_save_addr*)nvram_addr)->addr,
+ &nvram_size, 1);
+    if (write(nvram_fd, real_nvram_start, NVRAM_SIZE) != NVRAM_SIZE) {
         close(nvram_fd);
         goto out;
     }
+    cpu_physical_memory_unmap(real_nvram_start, NVRAM_SIZE, 1, NVRAM_SIZE);
+
     close(nvram_fd);
     return 0;
 out:
diff --git a/target-ia64/firmware.h b/target-ia64/firmware.h
index c1707ac..548352c 100644
--- a/target-ia64/firmware.h
+++ b/target-ia64/firmware.h
@@ -52,13 +52,13 @@ struct nvram_save_addr {
 };
 
 extern const char *nvram;
-extern uint8_t *g_fw_start;
+extern ram_addr_t gfw_start;
 extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                              uint8_t *fw_start, unsigned long nvram_addr);
+                              ram_addr_t fw_start, unsigned long nvram_addr);
 extern char *read_image(const char *filename, unsigned long *size);
 
 extern int kvm_ia64_copy_from_GFW_to_nvram(void);
 extern int kvm_ia64_nvram_init(unsigned long type);
 extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                           const uint8_t *fw_start);
+                                           const ram_addr_t fw_start);
 #endif //__FIRM_WARE_
-- 
1.6.0
 
 

[-- Attachment #2: 0003-qemu-kvm-Remove-the-dependency-for-phys_ram_base-fo.patch --]
[-- Type: application/octet-stream, Size: 8201 bytes --]

From aaf97331da3d6cd34522441218c8c9ab3c1067f6 Mon Sep 17 00:00:00 2001
From: Xiantao Zhang <xiantao.zhang@intel.com>
Date: Tue, 28 Apr 2009 16:55:47 +0800
Subject: [PATCH] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c

Upstream has dropped phys_ram_base, so ia64 also remove
the dependency for that.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
---
 hw/ipf.c               |   42 +++++++++++++++++++-----------------------
 target-ia64/firmware.c |   25 +++++++++++++++++--------
 target-ia64/firmware.h |    6 +++---
 3 files changed, 39 insertions(+), 34 deletions(-)

diff --git a/hw/ipf.c b/hw/ipf.c
index 5ed2667..ccd7665 100644
--- a/hw/ipf.c
+++ b/hw/ipf.c
@@ -54,7 +54,8 @@ static fdctrl_t *floppy_controller;
 static RTCState *rtc_state;
 static PCIDevice *i440fx_state;
 
-uint8_t *g_fw_start;
+ram_addr_t gfw_start;
+
 static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
 {
     return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
@@ -454,15 +455,15 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
     if (kvm_enabled()) {
         unsigned long  image_size;
         char *image = NULL;
-        uint8_t *fw_image_start;
+        ram_addr_t fw_image_start;
         unsigned long nvram_addr = 0;
         unsigned long nvram_fd = 0;
         unsigned long type = READ_FROM_NVRAM;
         unsigned long i = 0;
-        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
-        uint8_t *fw_start = phys_ram_base + fw_offset;
 
-        g_fw_start = fw_start;
+        ram_addr  = qemu_ram_alloc(GFW_SIZE);
+        gfw_start = (ram_addr_t)qemu_get_ram_ptr(ram_addr);
+
         snprintf(buf, sizeof(buf), "%s/%s", bios_dir, FW_FILENAME);
         image = read_image(buf, &image_size );
         if (NULL == image || !image_size) {
@@ -470,20 +471,20 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
             fprintf(stderr, "Please check Guest firmware at %s\n", buf);
             exit(1);
         }
-        fw_image_start = fw_start + GFW_SIZE - image_size;
-
-        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset);
-        memcpy(fw_image_start, image, image_size);
-
-        free(image);
+	/* Load Guest Firmware to the proper postion. */
+        fw_image_start = gfw_start + GFW_SIZE - image_size;
+        memcpy((void *)fw_image_start, image, image_size);
         flush_icache_range((unsigned long)fw_image_start,
                            (unsigned long)fw_image_start + image_size);
+        free(image);
+
+        cpu_register_physical_memory(GFW_START, GFW_SIZE, ram_addr);
 
-        nvram_addr = NVRAM_START;
         if (nvram) {
+            nvram_addr = NVRAM_START;
             nvram_fd = kvm_ia64_nvram_init(type);
             if (nvram_fd != -1) {
-                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, g_fw_start);
+                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, gfw_start);
                 close(nvram_fd);
             }
             i = atexit((void *)kvm_ia64_copy_from_GFW_to_nvram);
@@ -491,7 +492,7 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
                 fprintf(stderr, "cannot set exit function\n");
         }
         kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus,
-                           fw_start, nvram_addr);
+                           gfw_start, nvram_addr);
     }
 
     /*Register legacy io address space, size:64M*/
@@ -513,19 +514,15 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
 
     if (cirrus_vga_enabled) {
         if (pci_enabled) {
-            pci_cirrus_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
+            pci_cirrus_vga_init(pci_bus, vga_ram_size);
         } else {
-            isa_cirrus_vga_init(phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
+            isa_cirrus_vga_init(vga_ram_size);
         }
     } else {
         if (pci_enabled) {
-            pci_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size, 0, 0);
+            pci_vga_init(pci_bus, vga_ram_size, 0, 0);
         } else {
-            isa_vga_init(phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size);
+            isa_vga_init(vga_ram_size);
         }
     }
 
@@ -671,7 +668,6 @@ QEMUMachine ipf_machine = {
     .name = "itanium",
     .desc = "Itanium Platform",
     .init = (QEMUMachineInitFunc *)ipf_init_pci,
-    .ram_require = (ram_addr_t)(VGA_RAM_SIZE + GFW_SIZE),
     .max_cpus = 255,
 };
 
diff --git a/target-ia64/firmware.c b/target-ia64/firmware.c
index 87a8178..2ed2e0d 100644
--- a/target-ia64/firmware.c
+++ b/target-ia64/firmware.c
@@ -92,11 +92,11 @@ static int build_hob(void *hob_buf, unsigned long hob_buf_size,
                      unsigned long dom_mem_size, unsigned long vcpus,
                      unsigned long nvram_addr);
 static int load_hob(void *hob_buf,
-                    unsigned long dom_mem_size, void* hob_start);
+                    unsigned long dom_mem_size, ram_addr_t hob_start);
 
 int
 kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                   uint8_t *fw_start, unsigned long nvram_addr)
+                   ram_addr_t fw_start, unsigned long nvram_addr)
 {
     char   *hob_buf;
 
@@ -249,7 +249,7 @@ err_out:
     return -1;
 }
 static int
-load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
+load_hob(void *hob_buf, unsigned long dom_mem_size, ram_addr_t hob_start)
 {
     int hob_size;
 
@@ -263,7 +263,7 @@ load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
         Hob_Output("No enough memory for hob data");
         return -1;
     }
-    memcpy (hob_start, hob_buf, hob_size);
+    memcpy ((void *)hob_start, hob_buf, hob_size);
     return 0;
 }
 
@@ -644,7 +644,7 @@ out:
 
 int
 kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                const uint8_t *fw_start)
+                                const ram_addr_t fw_start)
 {
     struct stat file_stat;
     if ((fstat(nvram_fd, &file_stat) < 0) ||
@@ -659,8 +659,13 @@ int
 kvm_ia64_copy_from_GFW_to_nvram()
 {
     unsigned long nvram_fd;
+    void* real_nvram_start;
+    target_phys_addr_t nvram_size = NVRAM_SIZE;
     unsigned long type = WRITE_TO_NVRAM;
-    unsigned long *nvram_addr = (unsigned long *)(g_fw_start + NVRAM_OFFSET);
+    unsigned long *nvram_addr = (unsigned long *)(gfw_start + NVRAM_OFFSET);
+
+
+
     nvram_fd = kvm_ia64_nvram_init(type);
     if (nvram_fd  == -1)
         goto out;
@@ -669,11 +674,15 @@ kvm_ia64_copy_from_GFW_to_nvram()
         goto out;
     }
     lseek(nvram_fd, 0, SEEK_SET);
-    if (write(nvram_fd, ((void *)(((struct nvram_save_addr *)nvram_addr)->addr +
-        (char *)phys_ram_base)), NVRAM_SIZE) != NVRAM_SIZE) {
+
+    real_nvram_start = cpu_physical_memory_map(((struct nvram_save_addr*)nvram_addr)->addr,
+	&nvram_size, 1);
+    if (write(nvram_fd, real_nvram_start, NVRAM_SIZE) != NVRAM_SIZE) {
         close(nvram_fd);
         goto out;
     }
+    cpu_physical_memory_unmap(real_nvram_start, NVRAM_SIZE, 1, NVRAM_SIZE);
+
     close(nvram_fd);
     return 0;
 out:
diff --git a/target-ia64/firmware.h b/target-ia64/firmware.h
index c1707ac..548352c 100644
--- a/target-ia64/firmware.h
+++ b/target-ia64/firmware.h
@@ -52,13 +52,13 @@ struct nvram_save_addr {
 };
 
 extern const char *nvram;
-extern uint8_t *g_fw_start;
+extern ram_addr_t gfw_start;
 extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                              uint8_t *fw_start, unsigned long nvram_addr);
+                              ram_addr_t fw_start, unsigned long nvram_addr);
 extern char *read_image(const char *filename, unsigned long *size);
 
 extern int kvm_ia64_copy_from_GFW_to_nvram(void);
 extern int kvm_ia64_nvram_init(unsigned long type);
 extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                           const uint8_t *fw_start);
+                                           const ram_addr_t fw_start);
 #endif //__FIRM_WARE_
-- 
1.6.0


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

* [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for
@ 2009-04-28  9:29 ` Zhang, Xiantao
  0 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-04-28  9:29 UTC (permalink / raw)
  To: kvm-ia64

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

From aaf97331da3d6cd34522441218c8c9ab3c1067f6 Mon Sep 17 00:00:00 2001
From: Xiantao Zhang <xiantao.zhang@intel.com>
Date: Tue, 28 Apr 2009 16:55:47 +0800
Subject: [PATCH] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
 
Upstream has dropped phys_ram_base, so ia64 also remove
the dependency for that.
 
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
---
 hw/ipf.c               |   42 +++++++++++++++++++-----------------------
 target-ia64/firmware.c |   25 +++++++++++++++++--------
 target-ia64/firmware.h |    6 +++---
 3 files changed, 39 insertions(+), 34 deletions(-)
 
diff --git a/hw/ipf.c b/hw/ipf.c
index 5ed2667..ccd7665 100644
--- a/hw/ipf.c
+++ b/hw/ipf.c
@@ -54,7 +54,8 @@ static fdctrl_t *floppy_controller;
 static RTCState *rtc_state;
 static PCIDevice *i440fx_state;
 
-uint8_t *g_fw_start;
+ram_addr_t gfw_start;
+
 static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
 {
     return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
@@ -454,15 +455,15 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
     if (kvm_enabled()) {
         unsigned long  image_size;
         char *image = NULL;
-        uint8_t *fw_image_start;
+        ram_addr_t fw_image_start;
         unsigned long nvram_addr = 0;
         unsigned long nvram_fd = 0;
         unsigned long type = READ_FROM_NVRAM;
         unsigned long i = 0;
-        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
-        uint8_t *fw_start = phys_ram_base + fw_offset;
 
-        g_fw_start = fw_start;
+        ram_addr  = qemu_ram_alloc(GFW_SIZE);
+        gfw_start = (ram_addr_t)qemu_get_ram_ptr(ram_addr);
+
         snprintf(buf, sizeof(buf), "%s/%s", bios_dir, FW_FILENAME);
         image = read_image(buf, &image_size );
         if (NULL == image || !image_size) {
@@ -470,20 +471,20 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
             fprintf(stderr, "Please check Guest firmware at %s\n", buf);
             exit(1);
         }
-        fw_image_start = fw_start + GFW_SIZE - image_size;
-
-        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset);
-        memcpy(fw_image_start, image, image_size);
-
-        free(image);
+ /* Load Guest Firmware to the proper postion. */
+        fw_image_start = gfw_start + GFW_SIZE - image_size;
+        memcpy((void *)fw_image_start, image, image_size);
         flush_icache_range((unsigned long)fw_image_start,
                            (unsigned long)fw_image_start + image_size);
+        free(image);
+
+        cpu_register_physical_memory(GFW_START, GFW_SIZE, ram_addr);
 
-        nvram_addr = NVRAM_START;
         if (nvram) {
+            nvram_addr = NVRAM_START;
             nvram_fd = kvm_ia64_nvram_init(type);
             if (nvram_fd != -1) {
-                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, g_fw_start);
+                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, gfw_start);
                 close(nvram_fd);
             }
             i = atexit((void *)kvm_ia64_copy_from_GFW_to_nvram);
@@ -491,7 +492,7 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
                 fprintf(stderr, "cannot set exit function\n");
         }
         kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus,
-                           fw_start, nvram_addr);
+                           gfw_start, nvram_addr);
     }
 
     /*Register legacy io address space, size:64M*/
@@ -513,19 +514,15 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
 
     if (cirrus_vga_enabled) {
         if (pci_enabled) {
-            pci_cirrus_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
+            pci_cirrus_vga_init(pci_bus, vga_ram_size);
         } else {
-            isa_cirrus_vga_init(phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
+            isa_cirrus_vga_init(vga_ram_size);
         }
     } else {
         if (pci_enabled) {
-            pci_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size, 0, 0);
+            pci_vga_init(pci_bus, vga_ram_size, 0, 0);
         } else {
-            isa_vga_init(phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size);
+            isa_vga_init(vga_ram_size);
         }
     }
 
@@ -671,7 +668,6 @@ QEMUMachine ipf_machine = {
     .name = "itanium",
     .desc = "Itanium Platform",
     .init = (QEMUMachineInitFunc *)ipf_init_pci,
-    .ram_require = (ram_addr_t)(VGA_RAM_SIZE + GFW_SIZE),
     .max_cpus = 255,
 };
 
diff --git a/target-ia64/firmware.c b/target-ia64/firmware.c
index 87a8178..2ed2e0d 100644
--- a/target-ia64/firmware.c
+++ b/target-ia64/firmware.c
@@ -92,11 +92,11 @@ static int build_hob(void *hob_buf, unsigned long hob_buf_size,
                      unsigned long dom_mem_size, unsigned long vcpus,
                      unsigned long nvram_addr);
 static int load_hob(void *hob_buf,
-                    unsigned long dom_mem_size, void* hob_start);
+                    unsigned long dom_mem_size, ram_addr_t hob_start);
 
 int
 kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                   uint8_t *fw_start, unsigned long nvram_addr)
+                   ram_addr_t fw_start, unsigned long nvram_addr)
 {
     char   *hob_buf;
 
@@ -249,7 +249,7 @@ err_out:
     return -1;
 }
 static int
-load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
+load_hob(void *hob_buf, unsigned long dom_mem_size, ram_addr_t hob_start)
 {
     int hob_size;
 
@@ -263,7 +263,7 @@ load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
         Hob_Output("No enough memory for hob data");
         return -1;
     }
-    memcpy (hob_start, hob_buf, hob_size);
+    memcpy ((void *)hob_start, hob_buf, hob_size);
     return 0;
 }
 
@@ -644,7 +644,7 @@ out:
 
 int
 kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                const uint8_t *fw_start)
+                                const ram_addr_t fw_start)
 {
     struct stat file_stat;
     if ((fstat(nvram_fd, &file_stat) < 0) ||
@@ -659,8 +659,13 @@ int
 kvm_ia64_copy_from_GFW_to_nvram()
 {
     unsigned long nvram_fd;
+    void* real_nvram_start;
+    target_phys_addr_t nvram_size = NVRAM_SIZE;
     unsigned long type = WRITE_TO_NVRAM;
-    unsigned long *nvram_addr = (unsigned long *)(g_fw_start + NVRAM_OFFSET);
+    unsigned long *nvram_addr = (unsigned long *)(gfw_start + NVRAM_OFFSET);
+
+
+
     nvram_fd = kvm_ia64_nvram_init(type);
     if (nvram_fd  == -1)
         goto out;
@@ -669,11 +674,15 @@ kvm_ia64_copy_from_GFW_to_nvram()
         goto out;
     }
     lseek(nvram_fd, 0, SEEK_SET);
-    if (write(nvram_fd, ((void *)(((struct nvram_save_addr *)nvram_addr)->addr +
-        (char *)phys_ram_base)), NVRAM_SIZE) != NVRAM_SIZE) {
+
+    real_nvram_start = cpu_physical_memory_map(((struct nvram_save_addr*)nvram_addr)->addr,
+ &nvram_size, 1);
+    if (write(nvram_fd, real_nvram_start, NVRAM_SIZE) != NVRAM_SIZE) {
         close(nvram_fd);
         goto out;
     }
+    cpu_physical_memory_unmap(real_nvram_start, NVRAM_SIZE, 1, NVRAM_SIZE);
+
     close(nvram_fd);
     return 0;
 out:
diff --git a/target-ia64/firmware.h b/target-ia64/firmware.h
index c1707ac..548352c 100644
--- a/target-ia64/firmware.h
+++ b/target-ia64/firmware.h
@@ -52,13 +52,13 @@ struct nvram_save_addr {
 };
 
 extern const char *nvram;
-extern uint8_t *g_fw_start;
+extern ram_addr_t gfw_start;
 extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                              uint8_t *fw_start, unsigned long nvram_addr);
+                              ram_addr_t fw_start, unsigned long nvram_addr);
 extern char *read_image(const char *filename, unsigned long *size);
 
 extern int kvm_ia64_copy_from_GFW_to_nvram(void);
 extern int kvm_ia64_nvram_init(unsigned long type);
 extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                           const uint8_t *fw_start);
+                                           const ram_addr_t fw_start);
 #endif //__FIRM_WARE_
-- 
1.6.0
 
 

[-- Attachment #2: 0003-qemu-kvm-Remove-the-dependency-for-phys_ram_base-fo.patch --]
[-- Type: application/octet-stream, Size: 8201 bytes --]

From aaf97331da3d6cd34522441218c8c9ab3c1067f6 Mon Sep 17 00:00:00 2001
From: Xiantao Zhang <xiantao.zhang@intel.com>
Date: Tue, 28 Apr 2009 16:55:47 +0800
Subject: [PATCH] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c

Upstream has dropped phys_ram_base, so ia64 also remove
the dependency for that.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
---
 hw/ipf.c               |   42 +++++++++++++++++++-----------------------
 target-ia64/firmware.c |   25 +++++++++++++++++--------
 target-ia64/firmware.h |    6 +++---
 3 files changed, 39 insertions(+), 34 deletions(-)

diff --git a/hw/ipf.c b/hw/ipf.c
index 5ed2667..ccd7665 100644
--- a/hw/ipf.c
+++ b/hw/ipf.c
@@ -54,7 +54,8 @@ static fdctrl_t *floppy_controller;
 static RTCState *rtc_state;
 static PCIDevice *i440fx_state;
 
-uint8_t *g_fw_start;
+ram_addr_t gfw_start;
+
 static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
 {
     return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
@@ -454,15 +455,15 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
     if (kvm_enabled()) {
         unsigned long  image_size;
         char *image = NULL;
-        uint8_t *fw_image_start;
+        ram_addr_t fw_image_start;
         unsigned long nvram_addr = 0;
         unsigned long nvram_fd = 0;
         unsigned long type = READ_FROM_NVRAM;
         unsigned long i = 0;
-        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
-        uint8_t *fw_start = phys_ram_base + fw_offset;
 
-        g_fw_start = fw_start;
+        ram_addr  = qemu_ram_alloc(GFW_SIZE);
+        gfw_start = (ram_addr_t)qemu_get_ram_ptr(ram_addr);
+
         snprintf(buf, sizeof(buf), "%s/%s", bios_dir, FW_FILENAME);
         image = read_image(buf, &image_size );
         if (NULL == image || !image_size) {
@@ -470,20 +471,20 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
             fprintf(stderr, "Please check Guest firmware at %s\n", buf);
             exit(1);
         }
-        fw_image_start = fw_start + GFW_SIZE - image_size;
-
-        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset);
-        memcpy(fw_image_start, image, image_size);
-
-        free(image);
+	/* Load Guest Firmware to the proper postion. */
+        fw_image_start = gfw_start + GFW_SIZE - image_size;
+        memcpy((void *)fw_image_start, image, image_size);
         flush_icache_range((unsigned long)fw_image_start,
                            (unsigned long)fw_image_start + image_size);
+        free(image);
+
+        cpu_register_physical_memory(GFW_START, GFW_SIZE, ram_addr);
 
-        nvram_addr = NVRAM_START;
         if (nvram) {
+            nvram_addr = NVRAM_START;
             nvram_fd = kvm_ia64_nvram_init(type);
             if (nvram_fd != -1) {
-                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, g_fw_start);
+                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, gfw_start);
                 close(nvram_fd);
             }
             i = atexit((void *)kvm_ia64_copy_from_GFW_to_nvram);
@@ -491,7 +492,7 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
                 fprintf(stderr, "cannot set exit function\n");
         }
         kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus,
-                           fw_start, nvram_addr);
+                           gfw_start, nvram_addr);
     }
 
     /*Register legacy io address space, size:64M*/
@@ -513,19 +514,15 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
 
     if (cirrus_vga_enabled) {
         if (pci_enabled) {
-            pci_cirrus_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
+            pci_cirrus_vga_init(pci_bus, vga_ram_size);
         } else {
-            isa_cirrus_vga_init(phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
+            isa_cirrus_vga_init(vga_ram_size);
         }
     } else {
         if (pci_enabled) {
-            pci_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size, 0, 0);
+            pci_vga_init(pci_bus, vga_ram_size, 0, 0);
         } else {
-            isa_vga_init(phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size);
+            isa_vga_init(vga_ram_size);
         }
     }
 
@@ -671,7 +668,6 @@ QEMUMachine ipf_machine = {
     .name = "itanium",
     .desc = "Itanium Platform",
     .init = (QEMUMachineInitFunc *)ipf_init_pci,
-    .ram_require = (ram_addr_t)(VGA_RAM_SIZE + GFW_SIZE),
     .max_cpus = 255,
 };
 
diff --git a/target-ia64/firmware.c b/target-ia64/firmware.c
index 87a8178..2ed2e0d 100644
--- a/target-ia64/firmware.c
+++ b/target-ia64/firmware.c
@@ -92,11 +92,11 @@ static int build_hob(void *hob_buf, unsigned long hob_buf_size,
                      unsigned long dom_mem_size, unsigned long vcpus,
                      unsigned long nvram_addr);
 static int load_hob(void *hob_buf,
-                    unsigned long dom_mem_size, void* hob_start);
+                    unsigned long dom_mem_size, ram_addr_t hob_start);
 
 int
 kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                   uint8_t *fw_start, unsigned long nvram_addr)
+                   ram_addr_t fw_start, unsigned long nvram_addr)
 {
     char   *hob_buf;
 
@@ -249,7 +249,7 @@ err_out:
     return -1;
 }
 static int
-load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
+load_hob(void *hob_buf, unsigned long dom_mem_size, ram_addr_t hob_start)
 {
     int hob_size;
 
@@ -263,7 +263,7 @@ load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
         Hob_Output("No enough memory for hob data");
         return -1;
     }
-    memcpy (hob_start, hob_buf, hob_size);
+    memcpy ((void *)hob_start, hob_buf, hob_size);
     return 0;
 }
 
@@ -644,7 +644,7 @@ out:
 
 int
 kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                const uint8_t *fw_start)
+                                const ram_addr_t fw_start)
 {
     struct stat file_stat;
     if ((fstat(nvram_fd, &file_stat) < 0) ||
@@ -659,8 +659,13 @@ int
 kvm_ia64_copy_from_GFW_to_nvram()
 {
     unsigned long nvram_fd;
+    void* real_nvram_start;
+    target_phys_addr_t nvram_size = NVRAM_SIZE;
     unsigned long type = WRITE_TO_NVRAM;
-    unsigned long *nvram_addr = (unsigned long *)(g_fw_start + NVRAM_OFFSET);
+    unsigned long *nvram_addr = (unsigned long *)(gfw_start + NVRAM_OFFSET);
+
+
+
     nvram_fd = kvm_ia64_nvram_init(type);
     if (nvram_fd  == -1)
         goto out;
@@ -669,11 +674,15 @@ kvm_ia64_copy_from_GFW_to_nvram()
         goto out;
     }
     lseek(nvram_fd, 0, SEEK_SET);
-    if (write(nvram_fd, ((void *)(((struct nvram_save_addr *)nvram_addr)->addr +
-        (char *)phys_ram_base)), NVRAM_SIZE) != NVRAM_SIZE) {
+
+    real_nvram_start = cpu_physical_memory_map(((struct nvram_save_addr*)nvram_addr)->addr,
+	&nvram_size, 1);
+    if (write(nvram_fd, real_nvram_start, NVRAM_SIZE) != NVRAM_SIZE) {
         close(nvram_fd);
         goto out;
     }
+    cpu_physical_memory_unmap(real_nvram_start, NVRAM_SIZE, 1, NVRAM_SIZE);
+
     close(nvram_fd);
     return 0;
 out:
diff --git a/target-ia64/firmware.h b/target-ia64/firmware.h
index c1707ac..548352c 100644
--- a/target-ia64/firmware.h
+++ b/target-ia64/firmware.h
@@ -52,13 +52,13 @@ struct nvram_save_addr {
 };
 
 extern const char *nvram;
-extern uint8_t *g_fw_start;
+extern ram_addr_t gfw_start;
 extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                              uint8_t *fw_start, unsigned long nvram_addr);
+                              ram_addr_t fw_start, unsigned long nvram_addr);
 extern char *read_image(const char *filename, unsigned long *size);
 
 extern int kvm_ia64_copy_from_GFW_to_nvram(void);
 extern int kvm_ia64_nvram_init(unsigned long type);
 extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                           const uint8_t *fw_start);
+                                           const ram_addr_t fw_start);
 #endif //__FIRM_WARE_
-- 
1.6.0


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-28  9:49   ` Avi Kivity
  -1 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-04-28  9:49 UTC (permalink / raw)
  To: Zhang, Xiantao; +Cc: kvm-ia64, kvm

Zhang, Xiantao wrote:
> From aaf97331da3d6cd34522441218c8c9ab3c1067f6 Mon Sep 17 00:00:00 2001
> From: Xiantao Zhang <xiantao.zhang@intel.com>
> Date: Tue, 28 Apr 2009 16:55:47 +0800
> Subject: [PATCH] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
>  
> Upstream has dropped phys_ram_base, so ia64 also remove
> the dependency for that.
>  
> +++ b/hw/ipf.c
> @@ -54,7 +54,8 @@ static fdctrl_t *floppy_controller;
>  static RTCState *rtc_state;
>  static PCIDevice *i440fx_state;
>  
> -uint8_t *g_fw_start;
> +ram_addr_t gfw_start;
> +
>  static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
>  {
>      return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
> @@ -454,15 +455,15 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
>      if (kvm_enabled()) {
>          unsigned long  image_size;
>          char *image = NULL;
> -        uint8_t *fw_image_start;
> +        ram_addr_t fw_image_start;
>          unsigned long nvram_addr = 0;
>          unsigned long nvram_fd = 0;
>          unsigned long type = READ_FROM_NVRAM;
>          unsigned long i = 0;
> -        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
> -        uint8_t *fw_start = phys_ram_base + fw_offset;
>  
> -        g_fw_start = fw_start;
> +        ram_addr  = qemu_ram_alloc(GFW_SIZE);
> +        gfw_start = (ram_addr_t)qemu_get_ram_ptr(ram_addr);
>   

qemu_get_ram_ptr() returns a pointer.  Don't cast it to a ram_addr_t, 
leave it a pointer.

But why not use cpu_physical_memory_write() (or 
cpu_physical_memory_write_rom())?  It's much simpler and cleaner.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-28  9:49   ` Avi Kivity
  0 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-04-28  9:49 UTC (permalink / raw)
  To: kvm-ia64

Zhang, Xiantao wrote:
> From aaf97331da3d6cd34522441218c8c9ab3c1067f6 Mon Sep 17 00:00:00 2001
> From: Xiantao Zhang <xiantao.zhang@intel.com>
> Date: Tue, 28 Apr 2009 16:55:47 +0800
> Subject: [PATCH] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
>  
> Upstream has dropped phys_ram_base, so ia64 also remove
> the dependency for that.
>  
> +++ b/hw/ipf.c
> @@ -54,7 +54,8 @@ static fdctrl_t *floppy_controller;
>  static RTCState *rtc_state;
>  static PCIDevice *i440fx_state;
>  
> -uint8_t *g_fw_start;
> +ram_addr_t gfw_start;
> +
>  static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
>  {
>      return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
> @@ -454,15 +455,15 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
>      if (kvm_enabled()) {
>          unsigned long  image_size;
>          char *image = NULL;
> -        uint8_t *fw_image_start;
> +        ram_addr_t fw_image_start;
>          unsigned long nvram_addr = 0;
>          unsigned long nvram_fd = 0;
>          unsigned long type = READ_FROM_NVRAM;
>          unsigned long i = 0;
> -        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
> -        uint8_t *fw_start = phys_ram_base + fw_offset;
>  
> -        g_fw_start = fw_start;
> +        ram_addr  = qemu_ram_alloc(GFW_SIZE);
> +        gfw_start = (ram_addr_t)qemu_get_ram_ptr(ram_addr);
>   

qemu_get_ram_ptr() returns a pointer.  Don't cast it to a ram_addr_t, 
leave it a pointer.

But why not use cpu_physical_memory_write() (or 
cpu_physical_memory_write_rom())?  It's much simpler and cleaner.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-28 10:36     ` Zhang, Xiantao
  -1 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-04-28 10:36 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-ia64, kvm

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

Avi Kivity wrote:
> Zhang, Xiantao wrote:
>> From aaf97331da3d6cd34522441218c8c9ab3c1067f6 Mon Sep 17 00:00:00
>> 2001 
>> From: Xiantao Zhang <xiantao.zhang@intel.com>
>> Date: Tue, 28 Apr 2009 16:55:47 +0800
>> Subject: [PATCH] qemu-kvm: Remove the dependency for phys_ram_base
>> for ipf.c 
>> 
>> Upstream has dropped phys_ram_base, so ia64 also remove
>> the dependency for that.
>> 
>> +++ b/hw/ipf.c
>> @@ -54,7 +54,8 @@ static fdctrl_t *floppy_controller;  static
>>  RTCState *rtc_state; static PCIDevice *i440fx_state;
>> 
>> -uint8_t *g_fw_start;
>> +ram_addr_t gfw_start;
>> +
>>  static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)  {
>>      return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
>> @@ -454,15 +455,15 @@ static void ipf_init1(ram_addr_t ram_size, int
>>          vga_ram_size,      if (kvm_enabled()) { unsigned long 
>>          image_size; char *image = NULL;
>> -        uint8_t *fw_image_start;
>> +        ram_addr_t fw_image_start;
>>          unsigned long nvram_addr = 0;
>>          unsigned long nvram_fd = 0;
>>          unsigned long type = READ_FROM_NVRAM;
>>          unsigned long i = 0;
>> -        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
>> -        uint8_t *fw_start = phys_ram_base + fw_offset;
>> 
>> -        g_fw_start = fw_start;
>> +        ram_addr  = qemu_ram_alloc(GFW_SIZE);
>> +        gfw_start = (ram_addr_t)qemu_get_ram_ptr(ram_addr);
>> 
> 
> qemu_get_ram_ptr() returns a pointer.  Don't cast it to a ram_addr_t,
> leave it a pointer.
> 
> But why not use cpu_physical_memory_write() (or
> cpu_physical_memory_write_rom())?  It's much simpler and cleaner.

Good suggestion! I just followed the original logic.  Updated the patch. 
Xiantao

[-- Attachment #2: 0003-qemu-kvm-Remove-the-dependency-for-phys_ram_base-fo.patch --]
[-- Type: application/octet-stream, Size: 8680 bytes --]

From ed2542566e800bbd20eeba13d030cafc940e5f39 Mon Sep 17 00:00:00 2001
From: Xiantao Zhang <xiantao.zhang@intel.com>
Date: Tue, 28 Apr 2009 18:25:54 +0800
Subject: [PATCH] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c

Upstream has dropped phys_ram_base, so ia64 also remove
the dependency for that.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
---
 hw/ipf.c               |   43 +++++++++++++++++++------------------------
 target-ia64/firmware.c |   29 +++++++++++++++++++----------
 target-ia64/firmware.h |    8 ++++----
 3 files changed, 42 insertions(+), 38 deletions(-)

diff --git a/hw/ipf.c b/hw/ipf.c
index 5ed2667..7aa9839 100644
--- a/hw/ipf.c
+++ b/hw/ipf.c
@@ -54,7 +54,8 @@ static fdctrl_t *floppy_controller;
 static RTCState *rtc_state;
 static PCIDevice *i440fx_state;
 
-uint8_t *g_fw_start;
+void *gfw_start;
+
 static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
 {
     return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
@@ -453,16 +454,17 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
     /*Load firware to its proper position.*/
     if (kvm_enabled()) {
         unsigned long  image_size;
-        char *image = NULL;
-        uint8_t *fw_image_start;
+        uint8_t *image = NULL;
+        target_phys_addr_t fw_image_start;
         unsigned long nvram_addr = 0;
         unsigned long nvram_fd = 0;
         unsigned long type = READ_FROM_NVRAM;
         unsigned long i = 0;
-        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
-        uint8_t *fw_start = phys_ram_base + fw_offset;
 
-        g_fw_start = fw_start;
+        ram_addr  = qemu_ram_alloc(GFW_SIZE);
+        gfw_start = qemu_get_ram_ptr(ram_addr);
+        cpu_register_physical_memory(GFW_START, GFW_SIZE, ram_addr);
+
         snprintf(buf, sizeof(buf), "%s/%s", bios_dir, FW_FILENAME);
         image = read_image(buf, &image_size );
         if (NULL == image || !image_size) {
@@ -470,20 +472,18 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
             fprintf(stderr, "Please check Guest firmware at %s\n", buf);
             exit(1);
         }
-        fw_image_start = fw_start + GFW_SIZE - image_size;
-
-        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset);
-        memcpy(fw_image_start, image, image_size);
 
+        /* Load Guest Firmware to the proper postion. */
+        fw_image_start = GFW_START + GFW_SIZE - image_size;
+        cpu_physical_memory_write(fw_image_start, image, image_size);
         free(image);
-        flush_icache_range((unsigned long)fw_image_start,
-                           (unsigned long)fw_image_start + image_size);
 
-        nvram_addr = NVRAM_START;
+
         if (nvram) {
+            nvram_addr = NVRAM_START;
             nvram_fd = kvm_ia64_nvram_init(type);
             if (nvram_fd != -1) {
-                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, g_fw_start);
+                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, gfw_start);
                 close(nvram_fd);
             }
             i = atexit((void *)kvm_ia64_copy_from_GFW_to_nvram);
@@ -491,7 +491,7 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
                 fprintf(stderr, "cannot set exit function\n");
         }
         kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus,
-                           fw_start, nvram_addr);
+					gfw_start, nvram_addr);
     }
 
     /*Register legacy io address space, size:64M*/
@@ -513,19 +513,15 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
 
     if (cirrus_vga_enabled) {
         if (pci_enabled) {
-            pci_cirrus_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
+            pci_cirrus_vga_init(pci_bus, vga_ram_size);
         } else {
-            isa_cirrus_vga_init(phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
+            isa_cirrus_vga_init(vga_ram_size);
         }
     } else {
         if (pci_enabled) {
-            pci_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size, 0, 0);
+            pci_vga_init(pci_bus, vga_ram_size, 0, 0);
         } else {
-            isa_vga_init(phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size);
+            isa_vga_init(vga_ram_size);
         }
     }
 
@@ -671,7 +667,6 @@ QEMUMachine ipf_machine = {
     .name = "itanium",
     .desc = "Itanium Platform",
     .init = (QEMUMachineInitFunc *)ipf_init_pci,
-    .ram_require = (ram_addr_t)(VGA_RAM_SIZE + GFW_SIZE),
     .max_cpus = 255,
 };
 
diff --git a/target-ia64/firmware.c b/target-ia64/firmware.c
index 87a8178..ba16bd8 100644
--- a/target-ia64/firmware.c
+++ b/target-ia64/firmware.c
@@ -92,11 +92,11 @@ static int build_hob(void *hob_buf, unsigned long hob_buf_size,
                      unsigned long dom_mem_size, unsigned long vcpus,
                      unsigned long nvram_addr);
 static int load_hob(void *hob_buf,
-                    unsigned long dom_mem_size, void* hob_start);
+                    unsigned long dom_mem_size, void *hob_start);
 
 int
 kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                   uint8_t *fw_start, unsigned long nvram_addr)
+                   void* fw_start, unsigned long nvram_addr)
 {
     char   *hob_buf;
 
@@ -249,7 +249,7 @@ err_out:
     return -1;
 }
 static int
-load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
+load_hob(void *hob_buf, unsigned long dom_mem_size, void *hob_start)
 {
     int hob_size;
 
@@ -263,7 +263,7 @@ load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
         Hob_Output("No enough memory for hob data");
         return -1;
     }
-    memcpy (hob_start, hob_buf, hob_size);
+    memcpy ((void *)hob_start, hob_buf, hob_size);
     return 0;
 }
 
@@ -526,11 +526,11 @@ add_pal_hob(void* hob_buf)
     return 0;
 }
 
-char *read_image(const char *filename, unsigned long *size)
+uint8_t *read_image(const char *filename, unsigned long *size)
 {
     int kernel_fd = -1;
     gzFile kernel_gfd = NULL;
-    char *image = NULL, *tmp;
+    uint8_t *image = NULL, *tmp;
     unsigned int bytes;
 
     if ((filename == NULL) || (size == NULL))
@@ -644,7 +644,7 @@ out:
 
 int
 kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                const uint8_t *fw_start)
+                                const void* fw_start)
 {
     struct stat file_stat;
     if ((fstat(nvram_fd, &file_stat) < 0) ||
@@ -659,8 +659,13 @@ int
 kvm_ia64_copy_from_GFW_to_nvram()
 {
     unsigned long nvram_fd;
+    void* real_nvram_start;
+    target_phys_addr_t nvram_size = NVRAM_SIZE;
     unsigned long type = WRITE_TO_NVRAM;
-    unsigned long *nvram_addr = (unsigned long *)(g_fw_start + NVRAM_OFFSET);
+    unsigned long *nvram_addr = (unsigned long *)(gfw_start + NVRAM_OFFSET);
+
+
+
     nvram_fd = kvm_ia64_nvram_init(type);
     if (nvram_fd  == -1)
         goto out;
@@ -669,11 +674,15 @@ kvm_ia64_copy_from_GFW_to_nvram()
         goto out;
     }
     lseek(nvram_fd, 0, SEEK_SET);
-    if (write(nvram_fd, ((void *)(((struct nvram_save_addr *)nvram_addr)->addr +
-        (char *)phys_ram_base)), NVRAM_SIZE) != NVRAM_SIZE) {
+
+    real_nvram_start = cpu_physical_memory_map(((struct nvram_save_addr*)nvram_addr)->addr,
+	&nvram_size, 1);
+    if (write(nvram_fd, real_nvram_start, NVRAM_SIZE) != NVRAM_SIZE) {
         close(nvram_fd);
         goto out;
     }
+    cpu_physical_memory_unmap(real_nvram_start, NVRAM_SIZE, 1, NVRAM_SIZE);
+
     close(nvram_fd);
     return 0;
 out:
diff --git a/target-ia64/firmware.h b/target-ia64/firmware.h
index c1707ac..132c119 100644
--- a/target-ia64/firmware.h
+++ b/target-ia64/firmware.h
@@ -52,13 +52,13 @@ struct nvram_save_addr {
 };
 
 extern const char *nvram;
-extern uint8_t *g_fw_start;
+extern void *gfw_start;
 extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                              uint8_t *fw_start, unsigned long nvram_addr);
-extern char *read_image(const char *filename, unsigned long *size);
+                              void* fw_start, unsigned long nvram_addr);
+extern uint8_t *read_image(const char *filename, unsigned long *size);
 
 extern int kvm_ia64_copy_from_GFW_to_nvram(void);
 extern int kvm_ia64_nvram_init(unsigned long type);
 extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                           const uint8_t *fw_start);
+                                           const void* fw_start);
 #endif //__FIRM_WARE_
-- 
1.6.0


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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-28 10:36     ` Zhang, Xiantao
  0 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-04-28 10:36 UTC (permalink / raw)
  To: kvm-ia64

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

Avi Kivity wrote:
> Zhang, Xiantao wrote:
>> From aaf97331da3d6cd34522441218c8c9ab3c1067f6 Mon Sep 17 00:00:00
>> 2001 
>> From: Xiantao Zhang <xiantao.zhang@intel.com>
>> Date: Tue, 28 Apr 2009 16:55:47 +0800
>> Subject: [PATCH] qemu-kvm: Remove the dependency for phys_ram_base
>> for ipf.c 
>> 
>> Upstream has dropped phys_ram_base, so ia64 also remove
>> the dependency for that.
>> 
>> +++ b/hw/ipf.c
>> @@ -54,7 +54,8 @@ static fdctrl_t *floppy_controller;  static
>>  RTCState *rtc_state; static PCIDevice *i440fx_state;
>> 
>> -uint8_t *g_fw_start;
>> +ram_addr_t gfw_start;
>> +
>>  static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)  {
>>      return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
>> @@ -454,15 +455,15 @@ static void ipf_init1(ram_addr_t ram_size, int
>>          vga_ram_size,      if (kvm_enabled()) { unsigned long 
>>          image_size; char *image = NULL;
>> -        uint8_t *fw_image_start;
>> +        ram_addr_t fw_image_start;
>>          unsigned long nvram_addr = 0;
>>          unsigned long nvram_fd = 0;
>>          unsigned long type = READ_FROM_NVRAM;
>>          unsigned long i = 0;
>> -        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
>> -        uint8_t *fw_start = phys_ram_base + fw_offset;
>> 
>> -        g_fw_start = fw_start;
>> +        ram_addr  = qemu_ram_alloc(GFW_SIZE);
>> +        gfw_start = (ram_addr_t)qemu_get_ram_ptr(ram_addr);
>> 
> 
> qemu_get_ram_ptr() returns a pointer.  Don't cast it to a ram_addr_t,
> leave it a pointer.
> 
> But why not use cpu_physical_memory_write() (or
> cpu_physical_memory_write_rom())?  It's much simpler and cleaner.

Good suggestion! I just followed the original logic.  Updated the patch. 
Xiantao

[-- Attachment #2: 0003-qemu-kvm-Remove-the-dependency-for-phys_ram_base-fo.patch --]
[-- Type: application/octet-stream, Size: 8680 bytes --]

From ed2542566e800bbd20eeba13d030cafc940e5f39 Mon Sep 17 00:00:00 2001
From: Xiantao Zhang <xiantao.zhang@intel.com>
Date: Tue, 28 Apr 2009 18:25:54 +0800
Subject: [PATCH] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c

Upstream has dropped phys_ram_base, so ia64 also remove
the dependency for that.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
---
 hw/ipf.c               |   43 +++++++++++++++++++------------------------
 target-ia64/firmware.c |   29 +++++++++++++++++++----------
 target-ia64/firmware.h |    8 ++++----
 3 files changed, 42 insertions(+), 38 deletions(-)

diff --git a/hw/ipf.c b/hw/ipf.c
index 5ed2667..7aa9839 100644
--- a/hw/ipf.c
+++ b/hw/ipf.c
@@ -54,7 +54,8 @@ static fdctrl_t *floppy_controller;
 static RTCState *rtc_state;
 static PCIDevice *i440fx_state;
 
-uint8_t *g_fw_start;
+void *gfw_start;
+
 static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
 {
     return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
@@ -453,16 +454,17 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
     /*Load firware to its proper position.*/
     if (kvm_enabled()) {
         unsigned long  image_size;
-        char *image = NULL;
-        uint8_t *fw_image_start;
+        uint8_t *image = NULL;
+        target_phys_addr_t fw_image_start;
         unsigned long nvram_addr = 0;
         unsigned long nvram_fd = 0;
         unsigned long type = READ_FROM_NVRAM;
         unsigned long i = 0;
-        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
-        uint8_t *fw_start = phys_ram_base + fw_offset;
 
-        g_fw_start = fw_start;
+        ram_addr  = qemu_ram_alloc(GFW_SIZE);
+        gfw_start = qemu_get_ram_ptr(ram_addr);
+        cpu_register_physical_memory(GFW_START, GFW_SIZE, ram_addr);
+
         snprintf(buf, sizeof(buf), "%s/%s", bios_dir, FW_FILENAME);
         image = read_image(buf, &image_size );
         if (NULL == image || !image_size) {
@@ -470,20 +472,18 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
             fprintf(stderr, "Please check Guest firmware at %s\n", buf);
             exit(1);
         }
-        fw_image_start = fw_start + GFW_SIZE - image_size;
-
-        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset);
-        memcpy(fw_image_start, image, image_size);
 
+        /* Load Guest Firmware to the proper postion. */
+        fw_image_start = GFW_START + GFW_SIZE - image_size;
+        cpu_physical_memory_write(fw_image_start, image, image_size);
         free(image);
-        flush_icache_range((unsigned long)fw_image_start,
-                           (unsigned long)fw_image_start + image_size);
 
-        nvram_addr = NVRAM_START;
+
         if (nvram) {
+            nvram_addr = NVRAM_START;
             nvram_fd = kvm_ia64_nvram_init(type);
             if (nvram_fd != -1) {
-                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, g_fw_start);
+                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, gfw_start);
                 close(nvram_fd);
             }
             i = atexit((void *)kvm_ia64_copy_from_GFW_to_nvram);
@@ -491,7 +491,7 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
                 fprintf(stderr, "cannot set exit function\n");
         }
         kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus,
-                           fw_start, nvram_addr);
+					gfw_start, nvram_addr);
     }
 
     /*Register legacy io address space, size:64M*/
@@ -513,19 +513,15 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
 
     if (cirrus_vga_enabled) {
         if (pci_enabled) {
-            pci_cirrus_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
+            pci_cirrus_vga_init(pci_bus, vga_ram_size);
         } else {
-            isa_cirrus_vga_init(phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
+            isa_cirrus_vga_init(vga_ram_size);
         }
     } else {
         if (pci_enabled) {
-            pci_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size, 0, 0);
+            pci_vga_init(pci_bus, vga_ram_size, 0, 0);
         } else {
-            isa_vga_init(phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size);
+            isa_vga_init(vga_ram_size);
         }
     }
 
@@ -671,7 +667,6 @@ QEMUMachine ipf_machine = {
     .name = "itanium",
     .desc = "Itanium Platform",
     .init = (QEMUMachineInitFunc *)ipf_init_pci,
-    .ram_require = (ram_addr_t)(VGA_RAM_SIZE + GFW_SIZE),
     .max_cpus = 255,
 };
 
diff --git a/target-ia64/firmware.c b/target-ia64/firmware.c
index 87a8178..ba16bd8 100644
--- a/target-ia64/firmware.c
+++ b/target-ia64/firmware.c
@@ -92,11 +92,11 @@ static int build_hob(void *hob_buf, unsigned long hob_buf_size,
                      unsigned long dom_mem_size, unsigned long vcpus,
                      unsigned long nvram_addr);
 static int load_hob(void *hob_buf,
-                    unsigned long dom_mem_size, void* hob_start);
+                    unsigned long dom_mem_size, void *hob_start);
 
 int
 kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                   uint8_t *fw_start, unsigned long nvram_addr)
+                   void* fw_start, unsigned long nvram_addr)
 {
     char   *hob_buf;
 
@@ -249,7 +249,7 @@ err_out:
     return -1;
 }
 static int
-load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
+load_hob(void *hob_buf, unsigned long dom_mem_size, void *hob_start)
 {
     int hob_size;
 
@@ -263,7 +263,7 @@ load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
         Hob_Output("No enough memory for hob data");
         return -1;
     }
-    memcpy (hob_start, hob_buf, hob_size);
+    memcpy ((void *)hob_start, hob_buf, hob_size);
     return 0;
 }
 
@@ -526,11 +526,11 @@ add_pal_hob(void* hob_buf)
     return 0;
 }
 
-char *read_image(const char *filename, unsigned long *size)
+uint8_t *read_image(const char *filename, unsigned long *size)
 {
     int kernel_fd = -1;
     gzFile kernel_gfd = NULL;
-    char *image = NULL, *tmp;
+    uint8_t *image = NULL, *tmp;
     unsigned int bytes;
 
     if ((filename == NULL) || (size == NULL))
@@ -644,7 +644,7 @@ out:
 
 int
 kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                const uint8_t *fw_start)
+                                const void* fw_start)
 {
     struct stat file_stat;
     if ((fstat(nvram_fd, &file_stat) < 0) ||
@@ -659,8 +659,13 @@ int
 kvm_ia64_copy_from_GFW_to_nvram()
 {
     unsigned long nvram_fd;
+    void* real_nvram_start;
+    target_phys_addr_t nvram_size = NVRAM_SIZE;
     unsigned long type = WRITE_TO_NVRAM;
-    unsigned long *nvram_addr = (unsigned long *)(g_fw_start + NVRAM_OFFSET);
+    unsigned long *nvram_addr = (unsigned long *)(gfw_start + NVRAM_OFFSET);
+
+
+
     nvram_fd = kvm_ia64_nvram_init(type);
     if (nvram_fd  == -1)
         goto out;
@@ -669,11 +674,15 @@ kvm_ia64_copy_from_GFW_to_nvram()
         goto out;
     }
     lseek(nvram_fd, 0, SEEK_SET);
-    if (write(nvram_fd, ((void *)(((struct nvram_save_addr *)nvram_addr)->addr +
-        (char *)phys_ram_base)), NVRAM_SIZE) != NVRAM_SIZE) {
+
+    real_nvram_start = cpu_physical_memory_map(((struct nvram_save_addr*)nvram_addr)->addr,
+	&nvram_size, 1);
+    if (write(nvram_fd, real_nvram_start, NVRAM_SIZE) != NVRAM_SIZE) {
         close(nvram_fd);
         goto out;
     }
+    cpu_physical_memory_unmap(real_nvram_start, NVRAM_SIZE, 1, NVRAM_SIZE);
+
     close(nvram_fd);
     return 0;
 out:
diff --git a/target-ia64/firmware.h b/target-ia64/firmware.h
index c1707ac..132c119 100644
--- a/target-ia64/firmware.h
+++ b/target-ia64/firmware.h
@@ -52,13 +52,13 @@ struct nvram_save_addr {
 };
 
 extern const char *nvram;
-extern uint8_t *g_fw_start;
+extern void *gfw_start;
 extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                              uint8_t *fw_start, unsigned long nvram_addr);
-extern char *read_image(const char *filename, unsigned long *size);
+                              void* fw_start, unsigned long nvram_addr);
+extern uint8_t *read_image(const char *filename, unsigned long *size);
 
 extern int kvm_ia64_copy_from_GFW_to_nvram(void);
 extern int kvm_ia64_nvram_init(unsigned long type);
 extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                           const uint8_t *fw_start);
+                                           const void* fw_start);
 #endif //__FIRM_WARE_
-- 
1.6.0


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-28 11:05       ` Avi Kivity
  -1 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-04-28 11:05 UTC (permalink / raw)
  To: Zhang, Xiantao; +Cc: kvm-ia64, kvm

Zhang, Xiantao wrote:
>>
>> qemu_get_ram_ptr() returns a pointer.  Don't cast it to a ram_addr_t,
>> leave it a pointer.
>>
>> But why not use cpu_physical_memory_write() (or
>> cpu_physical_memory_write_rom())?  It's much simpler and cleaner.
>>     
>
> Good suggestion! I just followed the original logic.  Updated the patch. 
> Xiantao

Thanks, applied.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-28 11:05       ` Avi Kivity
  0 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-04-28 11:05 UTC (permalink / raw)
  To: kvm-ia64

Zhang, Xiantao wrote:
>>
>> qemu_get_ram_ptr() returns a pointer.  Don't cast it to a ram_addr_t,
>> leave it a pointer.
>>
>> But why not use cpu_physical_memory_write() (or
>> cpu_physical_memory_write_rom())?  It's much simpler and cleaner.
>>     
>
> Good suggestion! I just followed the original logic.  Updated the patch. 
> Xiantao

Thanks, applied.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-28 12:38         ` Jes Sorensen
  -1 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-28 12:38 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Zhang, Xiantao, kvm-ia64, kvm

>>>>> "Avi" == Avi Kivity <avi@redhat.com> writes:

Avi> Zhang, Xiantao wrote:
>>>  qemu_get_ram_ptr() returns a pointer.  Don't cast it to a
>>> ram_addr_t, leave it a pointer.
>>> 
>>> But why not use cpu_physical_memory_write() (or
>>> cpu_physical_memory_write_rom())?  It's much simpler and cleaner.
>>> 
>>  Good suggestion! I just followed the original logic.  Updated the
>> patch. Xiantao

Avi> Thanks, applied.

Hi,

I am not crazy about this patch. You need to use cpy_physical_memory_rw()
in the hob and nvram code too, not just in the ipf.c code.

What about the flush_icache_range() call you removed - is it safe to
just discard that?

I was in the process of working through this myself, but I am not
quite finished. If you don't mind waiting a couple hours, I should
have something a fair bit simpler to solve the same problem.

Biggest issue is the flush_icache_range() one.

Cheers,
Jes

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
@ 2009-04-28 12:38         ` Jes Sorensen
  0 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-28 12:38 UTC (permalink / raw)
  To: kvm-ia64

>>>>> "Avi" = Avi Kivity <avi@redhat.com> writes:

Avi> Zhang, Xiantao wrote:
>>>  qemu_get_ram_ptr() returns a pointer.  Don't cast it to a
>>> ram_addr_t, leave it a pointer.
>>> 
>>> But why not use cpu_physical_memory_write() (or
>>> cpu_physical_memory_write_rom())?  It's much simpler and cleaner.
>>> 
>>  Good suggestion! I just followed the original logic.  Updated the
>> patch. Xiantao

Avi> Thanks, applied.

Hi,

I am not crazy about this patch. You need to use cpy_physical_memory_rw()
in the hob and nvram code too, not just in the ipf.c code.

What about the flush_icache_range() call you removed - is it safe to
just discard that?

I was in the process of working through this myself, but I am not
quite finished. If you don't mind waiting a couple hours, I should
have something a fair bit simpler to solve the same problem.

Biggest issue is the flush_icache_range() one.

Cheers,
Jes

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-28 12:49           ` Avi Kivity
  -1 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-04-28 12:49 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: Zhang, Xiantao, kvm-ia64, kvm

Jes Sorensen wrote:
>>>>>> "Avi" == Avi Kivity <avi@redhat.com> writes:
>>>>>>             
>
> Avi> Zhang, Xiantao wrote:
>   
>>>>  qemu_get_ram_ptr() returns a pointer.  Don't cast it to a
>>>> ram_addr_t, leave it a pointer.
>>>>
>>>> But why not use cpu_physical_memory_write() (or
>>>> cpu_physical_memory_write_rom())?  It's much simpler and cleaner.
>>>>
>>>>         
>>>  Good suggestion! I just followed the original logic.  Updated the
>>> patch. Xiantao
>>>       
>
> Avi> Thanks, applied.
>
> Hi,
>
> I am not crazy about this patch. You need to use cpy_physical_memory_rw()
> in the hob and nvram code too, not just in the ipf.c code.
>
> What about the flush_icache_range() call you removed - is it safe to
> just discard that?
>
> I was in the process of working through this myself, but I am not
> quite finished. If you don't mind waiting a couple hours, I should
> have something a fair bit simpler to solve the same problem.
>
> Biggest issue is the flush_icache_range() one.
>
>   

I haven't pushed this out yet, so I can apply a replacement patch.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-28 12:49           ` Avi Kivity
  0 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-04-28 12:49 UTC (permalink / raw)
  To: kvm-ia64

Jes Sorensen wrote:
>>>>>> "Avi" = Avi Kivity <avi@redhat.com> writes:
>>>>>>             
>
> Avi> Zhang, Xiantao wrote:
>   
>>>>  qemu_get_ram_ptr() returns a pointer.  Don't cast it to a
>>>> ram_addr_t, leave it a pointer.
>>>>
>>>> But why not use cpu_physical_memory_write() (or
>>>> cpu_physical_memory_write_rom())?  It's much simpler and cleaner.
>>>>
>>>>         
>>>  Good suggestion! I just followed the original logic.  Updated the
>>> patch. Xiantao
>>>       
>
> Avi> Thanks, applied.
>
> Hi,
>
> I am not crazy about this patch. You need to use cpy_physical_memory_rw()
> in the hob and nvram code too, not just in the ipf.c code.
>
> What about the flush_icache_range() call you removed - is it safe to
> just discard that?
>
> I was in the process of working through this myself, but I am not
> quite finished. If you don't mind waiting a couple hours, I should
> have something a fair bit simpler to solve the same problem.
>
> Biggest issue is the flush_icache_range() one.
>
>   

I haven't pushed this out yet, so I can apply a replacement patch.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-28 15:02             ` Jes Sorensen
  -1 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-28 15:02 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Zhang, Xiantao, kvm-ia64, kvm

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

Avi Kivity wrote:
> Jes Sorensen wrote:
>> Hi,
>>
>> I am not crazy about this patch. You need to use cpy_physical_memory_rw()
>> in the hob and nvram code too, not just in the ipf.c code.
>>
>> What about the flush_icache_range() call you removed - is it safe to
>> just discard that?
>>
>> I was in the process of working through this myself, but I am not
>> quite finished. If you don't mind waiting a couple hours, I should
>> have something a fair bit simpler to solve the same problem.
>>
>> Biggest issue is the flush_icache_range() one.
>>
> I haven't pushed this out yet, so I can apply a replacement patch.

Hi,

As promised here is my proposal for how to implement this patch. I have
made the hob and nvram code use cpu_physical_memory_{read,write} as
well, handled the cache flushing address pointer issue in the flush
function, which needs some improvement to be done later.

By doing this I have been able to remove a bunch of globals and a number
of variables being passed around which we really don't need.

Xiantao, what do you think of this solution?

Cheers,
Jes



[-- Attachment #2: 0100-qemu-ia64-cpu-memory-write.patch --]
[-- Type: text/x-patch, Size: 10366 bytes --]

Remove ia64 dependency on phys_ram_base and assumption that
phys_ram_base + qemu_alloc_ram() is always valid. Use
cpu_physical_memory_{read,write} instead of memcpy.

The behavior of the NVRAM code is questionable, but this code should
behave the same as the old code ... it still needs to be fixed.

flush_icache_range() should also be improved to reget the host pointer
on every page boundary, but at least this is no worse than what we had
before.

Signed-off-by: Jes Sorensen <jes@sgi.com>

---
 hw/ipf.c                |   48 ++++++++++++------------------
 target-ia64/fake-exec.c |   16 ++++++++--
 target-ia64/firmware.c  |   76 +++++++++++++++++++++++++++++++-----------------
 target-ia64/firmware.h  |    8 +----
 4 files changed, 85 insertions(+), 63 deletions(-)

Index: qemu-kvm/hw/ipf.c
===================================================================
--- qemu-kvm.orig/hw/ipf.c
+++ qemu-kvm/hw/ipf.c
@@ -54,7 +54,6 @@
 static RTCState *rtc_state;
 static PCIDevice *i440fx_state;
 
-uint8_t *g_fw_start;
 static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
 {
     return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
@@ -453,16 +452,14 @@
     /*Load firware to its proper position.*/
     if (kvm_enabled()) {
         unsigned long  image_size;
-        char *image = NULL;
-        uint8_t *fw_image_start;
+        uint8_t *image = NULL;
         unsigned long nvram_addr = 0;
         unsigned long nvram_fd = 0;
         unsigned long type = READ_FROM_NVRAM;
         unsigned long i = 0;
-        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
-        uint8_t *fw_start = phys_ram_base + fw_offset;
+        unsigned long fw_offset;
+        ram_addr_t fw_mem = qemu_ram_alloc(GFW_SIZE);
 
-        g_fw_start = fw_start;
         snprintf(buf, sizeof(buf), "%s/%s", bios_dir, FW_FILENAME);
         image = read_image(buf, &image_size );
         if (NULL == image || !image_size) {
@@ -470,28 +467,28 @@
             fprintf(stderr, "Please check Guest firmware at %s\n", buf);
             exit(1);
         }
-        fw_image_start = fw_start + GFW_SIZE - image_size;
+        fw_offset = GFW_START + GFW_SIZE - image_size;
 
-        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset);
-        memcpy(fw_image_start, image, image_size);
+        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_mem);
+        cpu_physical_memory_write(fw_offset, image, image_size);
 
         free(image);
-        flush_icache_range((unsigned long)fw_image_start,
-                           (unsigned long)fw_image_start + image_size);
+
+        flush_icache_range(fw_offset, fw_offset + image_size);
 
         nvram_addr = NVRAM_START;
         if (nvram) {
             nvram_fd = kvm_ia64_nvram_init(type);
             if (nvram_fd != -1) {
-                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, g_fw_start);
+                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd);
                 close(nvram_fd);
             }
             i = atexit((void *)kvm_ia64_copy_from_GFW_to_nvram);
             if (i != 0)
                 fprintf(stderr, "cannot set exit function\n");
         }
-        kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus,
-                           fw_start, nvram_addr);
+
+        kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus, nvram_addr);
     }
 
     /*Register legacy io address space, size:64M*/
@@ -512,21 +509,15 @@
     }
 
     if (cirrus_vga_enabled) {
-        if (pci_enabled) {
-            pci_cirrus_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
-        } else {
-            isa_cirrus_vga_init(phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
-        }
+        if (pci_enabled)
+            pci_cirrus_vga_init(pci_bus, vga_ram_size);
+        else
+            isa_cirrus_vga_init(vga_ram_size);
     } else {
-        if (pci_enabled) {
-            pci_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size, 0, 0);
-        } else {
-            isa_vga_init(phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size);
-        }
+        if (pci_enabled)
+            pci_vga_init(pci_bus, vga_ram_size, 0, 0);
+        else
+            isa_vga_init(vga_ram_size);
     }
 
     rtc_state = rtc_init(0x70, i8259[8], 2000);
@@ -671,7 +662,6 @@
     .name = "itanium",
     .desc = "Itanium Platform",
     .init = (QEMUMachineInitFunc *)ipf_init_pci,
-    .ram_require = (ram_addr_t)(VGA_RAM_SIZE + GFW_SIZE),
     .max_cpus = 255,
 };
 
Index: qemu-kvm/target-ia64/fake-exec.c
===================================================================
--- qemu-kvm.orig/target-ia64/fake-exec.c
+++ qemu-kvm/target-ia64/fake-exec.c
@@ -43,9 +43,19 @@
 
 void flush_icache_range(unsigned long start, unsigned long stop)
 {
-    while (start < stop) {
-	asm volatile ("fc %0" :: "r"(start));
-	start += 32;
+    unsigned long size = stop - start;
+    unsigned long host_start, host_stop;
+
+    /*
+     * This probably should be made more advanced and regrab the pointer
+     * on every page boundary.
+     */
+    host_start = qemu_get_ram_ptr(start);
+    host_end = host_start + size;
+
+    while (host_start < host_stop) {
+	asm volatile ("fc %0" :: "r"(host_start));
+	host_start += 32;
     }
     asm volatile (";;sync.i;;srlz.i;;");
 }
Index: qemu-kvm/target-ia64/firmware.c
===================================================================
--- qemu-kvm.orig/target-ia64/firmware.c
+++ qemu-kvm/target-ia64/firmware.c
@@ -91,12 +91,11 @@
 static int build_hob(void *hob_buf, unsigned long hob_buf_size,
                      unsigned long dom_mem_size, unsigned long vcpus,
                      unsigned long nvram_addr);
-static int load_hob(void *hob_buf,
-                    unsigned long dom_mem_size, void* hob_start);
+static int load_hob(void *hob_buf, unsigned long dom_mem_size);
 
 int
 kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                   uint8_t *fw_start, unsigned long nvram_addr)
+                   unsigned long nvram_addr)
 {
     char   *hob_buf;
 
@@ -111,7 +110,8 @@
         Hob_Output("Could not build hob");
         return -1;
     }
-    if (load_hob(hob_buf, memsize, fw_start + HOB_OFFSET) < 0) {
+
+    if (load_hob(hob_buf, memsize) < 0) {
         free(hob_buf);
         Hob_Output("Could not load hob");
         return -1;
@@ -249,7 +249,7 @@
     return -1;
 }
 static int
-load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
+load_hob(void *hob_buf, unsigned long dom_mem_size)
 {
     int hob_size;
 
@@ -263,7 +263,9 @@
         Hob_Output("No enough memory for hob data");
         return -1;
     }
-    memcpy (hob_start, hob_buf, hob_size);
+
+    cpu_physical_memory_write(GFW_HOB_START, hob_buf, hob_size);
+
     return 0;
 }
 
@@ -526,11 +528,11 @@
     return 0;
 }
 
-char *read_image(const char *filename, unsigned long *size)
+uint8_t *read_image(const char *filename, unsigned long *size)
 {
     int kernel_fd = -1;
     gzFile kernel_gfd = NULL;
-    char *image = NULL, *tmp;
+    uint8_t *image = NULL, *tmp;
     unsigned int bytes;
 
     if ((filename == NULL) || (size == NULL))
@@ -643,41 +645,63 @@
 }
 
 int
-kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                const uint8_t *fw_start)
+kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd)
 {
     struct stat file_stat;
+    uint8_t *nvram_buf;
+    int r = 0;
+
+    nvram_buf = malloc(NVRAM_SIZE);
+
     if ((fstat(nvram_fd, &file_stat) < 0) ||
         (NVRAM_SIZE  != file_stat.st_size) ||
-        (read(nvram_fd, (void *)(fw_start + NVRAM_OFFSET),
-              NVRAM_SIZE) != NVRAM_SIZE))
-        return -1;
-    return 0;
+        (read(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE)) {
+        r = -1;
+        goto out;
+    }
+
+    cpu_physical_memory_write(NVRAM_START, nvram_buf, NVRAM_SIZE);
+
+ out:
+    free(nvram_buf);
+    return r;
 }
 
 int
 kvm_ia64_copy_from_GFW_to_nvram()
 {
+    struct nvram_save_addr nvram_addr_buf;
+    uint8_t *nvram_buf;
     unsigned long nvram_fd;
     unsigned long type = WRITE_TO_NVRAM;
-    unsigned long *nvram_addr = (unsigned long *)(g_fw_start + NVRAM_OFFSET);
+    int ret = -1;
+
+    nvram_buf = malloc(NVRAM_SIZE);
+    if (!nvram_buf)
+        goto out_free;
+
+    cpu_physical_memory_read(NVRAM_START, (uint8_t *)&nvram_addr_buf,
+                             sizeof(struct nvram_save_addr));
+    if (nvram_addr_buf.signature != NVRAM_VALID_SIG) {
+        goto out_free;
+    }
+
+    cpu_physical_memory_read(nvram_addr_buf.addr, nvram_buf, NVRAM_SIZE);
+
     nvram_fd = kvm_ia64_nvram_init(type);
     if (nvram_fd  == -1)
         goto out;
-    if (((struct nvram_save_addr *)nvram_addr)->signature != NVRAM_VALID_SIG) {
-        close(nvram_fd);
-        goto out;
-    }
+
     lseek(nvram_fd, 0, SEEK_SET);
-    if (write(nvram_fd, ((void *)(((struct nvram_save_addr *)nvram_addr)->addr +
-        (char *)phys_ram_base)), NVRAM_SIZE) != NVRAM_SIZE) {
-        close(nvram_fd);
+    if (write(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE)
         goto out;
-    }
+
+    ret = 0;
+ out:
     close(nvram_fd);
-    return 0;
-out:
-    return -1;
+ out_free:
+    free(nvram_buf);
+    return ret;
 }
 
 /*
Index: qemu-kvm/target-ia64/firmware.h
===================================================================
--- qemu-kvm.orig/target-ia64/firmware.h
+++ qemu-kvm/target-ia64/firmware.h
@@ -52,13 +52,11 @@
 };
 
 extern const char *nvram;
-extern uint8_t *g_fw_start;
 extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                              uint8_t *fw_start, unsigned long nvram_addr);
-extern char *read_image(const char *filename, unsigned long *size);
+                              unsigned long nvram_addr);
+extern uint8_t *read_image(const char *filename, unsigned long *size);
 
 extern int kvm_ia64_copy_from_GFW_to_nvram(void);
 extern int kvm_ia64_nvram_init(unsigned long type);
-extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                           const uint8_t *fw_start);
+extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd);
 #endif //__FIRM_WARE_

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-28 15:02             ` Jes Sorensen
  0 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-28 15:02 UTC (permalink / raw)
  To: kvm-ia64

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

Avi Kivity wrote:
> Jes Sorensen wrote:
>> Hi,
>>
>> I am not crazy about this patch. You need to use cpy_physical_memory_rw()
>> in the hob and nvram code too, not just in the ipf.c code.
>>
>> What about the flush_icache_range() call you removed - is it safe to
>> just discard that?
>>
>> I was in the process of working through this myself, but I am not
>> quite finished. If you don't mind waiting a couple hours, I should
>> have something a fair bit simpler to solve the same problem.
>>
>> Biggest issue is the flush_icache_range() one.
>>
> I haven't pushed this out yet, so I can apply a replacement patch.

Hi,

As promised here is my proposal for how to implement this patch. I have
made the hob and nvram code use cpu_physical_memory_{read,write} as
well, handled the cache flushing address pointer issue in the flush
function, which needs some improvement to be done later.

By doing this I have been able to remove a bunch of globals and a number
of variables being passed around which we really don't need.

Xiantao, what do you think of this solution?

Cheers,
Jes



[-- Attachment #2: 0100-qemu-ia64-cpu-memory-write.patch --]
[-- Type: text/x-patch, Size: 10366 bytes --]

Remove ia64 dependency on phys_ram_base and assumption that
phys_ram_base + qemu_alloc_ram() is always valid. Use
cpu_physical_memory_{read,write} instead of memcpy.

The behavior of the NVRAM code is questionable, but this code should
behave the same as the old code ... it still needs to be fixed.

flush_icache_range() should also be improved to reget the host pointer
on every page boundary, but at least this is no worse than what we had
before.

Signed-off-by: Jes Sorensen <jes@sgi.com>

---
 hw/ipf.c                |   48 ++++++++++++------------------
 target-ia64/fake-exec.c |   16 ++++++++--
 target-ia64/firmware.c  |   76 +++++++++++++++++++++++++++++++-----------------
 target-ia64/firmware.h  |    8 +----
 4 files changed, 85 insertions(+), 63 deletions(-)

Index: qemu-kvm/hw/ipf.c
===================================================================
--- qemu-kvm.orig/hw/ipf.c
+++ qemu-kvm/hw/ipf.c
@@ -54,7 +54,6 @@
 static RTCState *rtc_state;
 static PCIDevice *i440fx_state;
 
-uint8_t *g_fw_start;
 static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
 {
     return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
@@ -453,16 +452,14 @@
     /*Load firware to its proper position.*/
     if (kvm_enabled()) {
         unsigned long  image_size;
-        char *image = NULL;
-        uint8_t *fw_image_start;
+        uint8_t *image = NULL;
         unsigned long nvram_addr = 0;
         unsigned long nvram_fd = 0;
         unsigned long type = READ_FROM_NVRAM;
         unsigned long i = 0;
-        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
-        uint8_t *fw_start = phys_ram_base + fw_offset;
+        unsigned long fw_offset;
+        ram_addr_t fw_mem = qemu_ram_alloc(GFW_SIZE);
 
-        g_fw_start = fw_start;
         snprintf(buf, sizeof(buf), "%s/%s", bios_dir, FW_FILENAME);
         image = read_image(buf, &image_size );
         if (NULL == image || !image_size) {
@@ -470,28 +467,28 @@
             fprintf(stderr, "Please check Guest firmware at %s\n", buf);
             exit(1);
         }
-        fw_image_start = fw_start + GFW_SIZE - image_size;
+        fw_offset = GFW_START + GFW_SIZE - image_size;
 
-        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset);
-        memcpy(fw_image_start, image, image_size);
+        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_mem);
+        cpu_physical_memory_write(fw_offset, image, image_size);
 
         free(image);
-        flush_icache_range((unsigned long)fw_image_start,
-                           (unsigned long)fw_image_start + image_size);
+
+        flush_icache_range(fw_offset, fw_offset + image_size);
 
         nvram_addr = NVRAM_START;
         if (nvram) {
             nvram_fd = kvm_ia64_nvram_init(type);
             if (nvram_fd != -1) {
-                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, g_fw_start);
+                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd);
                 close(nvram_fd);
             }
             i = atexit((void *)kvm_ia64_copy_from_GFW_to_nvram);
             if (i != 0)
                 fprintf(stderr, "cannot set exit function\n");
         }
-        kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus,
-                           fw_start, nvram_addr);
+
+        kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus, nvram_addr);
     }
 
     /*Register legacy io address space, size:64M*/
@@ -512,21 +509,15 @@
     }
 
     if (cirrus_vga_enabled) {
-        if (pci_enabled) {
-            pci_cirrus_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
-        } else {
-            isa_cirrus_vga_init(phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
-        }
+        if (pci_enabled)
+            pci_cirrus_vga_init(pci_bus, vga_ram_size);
+        else
+            isa_cirrus_vga_init(vga_ram_size);
     } else {
-        if (pci_enabled) {
-            pci_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size, 0, 0);
-        } else {
-            isa_vga_init(phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size);
-        }
+        if (pci_enabled)
+            pci_vga_init(pci_bus, vga_ram_size, 0, 0);
+        else
+            isa_vga_init(vga_ram_size);
     }
 
     rtc_state = rtc_init(0x70, i8259[8], 2000);
@@ -671,7 +662,6 @@
     .name = "itanium",
     .desc = "Itanium Platform",
     .init = (QEMUMachineInitFunc *)ipf_init_pci,
-    .ram_require = (ram_addr_t)(VGA_RAM_SIZE + GFW_SIZE),
     .max_cpus = 255,
 };
 
Index: qemu-kvm/target-ia64/fake-exec.c
===================================================================
--- qemu-kvm.orig/target-ia64/fake-exec.c
+++ qemu-kvm/target-ia64/fake-exec.c
@@ -43,9 +43,19 @@
 
 void flush_icache_range(unsigned long start, unsigned long stop)
 {
-    while (start < stop) {
-	asm volatile ("fc %0" :: "r"(start));
-	start += 32;
+    unsigned long size = stop - start;
+    unsigned long host_start, host_stop;
+
+    /*
+     * This probably should be made more advanced and regrab the pointer
+     * on every page boundary.
+     */
+    host_start = qemu_get_ram_ptr(start);
+    host_end = host_start + size;
+
+    while (host_start < host_stop) {
+	asm volatile ("fc %0" :: "r"(host_start));
+	host_start += 32;
     }
     asm volatile (";;sync.i;;srlz.i;;");
 }
Index: qemu-kvm/target-ia64/firmware.c
===================================================================
--- qemu-kvm.orig/target-ia64/firmware.c
+++ qemu-kvm/target-ia64/firmware.c
@@ -91,12 +91,11 @@
 static int build_hob(void *hob_buf, unsigned long hob_buf_size,
                      unsigned long dom_mem_size, unsigned long vcpus,
                      unsigned long nvram_addr);
-static int load_hob(void *hob_buf,
-                    unsigned long dom_mem_size, void* hob_start);
+static int load_hob(void *hob_buf, unsigned long dom_mem_size);
 
 int
 kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                   uint8_t *fw_start, unsigned long nvram_addr)
+                   unsigned long nvram_addr)
 {
     char   *hob_buf;
 
@@ -111,7 +110,8 @@
         Hob_Output("Could not build hob");
         return -1;
     }
-    if (load_hob(hob_buf, memsize, fw_start + HOB_OFFSET) < 0) {
+
+    if (load_hob(hob_buf, memsize) < 0) {
         free(hob_buf);
         Hob_Output("Could not load hob");
         return -1;
@@ -249,7 +249,7 @@
     return -1;
 }
 static int
-load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
+load_hob(void *hob_buf, unsigned long dom_mem_size)
 {
     int hob_size;
 
@@ -263,7 +263,9 @@
         Hob_Output("No enough memory for hob data");
         return -1;
     }
-    memcpy (hob_start, hob_buf, hob_size);
+
+    cpu_physical_memory_write(GFW_HOB_START, hob_buf, hob_size);
+
     return 0;
 }
 
@@ -526,11 +528,11 @@
     return 0;
 }
 
-char *read_image(const char *filename, unsigned long *size)
+uint8_t *read_image(const char *filename, unsigned long *size)
 {
     int kernel_fd = -1;
     gzFile kernel_gfd = NULL;
-    char *image = NULL, *tmp;
+    uint8_t *image = NULL, *tmp;
     unsigned int bytes;
 
     if ((filename == NULL) || (size == NULL))
@@ -643,41 +645,63 @@
 }
 
 int
-kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                const uint8_t *fw_start)
+kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd)
 {
     struct stat file_stat;
+    uint8_t *nvram_buf;
+    int r = 0;
+
+    nvram_buf = malloc(NVRAM_SIZE);
+
     if ((fstat(nvram_fd, &file_stat) < 0) ||
         (NVRAM_SIZE  != file_stat.st_size) ||
-        (read(nvram_fd, (void *)(fw_start + NVRAM_OFFSET),
-              NVRAM_SIZE) != NVRAM_SIZE))
-        return -1;
-    return 0;
+        (read(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE)) {
+        r = -1;
+        goto out;
+    }
+
+    cpu_physical_memory_write(NVRAM_START, nvram_buf, NVRAM_SIZE);
+
+ out:
+    free(nvram_buf);
+    return r;
 }
 
 int
 kvm_ia64_copy_from_GFW_to_nvram()
 {
+    struct nvram_save_addr nvram_addr_buf;
+    uint8_t *nvram_buf;
     unsigned long nvram_fd;
     unsigned long type = WRITE_TO_NVRAM;
-    unsigned long *nvram_addr = (unsigned long *)(g_fw_start + NVRAM_OFFSET);
+    int ret = -1;
+
+    nvram_buf = malloc(NVRAM_SIZE);
+    if (!nvram_buf)
+        goto out_free;
+
+    cpu_physical_memory_read(NVRAM_START, (uint8_t *)&nvram_addr_buf,
+                             sizeof(struct nvram_save_addr));
+    if (nvram_addr_buf.signature != NVRAM_VALID_SIG) {
+        goto out_free;
+    }
+
+    cpu_physical_memory_read(nvram_addr_buf.addr, nvram_buf, NVRAM_SIZE);
+
     nvram_fd = kvm_ia64_nvram_init(type);
     if (nvram_fd  == -1)
         goto out;
-    if (((struct nvram_save_addr *)nvram_addr)->signature != NVRAM_VALID_SIG) {
-        close(nvram_fd);
-        goto out;
-    }
+
     lseek(nvram_fd, 0, SEEK_SET);
-    if (write(nvram_fd, ((void *)(((struct nvram_save_addr *)nvram_addr)->addr +
-        (char *)phys_ram_base)), NVRAM_SIZE) != NVRAM_SIZE) {
-        close(nvram_fd);
+    if (write(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE)
         goto out;
-    }
+
+    ret = 0;
+ out:
     close(nvram_fd);
-    return 0;
-out:
-    return -1;
+ out_free:
+    free(nvram_buf);
+    return ret;
 }
 
 /*
Index: qemu-kvm/target-ia64/firmware.h
===================================================================
--- qemu-kvm.orig/target-ia64/firmware.h
+++ qemu-kvm/target-ia64/firmware.h
@@ -52,13 +52,11 @@
 };
 
 extern const char *nvram;
-extern uint8_t *g_fw_start;
 extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                              uint8_t *fw_start, unsigned long nvram_addr);
-extern char *read_image(const char *filename, unsigned long *size);
+                              unsigned long nvram_addr);
+extern uint8_t *read_image(const char *filename, unsigned long *size);
 
 extern int kvm_ia64_copy_from_GFW_to_nvram(void);
 extern int kvm_ia64_nvram_init(unsigned long type);
-extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                           const uint8_t *fw_start);
+extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd);
 #endif //__FIRM_WARE_

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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-29  2:04           ` Zhang, Xiantao
  -1 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-04-29  2:04 UTC (permalink / raw)
  To: Jes Sorensen, Avi Kivity; +Cc: kvm-ia64, kvm

Jes Sorensen wrote:
>>>>>> "Avi" == Avi Kivity <avi@redhat.com> writes:
> 
> Avi> Zhang, Xiantao wrote:
>>>>  qemu_get_ram_ptr() returns a pointer.  Don't cast it to a
>>>> ram_addr_t, leave it a pointer.
>>>> 
>>>> But why not use cpu_physical_memory_write() (or
>>>> cpu_physical_memory_write_rom())?  It's much simpler and cleaner.
>>>> 
>>>  Good suggestion! I just followed the original logic.  Updated the
>>> patch. Xiantao
> 
> Avi> Thanks, applied.
> 
> Hi,

Hi, Jes

> I am not crazy about this patch. You need to use
> cpy_physical_memory_rw() in the hob and nvram code too, not just in
> the ipf.c code. 

Agree, maybe you can make an increment patch for that.

> What about the flush_icache_range() call you removed - is it safe to
> just discard that?"

Yes, I think cpu_physical_memory_write also called the flush_icache_range, so don't need to duplicate it. 

> I was in the process of working through this myself, but I am not
> quite finished. If you don't mind waiting a couple hours, I should
> have something a fair bit simpler to solve the same problem.
> 
> Biggest issue is the flush_icache_range() one.
> 
> Cheers,
> Jes


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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-29  2:04           ` Zhang, Xiantao
  0 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-04-29  2:04 UTC (permalink / raw)
  To: kvm-ia64

Jes Sorensen wrote:
>>>>>> "Avi" = Avi Kivity <avi@redhat.com> writes:
> 
> Avi> Zhang, Xiantao wrote:
>>>>  qemu_get_ram_ptr() returns a pointer.  Don't cast it to a
>>>> ram_addr_t, leave it a pointer.
>>>> 
>>>> But why not use cpu_physical_memory_write() (or
>>>> cpu_physical_memory_write_rom())?  It's much simpler and cleaner.
>>>> 
>>>  Good suggestion! I just followed the original logic.  Updated the
>>> patch. Xiantao
> 
> Avi> Thanks, applied.
> 
> Hi,

Hi, Jes

> I am not crazy about this patch. You need to use
> cpy_physical_memory_rw() in the hob and nvram code too, not just in
> the ipf.c code. 

Agree, maybe you can make an increment patch for that.

> What about the flush_icache_range() call you removed - is it safe to
> just discard that?"

Yes, I think cpu_physical_memory_write also called the flush_icache_range, so don't need to duplicate it. 

> I was in the process of working through this myself, but I am not
> quite finished. If you don't mind waiting a couple hours, I should
> have something a fair bit simpler to solve the same problem.
> 
> Biggest issue is the flush_icache_range() one.
> 
> Cheers,
> Jes


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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-29  2:05             ` Zhang, Xiantao
  -1 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-04-29  2:05 UTC (permalink / raw)
  To: Avi Kivity, Jes Sorensen; +Cc: kvm-ia64, kvm

Avi Kivity wrote:
> Jes Sorensen wrote:
>>>>>>> "Avi" == Avi Kivity <avi@redhat.com> writes:
>>>>>>> 
>> 
>> Avi> Zhang, Xiantao wrote:
>> 
>>>>>  qemu_get_ram_ptr() returns a pointer.  Don't cast it to a
>>>>> ram_addr_t, leave it a pointer.
>>>>> 
>>>>> But why not use cpu_physical_memory_write() (or
>>>>> cpu_physical_memory_write_rom())?  It's much simpler and cleaner.
>>>>> 
>>>>> 
>>>>  Good suggestion! I just followed the original logic.  Updated the
>>>> patch. Xiantao 
>>>> 
>> 
>> Avi> Thanks, applied.
>> 
>> Hi,
>> 
>> I am not crazy about this patch. You need to use
>> cpy_physical_memory_rw() in the hob and nvram code too, not just in
>> the ipf.c code. 
>> 
>> What about the flush_icache_range() call you removed - is it safe to
>> just discard that? 
>> 
>> I was in the process of working through this myself, but I am not
>> quite finished. If you don't mind waiting a couple hours, I should
>> have something a fair bit simpler to solve the same problem.
>> 
>> Biggest issue is the flush_icache_range() one.
>> 
>> 
> 
> I haven't pushed this out yet, so I can apply a replacement patch. 

We don't need flush_icache_range here, because I believe it is called in cpu_physical_memory_write. 
Xiantao

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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-29  2:05             ` Zhang, Xiantao
  0 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-04-29  2:05 UTC (permalink / raw)
  To: kvm-ia64

Avi Kivity wrote:
> Jes Sorensen wrote:
>>>>>>> "Avi" = Avi Kivity <avi@redhat.com> writes:
>>>>>>> 
>> 
>> Avi> Zhang, Xiantao wrote:
>> 
>>>>>  qemu_get_ram_ptr() returns a pointer.  Don't cast it to a
>>>>> ram_addr_t, leave it a pointer.
>>>>> 
>>>>> But why not use cpu_physical_memory_write() (or
>>>>> cpu_physical_memory_write_rom())?  It's much simpler and cleaner.
>>>>> 
>>>>> 
>>>>  Good suggestion! I just followed the original logic.  Updated the
>>>> patch. Xiantao 
>>>> 
>> 
>> Avi> Thanks, applied.
>> 
>> Hi,
>> 
>> I am not crazy about this patch. You need to use
>> cpy_physical_memory_rw() in the hob and nvram code too, not just in
>> the ipf.c code. 
>> 
>> What about the flush_icache_range() call you removed - is it safe to
>> just discard that? 
>> 
>> I was in the process of working through this myself, but I am not
>> quite finished. If you don't mind waiting a couple hours, I should
>> have something a fair bit simpler to solve the same problem.
>> 
>> Biggest issue is the flush_icache_range() one.
>> 
>> 
> 
> I haven't pushed this out yet, so I can apply a replacement patch. 

We don't need flush_icache_range here, because I believe it is called in cpu_physical_memory_write. 
Xiantao

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-29  8:21               ` Jes Sorensen
  -1 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-29  8:21 UTC (permalink / raw)
  To: Zhang, Xiantao; +Cc: Avi Kivity, kvm-ia64, kvm

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

Zhang, Xiantao wrote:
> Avi Kivity wrote:
>> I haven't pushed this out yet, so I can apply a replacement patch. 
> 
> We don't need flush_icache_range here, because I believe it is called in cpu_physical_memory_write. 
> Xiantao

Hi Xiantao,

Good point, I hadn't spotted that, and worse I mangled
flush_icache_range() in the process, trying to be smart :-(

Here's a version without cache flush changes, it should do the right
thing<tm>. We still need to look at the nvram stuff, but that is broken
in all setups currently.

What do you think of this one?

Cheers,
Jes


[-- Attachment #2: 0100-qemu-ia64-cpu-memory-write.patch --]
[-- Type: text/x-patch, Size: 9301 bytes --]

Remove ia64 dependency on phys_ram_base and assumption that
phys_ram_base + qemu_alloc_ram() is always valid. Use
cpu_physical_memory_{read,write} instead of memcpy.

The behavior of the NVRAM code is questionable, but this code should
behave the same as the old code ... it still needs to be fixed.

Signed-off-by: Jes Sorensen <jes@sgi.com>

---
 hw/ipf.c               |   46 ++++++++++-------------------
 target-ia64/firmware.c |   76 ++++++++++++++++++++++++++++++++-----------------
 target-ia64/firmware.h |    8 +----
 3 files changed, 70 insertions(+), 60 deletions(-)

Index: qemu-kvm/hw/ipf.c
===================================================================
--- qemu-kvm.orig/hw/ipf.c
+++ qemu-kvm/hw/ipf.c
@@ -54,7 +54,6 @@
 static RTCState *rtc_state;
 static PCIDevice *i440fx_state;
 
-uint8_t *g_fw_start;
 static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
 {
     return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
@@ -453,16 +452,14 @@
     /*Load firware to its proper position.*/
     if (kvm_enabled()) {
         unsigned long  image_size;
-        char *image = NULL;
-        uint8_t *fw_image_start;
+        uint8_t *image = NULL;
         unsigned long nvram_addr = 0;
         unsigned long nvram_fd = 0;
         unsigned long type = READ_FROM_NVRAM;
         unsigned long i = 0;
-        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
-        uint8_t *fw_start = phys_ram_base + fw_offset;
+        unsigned long fw_offset;
+        ram_addr_t fw_mem = qemu_ram_alloc(GFW_SIZE);
 
-        g_fw_start = fw_start;
         snprintf(buf, sizeof(buf), "%s/%s", bios_dir, FW_FILENAME);
         image = read_image(buf, &image_size );
         if (NULL == image || !image_size) {
@@ -470,28 +467,26 @@
             fprintf(stderr, "Please check Guest firmware at %s\n", buf);
             exit(1);
         }
-        fw_image_start = fw_start + GFW_SIZE - image_size;
+        fw_offset = GFW_START + GFW_SIZE - image_size;
 
-        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset);
-        memcpy(fw_image_start, image, image_size);
+        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_mem);
+        cpu_physical_memory_write(fw_offset, image, image_size);
 
         free(image);
-        flush_icache_range((unsigned long)fw_image_start,
-                           (unsigned long)fw_image_start + image_size);
 
         nvram_addr = NVRAM_START;
         if (nvram) {
             nvram_fd = kvm_ia64_nvram_init(type);
             if (nvram_fd != -1) {
-                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, g_fw_start);
+                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd);
                 close(nvram_fd);
             }
             i = atexit((void *)kvm_ia64_copy_from_GFW_to_nvram);
             if (i != 0)
                 fprintf(stderr, "cannot set exit function\n");
         }
-        kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus,
-                           fw_start, nvram_addr);
+
+        kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus, nvram_addr);
     }
 
     /*Register legacy io address space, size:64M*/
@@ -512,21 +507,15 @@
     }
 
     if (cirrus_vga_enabled) {
-        if (pci_enabled) {
-            pci_cirrus_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
-        } else {
-            isa_cirrus_vga_init(phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
-        }
+        if (pci_enabled)
+            pci_cirrus_vga_init(pci_bus, vga_ram_size);
+        else
+            isa_cirrus_vga_init(vga_ram_size);
     } else {
-        if (pci_enabled) {
-            pci_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size, 0, 0);
-        } else {
-            isa_vga_init(phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size);
-        }
+        if (pci_enabled)
+            pci_vga_init(pci_bus, vga_ram_size, 0, 0);
+        else
+            isa_vga_init(vga_ram_size);
     }
 
     rtc_state = rtc_init(0x70, i8259[8], 2000);
@@ -671,7 +660,6 @@
     .name = "itanium",
     .desc = "Itanium Platform",
     .init = (QEMUMachineInitFunc *)ipf_init_pci,
-    .ram_require = (ram_addr_t)(VGA_RAM_SIZE + GFW_SIZE),
     .max_cpus = 255,
 };
 
Index: qemu-kvm/target-ia64/firmware.c
===================================================================
--- qemu-kvm.orig/target-ia64/firmware.c
+++ qemu-kvm/target-ia64/firmware.c
@@ -91,12 +91,11 @@
 static int build_hob(void *hob_buf, unsigned long hob_buf_size,
                      unsigned long dom_mem_size, unsigned long vcpus,
                      unsigned long nvram_addr);
-static int load_hob(void *hob_buf,
-                    unsigned long dom_mem_size, void* hob_start);
+static int load_hob(void *hob_buf, unsigned long dom_mem_size);
 
 int
 kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                   uint8_t *fw_start, unsigned long nvram_addr)
+                   unsigned long nvram_addr)
 {
     char   *hob_buf;
 
@@ -111,7 +110,8 @@
         Hob_Output("Could not build hob");
         return -1;
     }
-    if (load_hob(hob_buf, memsize, fw_start + HOB_OFFSET) < 0) {
+
+    if (load_hob(hob_buf, memsize) < 0) {
         free(hob_buf);
         Hob_Output("Could not load hob");
         return -1;
@@ -249,7 +249,7 @@
     return -1;
 }
 static int
-load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
+load_hob(void *hob_buf, unsigned long dom_mem_size)
 {
     int hob_size;
 
@@ -263,7 +263,9 @@
         Hob_Output("No enough memory for hob data");
         return -1;
     }
-    memcpy (hob_start, hob_buf, hob_size);
+
+    cpu_physical_memory_write(GFW_HOB_START, hob_buf, hob_size);
+
     return 0;
 }
 
@@ -526,11 +528,11 @@
     return 0;
 }
 
-char *read_image(const char *filename, unsigned long *size)
+uint8_t *read_image(const char *filename, unsigned long *size)
 {
     int kernel_fd = -1;
     gzFile kernel_gfd = NULL;
-    char *image = NULL, *tmp;
+    uint8_t *image = NULL, *tmp;
     unsigned int bytes;
 
     if ((filename == NULL) || (size == NULL))
@@ -643,41 +645,63 @@
 }
 
 int
-kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                const uint8_t *fw_start)
+kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd)
 {
     struct stat file_stat;
+    uint8_t *nvram_buf;
+    int r = 0;
+
+    nvram_buf = malloc(NVRAM_SIZE);
+
     if ((fstat(nvram_fd, &file_stat) < 0) ||
         (NVRAM_SIZE  != file_stat.st_size) ||
-        (read(nvram_fd, (void *)(fw_start + NVRAM_OFFSET),
-              NVRAM_SIZE) != NVRAM_SIZE))
-        return -1;
-    return 0;
+        (read(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE)) {
+        r = -1;
+        goto out;
+    }
+
+    cpu_physical_memory_write(NVRAM_START, nvram_buf, NVRAM_SIZE);
+
+ out:
+    free(nvram_buf);
+    return r;
 }
 
 int
 kvm_ia64_copy_from_GFW_to_nvram()
 {
+    struct nvram_save_addr nvram_addr_buf;
+    uint8_t *nvram_buf;
     unsigned long nvram_fd;
     unsigned long type = WRITE_TO_NVRAM;
-    unsigned long *nvram_addr = (unsigned long *)(g_fw_start + NVRAM_OFFSET);
+    int ret = -1;
+
+    nvram_buf = malloc(NVRAM_SIZE);
+    if (!nvram_buf)
+        goto out_free;
+
+    cpu_physical_memory_read(NVRAM_START, (uint8_t *)&nvram_addr_buf,
+                             sizeof(struct nvram_save_addr));
+    if (nvram_addr_buf.signature != NVRAM_VALID_SIG) {
+        goto out_free;
+    }
+
+    cpu_physical_memory_read(nvram_addr_buf.addr, nvram_buf, NVRAM_SIZE);
+
     nvram_fd = kvm_ia64_nvram_init(type);
     if (nvram_fd  == -1)
         goto out;
-    if (((struct nvram_save_addr *)nvram_addr)->signature != NVRAM_VALID_SIG) {
-        close(nvram_fd);
-        goto out;
-    }
+
     lseek(nvram_fd, 0, SEEK_SET);
-    if (write(nvram_fd, ((void *)(((struct nvram_save_addr *)nvram_addr)->addr +
-        (char *)phys_ram_base)), NVRAM_SIZE) != NVRAM_SIZE) {
-        close(nvram_fd);
+    if (write(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE)
         goto out;
-    }
+
+    ret = 0;
+ out:
     close(nvram_fd);
-    return 0;
-out:
-    return -1;
+ out_free:
+    free(nvram_buf);
+    return ret;
 }
 
 /*
Index: qemu-kvm/target-ia64/firmware.h
===================================================================
--- qemu-kvm.orig/target-ia64/firmware.h
+++ qemu-kvm/target-ia64/firmware.h
@@ -52,13 +52,11 @@
 };
 
 extern const char *nvram;
-extern uint8_t *g_fw_start;
 extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                              uint8_t *fw_start, unsigned long nvram_addr);
-extern char *read_image(const char *filename, unsigned long *size);
+                              unsigned long nvram_addr);
+extern uint8_t *read_image(const char *filename, unsigned long *size);
 
 extern int kvm_ia64_copy_from_GFW_to_nvram(void);
 extern int kvm_ia64_nvram_init(unsigned long type);
-extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                           const uint8_t *fw_start);
+extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd);
 #endif //__FIRM_WARE_

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-29  8:21               ` Jes Sorensen
  0 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-29  8:21 UTC (permalink / raw)
  To: kvm-ia64

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

Zhang, Xiantao wrote:
> Avi Kivity wrote:
>> I haven't pushed this out yet, so I can apply a replacement patch. 
> 
> We don't need flush_icache_range here, because I believe it is called in cpu_physical_memory_write. 
> Xiantao

Hi Xiantao,

Good point, I hadn't spotted that, and worse I mangled
flush_icache_range() in the process, trying to be smart :-(

Here's a version without cache flush changes, it should do the right
thing<tm>. We still need to look at the nvram stuff, but that is broken
in all setups currently.

What do you think of this one?

Cheers,
Jes


[-- Attachment #2: 0100-qemu-ia64-cpu-memory-write.patch --]
[-- Type: text/x-patch, Size: 9301 bytes --]

Remove ia64 dependency on phys_ram_base and assumption that
phys_ram_base + qemu_alloc_ram() is always valid. Use
cpu_physical_memory_{read,write} instead of memcpy.

The behavior of the NVRAM code is questionable, but this code should
behave the same as the old code ... it still needs to be fixed.

Signed-off-by: Jes Sorensen <jes@sgi.com>

---
 hw/ipf.c               |   46 ++++++++++-------------------
 target-ia64/firmware.c |   76 ++++++++++++++++++++++++++++++++-----------------
 target-ia64/firmware.h |    8 +----
 3 files changed, 70 insertions(+), 60 deletions(-)

Index: qemu-kvm/hw/ipf.c
===================================================================
--- qemu-kvm.orig/hw/ipf.c
+++ qemu-kvm/hw/ipf.c
@@ -54,7 +54,6 @@
 static RTCState *rtc_state;
 static PCIDevice *i440fx_state;
 
-uint8_t *g_fw_start;
 static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
 {
     return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
@@ -453,16 +452,14 @@
     /*Load firware to its proper position.*/
     if (kvm_enabled()) {
         unsigned long  image_size;
-        char *image = NULL;
-        uint8_t *fw_image_start;
+        uint8_t *image = NULL;
         unsigned long nvram_addr = 0;
         unsigned long nvram_fd = 0;
         unsigned long type = READ_FROM_NVRAM;
         unsigned long i = 0;
-        ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE);
-        uint8_t *fw_start = phys_ram_base + fw_offset;
+        unsigned long fw_offset;
+        ram_addr_t fw_mem = qemu_ram_alloc(GFW_SIZE);
 
-        g_fw_start = fw_start;
         snprintf(buf, sizeof(buf), "%s/%s", bios_dir, FW_FILENAME);
         image = read_image(buf, &image_size );
         if (NULL == image || !image_size) {
@@ -470,28 +467,26 @@
             fprintf(stderr, "Please check Guest firmware at %s\n", buf);
             exit(1);
         }
-        fw_image_start = fw_start + GFW_SIZE - image_size;
+        fw_offset = GFW_START + GFW_SIZE - image_size;
 
-        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset);
-        memcpy(fw_image_start, image, image_size);
+        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_mem);
+        cpu_physical_memory_write(fw_offset, image, image_size);
 
         free(image);
-        flush_icache_range((unsigned long)fw_image_start,
-                           (unsigned long)fw_image_start + image_size);
 
         nvram_addr = NVRAM_START;
         if (nvram) {
             nvram_fd = kvm_ia64_nvram_init(type);
             if (nvram_fd != -1) {
-                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, g_fw_start);
+                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd);
                 close(nvram_fd);
             }
             i = atexit((void *)kvm_ia64_copy_from_GFW_to_nvram);
             if (i != 0)
                 fprintf(stderr, "cannot set exit function\n");
         }
-        kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus,
-                           fw_start, nvram_addr);
+
+        kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus, nvram_addr);
     }
 
     /*Register legacy io address space, size:64M*/
@@ -512,21 +507,15 @@
     }
 
     if (cirrus_vga_enabled) {
-        if (pci_enabled) {
-            pci_cirrus_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
-        } else {
-            isa_cirrus_vga_init(phys_ram_base + vga_ram_addr,
-                                vga_ram_addr, vga_ram_size);
-        }
+        if (pci_enabled)
+            pci_cirrus_vga_init(pci_bus, vga_ram_size);
+        else
+            isa_cirrus_vga_init(vga_ram_size);
     } else {
-        if (pci_enabled) {
-            pci_vga_init(pci_bus, phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size, 0, 0);
-        } else {
-            isa_vga_init(phys_ram_base + vga_ram_addr,
-                         vga_ram_addr, vga_ram_size);
-        }
+        if (pci_enabled)
+            pci_vga_init(pci_bus, vga_ram_size, 0, 0);
+        else
+            isa_vga_init(vga_ram_size);
     }
 
     rtc_state = rtc_init(0x70, i8259[8], 2000);
@@ -671,7 +660,6 @@
     .name = "itanium",
     .desc = "Itanium Platform",
     .init = (QEMUMachineInitFunc *)ipf_init_pci,
-    .ram_require = (ram_addr_t)(VGA_RAM_SIZE + GFW_SIZE),
     .max_cpus = 255,
 };
 
Index: qemu-kvm/target-ia64/firmware.c
===================================================================
--- qemu-kvm.orig/target-ia64/firmware.c
+++ qemu-kvm/target-ia64/firmware.c
@@ -91,12 +91,11 @@
 static int build_hob(void *hob_buf, unsigned long hob_buf_size,
                      unsigned long dom_mem_size, unsigned long vcpus,
                      unsigned long nvram_addr);
-static int load_hob(void *hob_buf,
-                    unsigned long dom_mem_size, void* hob_start);
+static int load_hob(void *hob_buf, unsigned long dom_mem_size);
 
 int
 kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                   uint8_t *fw_start, unsigned long nvram_addr)
+                   unsigned long nvram_addr)
 {
     char   *hob_buf;
 
@@ -111,7 +110,8 @@
         Hob_Output("Could not build hob");
         return -1;
     }
-    if (load_hob(hob_buf, memsize, fw_start + HOB_OFFSET) < 0) {
+
+    if (load_hob(hob_buf, memsize) < 0) {
         free(hob_buf);
         Hob_Output("Could not load hob");
         return -1;
@@ -249,7 +249,7 @@
     return -1;
 }
 static int
-load_hob(void *hob_buf, unsigned long dom_mem_size, void* hob_start)
+load_hob(void *hob_buf, unsigned long dom_mem_size)
 {
     int hob_size;
 
@@ -263,7 +263,9 @@
         Hob_Output("No enough memory for hob data");
         return -1;
     }
-    memcpy (hob_start, hob_buf, hob_size);
+
+    cpu_physical_memory_write(GFW_HOB_START, hob_buf, hob_size);
+
     return 0;
 }
 
@@ -526,11 +528,11 @@
     return 0;
 }
 
-char *read_image(const char *filename, unsigned long *size)
+uint8_t *read_image(const char *filename, unsigned long *size)
 {
     int kernel_fd = -1;
     gzFile kernel_gfd = NULL;
-    char *image = NULL, *tmp;
+    uint8_t *image = NULL, *tmp;
     unsigned int bytes;
 
     if ((filename == NULL) || (size == NULL))
@@ -643,41 +645,63 @@
 }
 
 int
-kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                const uint8_t *fw_start)
+kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd)
 {
     struct stat file_stat;
+    uint8_t *nvram_buf;
+    int r = 0;
+
+    nvram_buf = malloc(NVRAM_SIZE);
+
     if ((fstat(nvram_fd, &file_stat) < 0) ||
         (NVRAM_SIZE  != file_stat.st_size) ||
-        (read(nvram_fd, (void *)(fw_start + NVRAM_OFFSET),
-              NVRAM_SIZE) != NVRAM_SIZE))
-        return -1;
-    return 0;
+        (read(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE)) {
+        r = -1;
+        goto out;
+    }
+
+    cpu_physical_memory_write(NVRAM_START, nvram_buf, NVRAM_SIZE);
+
+ out:
+    free(nvram_buf);
+    return r;
 }
 
 int
 kvm_ia64_copy_from_GFW_to_nvram()
 {
+    struct nvram_save_addr nvram_addr_buf;
+    uint8_t *nvram_buf;
     unsigned long nvram_fd;
     unsigned long type = WRITE_TO_NVRAM;
-    unsigned long *nvram_addr = (unsigned long *)(g_fw_start + NVRAM_OFFSET);
+    int ret = -1;
+
+    nvram_buf = malloc(NVRAM_SIZE);
+    if (!nvram_buf)
+        goto out_free;
+
+    cpu_physical_memory_read(NVRAM_START, (uint8_t *)&nvram_addr_buf,
+                             sizeof(struct nvram_save_addr));
+    if (nvram_addr_buf.signature != NVRAM_VALID_SIG) {
+        goto out_free;
+    }
+
+    cpu_physical_memory_read(nvram_addr_buf.addr, nvram_buf, NVRAM_SIZE);
+
     nvram_fd = kvm_ia64_nvram_init(type);
     if (nvram_fd  == -1)
         goto out;
-    if (((struct nvram_save_addr *)nvram_addr)->signature != NVRAM_VALID_SIG) {
-        close(nvram_fd);
-        goto out;
-    }
+
     lseek(nvram_fd, 0, SEEK_SET);
-    if (write(nvram_fd, ((void *)(((struct nvram_save_addr *)nvram_addr)->addr +
-        (char *)phys_ram_base)), NVRAM_SIZE) != NVRAM_SIZE) {
-        close(nvram_fd);
+    if (write(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE)
         goto out;
-    }
+
+    ret = 0;
+ out:
     close(nvram_fd);
-    return 0;
-out:
-    return -1;
+ out_free:
+    free(nvram_buf);
+    return ret;
 }
 
 /*
Index: qemu-kvm/target-ia64/firmware.h
===================================================================
--- qemu-kvm.orig/target-ia64/firmware.h
+++ qemu-kvm/target-ia64/firmware.h
@@ -52,13 +52,11 @@
 };
 
 extern const char *nvram;
-extern uint8_t *g_fw_start;
 extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                              uint8_t *fw_start, unsigned long nvram_addr);
-extern char *read_image(const char *filename, unsigned long *size);
+                              unsigned long nvram_addr);
+extern uint8_t *read_image(const char *filename, unsigned long *size);
 
 extern int kvm_ia64_copy_from_GFW_to_nvram(void);
 extern int kvm_ia64_nvram_init(unsigned long type);
-extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                           const uint8_t *fw_start);
+extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd);
 #endif //__FIRM_WARE_

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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-29  8:35                 ` Zhang, Xiantao
  -1 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-04-29  8:35 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: Avi Kivity, kvm-ia64, kvm

Jes Sorensen wrote:
> Zhang, Xiantao wrote:
>> Avi Kivity wrote:
>>> I haven't pushed this out yet, so I can apply a replacement patch.
>> 
>> We don't need flush_icache_range here, because I believe it is
>> called in cpu_physical_memory_write. Xiantao
> 
> Hi Xiantao,
> 
> Good point, I hadn't spotted that, and worse I mangled
> flush_icache_range() in the process, trying to be smart :-(
> 
> Here's a version without cache flush changes, it should do the right
> thing<tm>. We still need to look at the nvram stuff, but that is
> broken in all setups currently.
> 
> What do you think of this one?

Hi, Jes
    Except nvram stuff, I don't see the difference with my patch. Could you provide an incremental patch to fix nvram stuff ? :)
Xiantao


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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-29  8:35                 ` Zhang, Xiantao
  0 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-04-29  8:35 UTC (permalink / raw)
  To: kvm-ia64

Jes Sorensen wrote:
> Zhang, Xiantao wrote:
>> Avi Kivity wrote:
>>> I haven't pushed this out yet, so I can apply a replacement patch.
>> 
>> We don't need flush_icache_range here, because I believe it is
>> called in cpu_physical_memory_write. Xiantao
> 
> Hi Xiantao,
> 
> Good point, I hadn't spotted that, and worse I mangled
> flush_icache_range() in the process, trying to be smart :-(
> 
> Here's a version without cache flush changes, it should do the right
> thing<tm>. We still need to look at the nvram stuff, but that is
> broken in all setups currently.
> 
> What do you think of this one?

Hi, Jes
    Except nvram stuff, I don't see the difference with my patch. Could you provide an incremental patch to fix nvram stuff ? :)
Xiantao


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-29  8:42                   ` Jes Sorensen
  -1 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-29  8:42 UTC (permalink / raw)
  To: Zhang, Xiantao; +Cc: Avi Kivity, kvm-ia64, kvm

Zhang, Xiantao wrote:
> Jes Sorensen wrote:
>> What do you think of this one?
> 
> Hi, Jes
>     Except nvram stuff, I don't see the difference with my patch. Could you provide an incremental patch to fix nvram stuff ? :)
> Xiantao

Hi Xiantao,

The main difference is that my patch cleans up the interfaces and calls
to the various functions, and removes a bunch of global variables as
well.

The problem with the NVRAM stuff is that I don't know how it is supposed
to work. Do you have any specification or documentation for it?

Cheers,
Jes

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-29  8:42                   ` Jes Sorensen
  0 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-29  8:42 UTC (permalink / raw)
  To: kvm-ia64

Zhang, Xiantao wrote:
> Jes Sorensen wrote:
>> What do you think of this one?
> 
> Hi, Jes
>     Except nvram stuff, I don't see the difference with my patch. Could you provide an incremental patch to fix nvram stuff ? :)
> Xiantao

Hi Xiantao,

The main difference is that my patch cleans up the interfaces and calls
to the various functions, and removes a bunch of global variables as
well.

The problem with the NVRAM stuff is that I don't know how it is supposed
to work. Do you have any specification or documentation for it?

Cheers,
Jes

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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-29 14:02                     ` Zhang, Xiantao
  -1 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-04-29 14:02 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: Avi Kivity, kvm-ia64, kvm

Jes Sorensen wrote:
> Zhang, Xiantao wrote:
>> Jes Sorensen wrote:
>>> What do you think of this one?
>> 
>> Hi, Jes
>>     Except nvram stuff, I don't see the difference with my patch.
>> Could you provide an incremental patch to fix nvram stuff ? :)
>> Xiantao 
> 
> Hi Xiantao,
> 
> The main difference is that my patch cleans up the interfaces and
> calls to the various functions, and removes a bunch of global
> variables as well. 

I still can't see the difference with the patch in Avi's tree except nvram stuff.  And I believe the global variable you mentioned should be only used for nvram. So I propose an incremental patch for that. :)

> The problem with the NVRAM stuff is that I don't know how it is
> supposed to work. Do you have any specification or documentation for
> it? 
No specification, and we just followed the guest's firmware logic for that. The link for guest firmware: http://xenbits.xensource.com/ext/efi-vfirmware.hg

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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-29 14:02                     ` Zhang, Xiantao
  0 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-04-29 14:02 UTC (permalink / raw)
  To: kvm-ia64

Jes Sorensen wrote:
> Zhang, Xiantao wrote:
>> Jes Sorensen wrote:
>>> What do you think of this one?
>> 
>> Hi, Jes
>>     Except nvram stuff, I don't see the difference with my patch.
>> Could you provide an incremental patch to fix nvram stuff ? :)
>> Xiantao 
> 
> Hi Xiantao,
> 
> The main difference is that my patch cleans up the interfaces and
> calls to the various functions, and removes a bunch of global
> variables as well. 

I still can't see the difference with the patch in Avi's tree except nvram stuff.  And I believe the global variable you mentioned should be only used for nvram. So I propose an incremental patch for that. :)

> The problem with the NVRAM stuff is that I don't know how it is
> supposed to work. Do you have any specification or documentation for
> it? 
No specification, and we just followed the guest's firmware logic for that. The link for guest firmware: http://xenbits.xensource.com/ext/efi-vfirmware.hg

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-29 15:07                       ` Jes Sorensen
  -1 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-29 15:07 UTC (permalink / raw)
  To: Zhang, Xiantao; +Cc: Avi Kivity, kvm-ia64, kvm

Zhang, Xiantao wrote:
> Jes Sorensen wrote:
>> The main difference is that my patch cleans up the interfaces and
>> calls to the various functions, and removes a bunch of global
>> variables as well. 
> 
> I still can't see the difference with the patch in Avi's tree except nvram stuff.  And I believe the global variable you mentioned should be only used for nvram. So I propose an incremental patch for that. :)

Let me try and take a look - last I pulled from Avi, those patches
didn't show up in git.

Been trying to get the mapping and alias stuff done, so probably won't
get to this until tomorrow.

Cheers,
jes

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-29 15:07                       ` Jes Sorensen
  0 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-29 15:07 UTC (permalink / raw)
  To: kvm-ia64

Zhang, Xiantao wrote:
> Jes Sorensen wrote:
>> The main difference is that my patch cleans up the interfaces and
>> calls to the various functions, and removes a bunch of global
>> variables as well. 
> 
> I still can't see the difference with the patch in Avi's tree except nvram stuff.  And I believe the global variable you mentioned should be only used for nvram. So I propose an incremental patch for that. :)

Let me try and take a look - last I pulled from Avi, those patches
didn't show up in git.

Been trying to get the mapping and alias stuff done, so probably won't
get to this until tomorrow.

Cheers,
jes

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-30  9:11                       ` Jes Sorensen
  -1 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-30  9:11 UTC (permalink / raw)
  To: Zhang, Xiantao; +Cc: Avi Kivity, kvm-ia64, kvm

Zhang, Xiantao wrote:
> Jes Sorensen wrote:
>> The main difference is that my patch cleans up the interfaces and
>> calls to the various functions, and removes a bunch of global
>> variables as well. 
> 
> I still can't see the difference with the patch in Avi's tree except nvram stuff.  And I believe the global variable you mentioned should be only used for nvram. So I propose an incremental patch for that. :)

Hi Xiantao,

I cannot see your patch in Avi's tree, would you mind sending me the
latest version by email, so I can look into this?

Thanks,
Jes

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-30  9:11                       ` Jes Sorensen
  0 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-30  9:11 UTC (permalink / raw)
  To: kvm-ia64

Zhang, Xiantao wrote:
> Jes Sorensen wrote:
>> The main difference is that my patch cleans up the interfaces and
>> calls to the various functions, and removes a bunch of global
>> variables as well. 
> 
> I still can't see the difference with the patch in Avi's tree except nvram stuff.  And I believe the global variable you mentioned should be only used for nvram. So I propose an incremental patch for that. :)

Hi Xiantao,

I cannot see your patch in Avi's tree, would you mind sending me the
latest version by email, so I can look into this?

Thanks,
Jes

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-30  9:23                         ` Avi Kivity
  -1 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-04-30  9:23 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: Zhang, Xiantao, kvm-ia64, kvm

Jes Sorensen wrote:
> Zhang, Xiantao wrote:
>> Jes Sorensen wrote:
>>> The main difference is that my patch cleans up the interfaces and
>>> calls to the various functions, and removes a bunch of global
>>> variables as well. 
>>
>> I still can't see the difference with the patch in Avi's tree except 
>> nvram stuff.  And I believe the global variable you mentioned should 
>> be only used for nvram. So I propose an incremental patch for that. :)
>
> Hi Xiantao,
>
> I cannot see your patch in Avi's tree, would you mind sending me the
> latest version by email, so I can look into this?
>

I pushed my queue into a branch (named 'queue').  Will merge once I 
resolve the regressions here.

-- 
error compiling committee.c: too many arguments to function


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-30  9:23                         ` Avi Kivity
  0 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-04-30  9:23 UTC (permalink / raw)
  To: kvm-ia64

Jes Sorensen wrote:
> Zhang, Xiantao wrote:
>> Jes Sorensen wrote:
>>> The main difference is that my patch cleans up the interfaces and
>>> calls to the various functions, and removes a bunch of global
>>> variables as well. 
>>
>> I still can't see the difference with the patch in Avi's tree except 
>> nvram stuff.  And I believe the global variable you mentioned should 
>> be only used for nvram. So I propose an incremental patch for that. :)
>
> Hi Xiantao,
>
> I cannot see your patch in Avi's tree, would you mind sending me the
> latest version by email, so I can look into this?
>

I pushed my queue into a branch (named 'queue').  Will merge once I 
resolve the regressions here.

-- 
error compiling committee.c: too many arguments to function


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-30 14:09                           ` Jes Sorensen
  -1 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-30 14:09 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Zhang, Xiantao, kvm-ia64, kvm

Avi Kivity wrote:
> Jes Sorensen wrote:
> I pushed my queue into a branch (named 'queue').  Will merge once I 
> resolve the regressions here.
> 

Hi Avi,

I don't see that branch - it's in the qemu-kvm repo?

Cheers,
Jes

[jes@leavenworth qemu-kvm]$ git branch -a
* master
   origin/HEAD
   origin/bios-merge
   origin/bios-patchqueue
   origin/bochs-bios-cvs
   origin/bochs-bios-vendor-drops
   origin/build
   origin/for-glommer
   origin/ia64-vtd
   origin/irq-routing-2
   origin/kvm-updates-2.6.25
   origin/kvm-updates-2.6.26
   origin/kvm-updates-2.6.27
   origin/kvm-updates/2.6.26
   origin/kvm-updates/2.6.27
   origin/kvm-updates/2.6.28
   origin/kvm-updates/2.6.29
   origin/kvm-updates/2.6.30
   origin/maint/2.6.25
   origin/maint/2.6.26
   origin/maint/2.6.26-test
   origin/maint/2.6.28
   origin/maint/2.6.29
   origin/maint/2.6.30
   origin/master
   origin/merge-tmp
   origin/origin
   origin/pending
   origin/qemu-cvs
   origin/qemu-vendor-drops
   origin/realmode
   origin/release
[jes@leavenworth qemu-kvm]$

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-30 14:09                           ` Jes Sorensen
  0 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-04-30 14:09 UTC (permalink / raw)
  To: kvm-ia64

Avi Kivity wrote:
> Jes Sorensen wrote:
> I pushed my queue into a branch (named 'queue').  Will merge once I 
> resolve the regressions here.
> 

Hi Avi,

I don't see that branch - it's in the qemu-kvm repo?

Cheers,
Jes

[jes@leavenworth qemu-kvm]$ git branch -a
* master
   origin/HEAD
   origin/bios-merge
   origin/bios-patchqueue
   origin/bochs-bios-cvs
   origin/bochs-bios-vendor-drops
   origin/build
   origin/for-glommer
   origin/ia64-vtd
   origin/irq-routing-2
   origin/kvm-updates-2.6.25
   origin/kvm-updates-2.6.26
   origin/kvm-updates-2.6.27
   origin/kvm-updates/2.6.26
   origin/kvm-updates/2.6.27
   origin/kvm-updates/2.6.28
   origin/kvm-updates/2.6.29
   origin/kvm-updates/2.6.30
   origin/maint/2.6.25
   origin/maint/2.6.26
   origin/maint/2.6.26-test
   origin/maint/2.6.28
   origin/maint/2.6.29
   origin/maint/2.6.30
   origin/master
   origin/merge-tmp
   origin/origin
   origin/pending
   origin/qemu-cvs
   origin/qemu-vendor-drops
   origin/realmode
   origin/release
[jes@leavenworth qemu-kvm]$

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-04-30 15:22                             ` Avi Kivity
  -1 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-04-30 15:22 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: Zhang, Xiantao, kvm-ia64, kvm

Jes Sorensen wrote:
> Avi Kivity wrote:
>> Jes Sorensen wrote:
>> I pushed my queue into a branch (named 'queue').  Will merge once I 
>> resolve the regressions here.
>>
>
> Hi Avi,
>
> I don't see that branch - it's in the qemu-kvm repo?
>

Did you run 'git fetch origin'?


-- 
error compiling committee.c: too many arguments to function


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-04-30 15:22                             ` Avi Kivity
  0 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-04-30 15:22 UTC (permalink / raw)
  To: kvm-ia64

Jes Sorensen wrote:
> Avi Kivity wrote:
>> Jes Sorensen wrote:
>> I pushed my queue into a branch (named 'queue').  Will merge once I 
>> resolve the regressions here.
>>
>
> Hi Avi,
>
> I don't see that branch - it's in the qemu-kvm repo?
>

Did you run 'git fetch origin'?


-- 
error compiling committee.c: too many arguments to function


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-05-01 10:30                       ` Jes Sorensen
  -1 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-05-01 10:30 UTC (permalink / raw)
  To: Zhang, Xiantao; +Cc: Avi Kivity, kvm-ia64, kvm

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

Zhang, Xiantao wrote:
> Jes Sorensen wrote:
> I still can't see the difference with the patch in Avi's tree except nvram stuff.  And I believe the global variable you mentioned should be only used for nvram. So I propose an incremental patch for that. :)

Hi,

Here is an incremental version of the patch. I think the differences
should be pretty obvious now :-)

It fixes the memcpy issues in the hob and nvram code and also cleans
up the interfaces a lot.

Avi, please add.

Cheers,
Jes

[-- Attachment #2: 0010-qemu-ia64-fix-hub-nvram-memcpy.patch --]
[-- Type: text/x-patch, Size: 8222 bytes --]

Fix ia64 code to use copy_physical_memory_{read,write} in hob and
nvram code, removing dependencies of qemu_get_ram_ptr() usage.

This results in cleaned up APIs and removal of unnecessary global
variables.

This is an incremental patch on top of previous patch posted by Xiantao.

Signed-off-by: Jes Sorensen <jes@sgi.com>

---
 hw/ipf.c               |   38 ++++++++++---------------
 target-ia64/firmware.c |   73 +++++++++++++++++++++++++++++--------------------
 target-ia64/firmware.h |    6 +---
 3 files changed, 62 insertions(+), 55 deletions(-)

Index: qemu-kvm/hw/ipf.c
===================================================================
--- qemu-kvm.orig/hw/ipf.c
+++ qemu-kvm/hw/ipf.c
@@ -54,8 +54,6 @@
 static RTCState *rtc_state;
 static PCIDevice *i440fx_state;
 
-void *gfw_start;
-
 static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
 {
     return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
@@ -455,15 +453,12 @@
     if (kvm_enabled()) {
         unsigned long  image_size;
         uint8_t *image = NULL;
-        target_phys_addr_t fw_image_start;
-        unsigned long nvram_addr = 0;
+        unsigned long nvram_addr;
         unsigned long nvram_fd = 0;
         unsigned long type = READ_FROM_NVRAM;
         unsigned long i = 0;
-
-        ram_addr  = qemu_ram_alloc(GFW_SIZE);
-        gfw_start = qemu_get_ram_ptr(ram_addr);
-        cpu_register_physical_memory(GFW_START, GFW_SIZE, ram_addr);
+        unsigned long fw_offset;
+        ram_addr_t fw_mem = qemu_ram_alloc(GFW_SIZE);
 
         snprintf(buf, sizeof(buf), "%s/%s", bios_dir, FW_FILENAME);
         image = read_image(buf, &image_size );
@@ -472,26 +467,27 @@
             fprintf(stderr, "Please check Guest firmware at %s\n", buf);
             exit(1);
         }
+        fw_offset = GFW_START + GFW_SIZE - image_size;
 
-        /* Load Guest Firmware to the proper postion. */
-        fw_image_start = GFW_START + GFW_SIZE - image_size;
-        cpu_physical_memory_write(fw_image_start, image, image_size);
-        free(image);
+        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_mem);
+        cpu_physical_memory_write(fw_offset, image, image_size);
 
+        free(image);
 
         if (nvram) {
             nvram_addr = NVRAM_START;
             nvram_fd = kvm_ia64_nvram_init(type);
             if (nvram_fd != -1) {
-                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, gfw_start);
+                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd);
                 close(nvram_fd);
             }
             i = atexit((void *)kvm_ia64_copy_from_GFW_to_nvram);
             if (i != 0)
                 fprintf(stderr, "cannot set exit function\n");
-        }
-        kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus,
-					gfw_start, nvram_addr);
+        } else
+            nvram_addr = 0;
+
+        kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus, nvram_addr);
     }
 
     /*Register legacy io address space, size:64M*/
@@ -512,17 +508,15 @@
     }
 
     if (cirrus_vga_enabled) {
-        if (pci_enabled) {
+        if (pci_enabled)
             pci_cirrus_vga_init(pci_bus, vga_ram_size);
-        } else {
+        else
             isa_cirrus_vga_init(vga_ram_size);
-        }
     } else {
-        if (pci_enabled) {
+        if (pci_enabled)
             pci_vga_init(pci_bus, vga_ram_size, 0, 0);
-        } else {
+        else
             isa_vga_init(vga_ram_size);
-        }
     }
 
     rtc_state = rtc_init(0x70, i8259[8], 2000);
Index: qemu-kvm/target-ia64/firmware.c
===================================================================
--- qemu-kvm.orig/target-ia64/firmware.c
+++ qemu-kvm/target-ia64/firmware.c
@@ -91,12 +91,11 @@
 static int build_hob(void *hob_buf, unsigned long hob_buf_size,
                      unsigned long dom_mem_size, unsigned long vcpus,
                      unsigned long nvram_addr);
-static int load_hob(void *hob_buf,
-                    unsigned long dom_mem_size, void *hob_start);
+static int load_hob(void *hob_buf, unsigned long dom_mem_size);
 
 int
 kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                   void* fw_start, unsigned long nvram_addr)
+                   unsigned long nvram_addr)
 {
     char   *hob_buf;
 
@@ -111,7 +110,8 @@
         Hob_Output("Could not build hob");
         return -1;
     }
-    if (load_hob(hob_buf, memsize, fw_start + HOB_OFFSET) < 0) {
+
+    if (load_hob(hob_buf, memsize) < 0) {
         free(hob_buf);
         Hob_Output("Could not load hob");
         return -1;
@@ -249,7 +249,7 @@
     return -1;
 }
 static int
-load_hob(void *hob_buf, unsigned long dom_mem_size, void *hob_start)
+load_hob(void *hob_buf, unsigned long dom_mem_size)
 {
     int hob_size;
 
@@ -263,7 +263,9 @@
         Hob_Output("No enough memory for hob data");
         return -1;
     }
-    memcpy ((void *)hob_start, hob_buf, hob_size);
+
+    cpu_physical_memory_write(GFW_HOB_START, hob_buf, hob_size);
+
     return 0;
 }
 
@@ -643,50 +645,63 @@
 }
 
 int
-kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                const void* fw_start)
+kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd)
 {
     struct stat file_stat;
+    uint8_t *nvram_buf;
+    int r = 0;
+
+    nvram_buf = malloc(NVRAM_SIZE);
+
     if ((fstat(nvram_fd, &file_stat) < 0) ||
         (NVRAM_SIZE  != file_stat.st_size) ||
-        (read(nvram_fd, (void *)(fw_start + NVRAM_OFFSET),
-              NVRAM_SIZE) != NVRAM_SIZE))
-        return -1;
-    return 0;
+        (read(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE)) {
+        r = -1;
+        goto out;
+    }
+
+    cpu_physical_memory_write(NVRAM_START, nvram_buf, NVRAM_SIZE);
+
+ out:
+    free(nvram_buf);
+    return r;
 }
 
 int
 kvm_ia64_copy_from_GFW_to_nvram()
 {
+    struct nvram_save_addr nvram_addr_buf;
+    uint8_t *nvram_buf;
     unsigned long nvram_fd;
-    void* real_nvram_start;
-    target_phys_addr_t nvram_size = NVRAM_SIZE;
     unsigned long type = WRITE_TO_NVRAM;
-    unsigned long *nvram_addr = (unsigned long *)(gfw_start + NVRAM_OFFSET);
+    int ret = -1;
 
+    nvram_buf = malloc(NVRAM_SIZE);
+    if (!nvram_buf)
+        goto out_free;
 
+    cpu_physical_memory_read(NVRAM_START, (uint8_t *)&nvram_addr_buf,
+                             sizeof(struct nvram_save_addr));
+    if (nvram_addr_buf.signature != NVRAM_VALID_SIG) {
+        goto out_free;
+    }
+
+    cpu_physical_memory_read(nvram_addr_buf.addr, nvram_buf, NVRAM_SIZE);
 
     nvram_fd = kvm_ia64_nvram_init(type);
     if (nvram_fd  == -1)
         goto out;
-    if (((struct nvram_save_addr *)nvram_addr)->signature != NVRAM_VALID_SIG) {
-        close(nvram_fd);
-        goto out;
-    }
-    lseek(nvram_fd, 0, SEEK_SET);
 
-    real_nvram_start = cpu_physical_memory_map(((struct nvram_save_addr*)nvram_addr)->addr,
-	&nvram_size, 1);
-    if (write(nvram_fd, real_nvram_start, NVRAM_SIZE) != NVRAM_SIZE) {
-        close(nvram_fd);
+    lseek(nvram_fd, 0, SEEK_SET);
+    if (write(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE)
         goto out;
-    }
-    cpu_physical_memory_unmap(real_nvram_start, NVRAM_SIZE, 1, NVRAM_SIZE);
 
+    ret = 0;
+ out:
     close(nvram_fd);
-    return 0;
-out:
-    return -1;
+ out_free:
+    free(nvram_buf);
+    return ret;
 }
 
 /*
Index: qemu-kvm/target-ia64/firmware.h
===================================================================
--- qemu-kvm.orig/target-ia64/firmware.h
+++ qemu-kvm/target-ia64/firmware.h
@@ -52,13 +52,11 @@
 };
 
 extern const char *nvram;
-extern void *gfw_start;
 extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                              void* fw_start, unsigned long nvram_addr);
+                              unsigned long nvram_addr);
 extern uint8_t *read_image(const char *filename, unsigned long *size);
 
 extern int kvm_ia64_copy_from_GFW_to_nvram(void);
 extern int kvm_ia64_nvram_init(unsigned long type);
-extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                           const void* fw_start);
+extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd);
 #endif //__FIRM_WARE_

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-05-01 10:30                       ` Jes Sorensen
  0 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-05-01 10:30 UTC (permalink / raw)
  To: kvm-ia64

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

Zhang, Xiantao wrote:
> Jes Sorensen wrote:
> I still can't see the difference with the patch in Avi's tree except nvram stuff.  And I believe the global variable you mentioned should be only used for nvram. So I propose an incremental patch for that. :)

Hi,

Here is an incremental version of the patch. I think the differences
should be pretty obvious now :-)

It fixes the memcpy issues in the hob and nvram code and also cleans
up the interfaces a lot.

Avi, please add.

Cheers,
Jes

[-- Attachment #2: 0010-qemu-ia64-fix-hub-nvram-memcpy.patch --]
[-- Type: text/x-patch, Size: 8222 bytes --]

Fix ia64 code to use copy_physical_memory_{read,write} in hob and
nvram code, removing dependencies of qemu_get_ram_ptr() usage.

This results in cleaned up APIs and removal of unnecessary global
variables.

This is an incremental patch on top of previous patch posted by Xiantao.

Signed-off-by: Jes Sorensen <jes@sgi.com>

---
 hw/ipf.c               |   38 ++++++++++---------------
 target-ia64/firmware.c |   73 +++++++++++++++++++++++++++++--------------------
 target-ia64/firmware.h |    6 +---
 3 files changed, 62 insertions(+), 55 deletions(-)

Index: qemu-kvm/hw/ipf.c
===================================================================
--- qemu-kvm.orig/hw/ipf.c
+++ qemu-kvm/hw/ipf.c
@@ -54,8 +54,6 @@
 static RTCState *rtc_state;
 static PCIDevice *i440fx_state;
 
-void *gfw_start;
-
 static uint32_t ipf_to_legacy_io(target_phys_addr_t addr)
 {
     return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3));
@@ -455,15 +453,12 @@
     if (kvm_enabled()) {
         unsigned long  image_size;
         uint8_t *image = NULL;
-        target_phys_addr_t fw_image_start;
-        unsigned long nvram_addr = 0;
+        unsigned long nvram_addr;
         unsigned long nvram_fd = 0;
         unsigned long type = READ_FROM_NVRAM;
         unsigned long i = 0;
-
-        ram_addr  = qemu_ram_alloc(GFW_SIZE);
-        gfw_start = qemu_get_ram_ptr(ram_addr);
-        cpu_register_physical_memory(GFW_START, GFW_SIZE, ram_addr);
+        unsigned long fw_offset;
+        ram_addr_t fw_mem = qemu_ram_alloc(GFW_SIZE);
 
         snprintf(buf, sizeof(buf), "%s/%s", bios_dir, FW_FILENAME);
         image = read_image(buf, &image_size );
@@ -472,26 +467,27 @@
             fprintf(stderr, "Please check Guest firmware at %s\n", buf);
             exit(1);
         }
+        fw_offset = GFW_START + GFW_SIZE - image_size;
 
-        /* Load Guest Firmware to the proper postion. */
-        fw_image_start = GFW_START + GFW_SIZE - image_size;
-        cpu_physical_memory_write(fw_image_start, image, image_size);
-        free(image);
+        cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_mem);
+        cpu_physical_memory_write(fw_offset, image, image_size);
 
+        free(image);
 
         if (nvram) {
             nvram_addr = NVRAM_START;
             nvram_fd = kvm_ia64_nvram_init(type);
             if (nvram_fd != -1) {
-                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd, gfw_start);
+                kvm_ia64_copy_from_nvram_to_GFW(nvram_fd);
                 close(nvram_fd);
             }
             i = atexit((void *)kvm_ia64_copy_from_GFW_to_nvram);
             if (i != 0)
                 fprintf(stderr, "cannot set exit function\n");
-        }
-        kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus,
-					gfw_start, nvram_addr);
+        } else
+            nvram_addr = 0;
+
+        kvm_ia64_build_hob(ram_size + above_4g_mem_size, smp_cpus, nvram_addr);
     }
 
     /*Register legacy io address space, size:64M*/
@@ -512,17 +508,15 @@
     }
 
     if (cirrus_vga_enabled) {
-        if (pci_enabled) {
+        if (pci_enabled)
             pci_cirrus_vga_init(pci_bus, vga_ram_size);
-        } else {
+        else
             isa_cirrus_vga_init(vga_ram_size);
-        }
     } else {
-        if (pci_enabled) {
+        if (pci_enabled)
             pci_vga_init(pci_bus, vga_ram_size, 0, 0);
-        } else {
+        else
             isa_vga_init(vga_ram_size);
-        }
     }
 
     rtc_state = rtc_init(0x70, i8259[8], 2000);
Index: qemu-kvm/target-ia64/firmware.c
===================================================================
--- qemu-kvm.orig/target-ia64/firmware.c
+++ qemu-kvm/target-ia64/firmware.c
@@ -91,12 +91,11 @@
 static int build_hob(void *hob_buf, unsigned long hob_buf_size,
                      unsigned long dom_mem_size, unsigned long vcpus,
                      unsigned long nvram_addr);
-static int load_hob(void *hob_buf,
-                    unsigned long dom_mem_size, void *hob_start);
+static int load_hob(void *hob_buf, unsigned long dom_mem_size);
 
 int
 kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                   void* fw_start, unsigned long nvram_addr)
+                   unsigned long nvram_addr)
 {
     char   *hob_buf;
 
@@ -111,7 +110,8 @@
         Hob_Output("Could not build hob");
         return -1;
     }
-    if (load_hob(hob_buf, memsize, fw_start + HOB_OFFSET) < 0) {
+
+    if (load_hob(hob_buf, memsize) < 0) {
         free(hob_buf);
         Hob_Output("Could not load hob");
         return -1;
@@ -249,7 +249,7 @@
     return -1;
 }
 static int
-load_hob(void *hob_buf, unsigned long dom_mem_size, void *hob_start)
+load_hob(void *hob_buf, unsigned long dom_mem_size)
 {
     int hob_size;
 
@@ -263,7 +263,9 @@
         Hob_Output("No enough memory for hob data");
         return -1;
     }
-    memcpy ((void *)hob_start, hob_buf, hob_size);
+
+    cpu_physical_memory_write(GFW_HOB_START, hob_buf, hob_size);
+
     return 0;
 }
 
@@ -643,50 +645,63 @@
 }
 
 int
-kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                const void* fw_start)
+kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd)
 {
     struct stat file_stat;
+    uint8_t *nvram_buf;
+    int r = 0;
+
+    nvram_buf = malloc(NVRAM_SIZE);
+
     if ((fstat(nvram_fd, &file_stat) < 0) ||
         (NVRAM_SIZE  != file_stat.st_size) ||
-        (read(nvram_fd, (void *)(fw_start + NVRAM_OFFSET),
-              NVRAM_SIZE) != NVRAM_SIZE))
-        return -1;
-    return 0;
+        (read(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE)) {
+        r = -1;
+        goto out;
+    }
+
+    cpu_physical_memory_write(NVRAM_START, nvram_buf, NVRAM_SIZE);
+
+ out:
+    free(nvram_buf);
+    return r;
 }
 
 int
 kvm_ia64_copy_from_GFW_to_nvram()
 {
+    struct nvram_save_addr nvram_addr_buf;
+    uint8_t *nvram_buf;
     unsigned long nvram_fd;
-    void* real_nvram_start;
-    target_phys_addr_t nvram_size = NVRAM_SIZE;
     unsigned long type = WRITE_TO_NVRAM;
-    unsigned long *nvram_addr = (unsigned long *)(gfw_start + NVRAM_OFFSET);
+    int ret = -1;
 
+    nvram_buf = malloc(NVRAM_SIZE);
+    if (!nvram_buf)
+        goto out_free;
 
+    cpu_physical_memory_read(NVRAM_START, (uint8_t *)&nvram_addr_buf,
+                             sizeof(struct nvram_save_addr));
+    if (nvram_addr_buf.signature != NVRAM_VALID_SIG) {
+        goto out_free;
+    }
+
+    cpu_physical_memory_read(nvram_addr_buf.addr, nvram_buf, NVRAM_SIZE);
 
     nvram_fd = kvm_ia64_nvram_init(type);
     if (nvram_fd  == -1)
         goto out;
-    if (((struct nvram_save_addr *)nvram_addr)->signature != NVRAM_VALID_SIG) {
-        close(nvram_fd);
-        goto out;
-    }
-    lseek(nvram_fd, 0, SEEK_SET);
 
-    real_nvram_start = cpu_physical_memory_map(((struct nvram_save_addr*)nvram_addr)->addr,
-	&nvram_size, 1);
-    if (write(nvram_fd, real_nvram_start, NVRAM_SIZE) != NVRAM_SIZE) {
-        close(nvram_fd);
+    lseek(nvram_fd, 0, SEEK_SET);
+    if (write(nvram_fd, nvram_buf, NVRAM_SIZE) != NVRAM_SIZE)
         goto out;
-    }
-    cpu_physical_memory_unmap(real_nvram_start, NVRAM_SIZE, 1, NVRAM_SIZE);
 
+    ret = 0;
+ out:
     close(nvram_fd);
-    return 0;
-out:
-    return -1;
+ out_free:
+    free(nvram_buf);
+    return ret;
 }
 
 /*
Index: qemu-kvm/target-ia64/firmware.h
===================================================================
--- qemu-kvm.orig/target-ia64/firmware.h
+++ qemu-kvm/target-ia64/firmware.h
@@ -52,13 +52,11 @@
 };
 
 extern const char *nvram;
-extern void *gfw_start;
 extern int kvm_ia64_build_hob(unsigned long memsize, unsigned long vcpus,
-                              void* fw_start, unsigned long nvram_addr);
+                              unsigned long nvram_addr);
 extern uint8_t *read_image(const char *filename, unsigned long *size);
 
 extern int kvm_ia64_copy_from_GFW_to_nvram(void);
 extern int kvm_ia64_nvram_init(unsigned long type);
-extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd,
-                                           const void* fw_start);
+extern int kvm_ia64_copy_from_nvram_to_GFW(unsigned long nvram_fd);
 #endif //__FIRM_WARE_

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-05-03 16:14                         ` Avi Kivity
  -1 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-05-03 16:14 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: Zhang, Xiantao, kvm-ia64, kvm

Jes Sorensen wrote:
> Zhang, Xiantao wrote:
>> Jes Sorensen wrote:
>> I still can't see the difference with the patch in Avi's tree except 
>> nvram stuff.  And I believe the global variable you mentioned should 
>> be only used for nvram. So I propose an incremental patch for that. :)
>
> Hi,
>
> Here is an incremental version of the patch. I think the differences
> should be pretty obvious now :-)
>
> It fixes the memcpy issues in the hob and nvram code and also cleans
> up the interfaces a lot.
>
> Avi, please add.

Looks good to me.  Xiantao?

-- 
error compiling committee.c: too many arguments to function


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-05-03 16:14                         ` Avi Kivity
  0 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-05-03 16:14 UTC (permalink / raw)
  To: kvm-ia64

Jes Sorensen wrote:
> Zhang, Xiantao wrote:
>> Jes Sorensen wrote:
>> I still can't see the difference with the patch in Avi's tree except 
>> nvram stuff.  And I believe the global variable you mentioned should 
>> be only used for nvram. So I propose an incremental patch for that. :)
>
> Hi,
>
> Here is an incremental version of the patch. I think the differences
> should be pretty obvious now :-)
>
> It fixes the memcpy issues in the hob and nvram code and also cleans
> up the interfaces a lot.
>
> Avi, please add.

Looks good to me.  Xiantao?

-- 
error compiling committee.c: too many arguments to function


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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-05-04  1:44                           ` Zhang, Xiantao
  -1 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-05-04  1:44 UTC (permalink / raw)
  To: Avi Kivity, Jes Sorensen; +Cc: kvm-ia64, kvm

Avi Kivity wrote:
> Jes Sorensen wrote:
>> Zhang, Xiantao wrote:
>>> Jes Sorensen wrote:
>>> I still can't see the difference with the patch in Avi's tree except
>>> nvram stuff.  And I believe the global variable you mentioned should
>>> be only used for nvram. So I propose an incremental patch for that.
>>> :) 
>> 
>> Hi,
>> 
>> Here is an incremental version of the patch. I think the differences
>> should be pretty obvious now :-)
>> 
>> It fixes the memcpy issues in the hob and nvram code and also cleans
>> up the interfaces a lot. 
>> 
>> Avi, please add.
> 
> Looks good to me.  Xiantao?

Hi, Jes
    Have you tested nvram support with this patch? I
Xiantao

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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-05-04  1:44                           ` Zhang, Xiantao
  0 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-05-04  1:44 UTC (permalink / raw)
  To: kvm-ia64

Avi Kivity wrote:
> Jes Sorensen wrote:
>> Zhang, Xiantao wrote:
>>> Jes Sorensen wrote:
>>> I still can't see the difference with the patch in Avi's tree except
>>> nvram stuff.  And I believe the global variable you mentioned should
>>> be only used for nvram. So I propose an incremental patch for that.
>>> :) 
>> 
>> Hi,
>> 
>> Here is an incremental version of the patch. I think the differences
>> should be pretty obvious now :-)
>> 
>> It fixes the memcpy issues in the hob and nvram code and also cleans
>> up the interfaces a lot. 
>> 
>> Avi, please add.
> 
> Looks good to me.  Xiantao?

Hi, Jes
    Have you tested nvram support with this patch? I
Xiantao

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-05-04  5:11                             ` Jes Sorensen
  -1 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-05-04  5:11 UTC (permalink / raw)
  To: Zhang, Xiantao; +Cc: Avi Kivity, kvm-ia64, kvm

Zhang, Xiantao wrote:
> Avi Kivity wrote:
> Looks good to me.  Xiantao?
> 
> Hi, Jes
>     Have you tested nvram support with this patch? I
> Xiantao

No,

But it is behaving exactly like the old code, so it is no more broken
than the old code was.

Lets apply this and then look at the nvram issues afterwards.

Jes

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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-05-04  5:11                             ` Jes Sorensen
  0 siblings, 0 replies; 48+ messages in thread
From: Jes Sorensen @ 2009-05-04  5:11 UTC (permalink / raw)
  To: kvm-ia64

Zhang, Xiantao wrote:
> Avi Kivity wrote:
> Looks good to me.  Xiantao?
> 
> Hi, Jes
>     Have you tested nvram support with this patch? I
> Xiantao

No,

But it is behaving exactly like the old code, so it is no more broken
than the old code was.

Lets apply this and then look at the nvram issues afterwards.

Jes

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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-05-04  5:12                               ` Zhang, Xiantao
  -1 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-05-04  5:12 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: Avi Kivity, kvm-ia64, kvm

Jes Sorensen wrote:
> Zhang, Xiantao wrote:
>> Avi Kivity wrote:
>> Looks good to me.  Xiantao?
>> 
>> Hi, Jes
>>     Have you tested nvram support with this patch? I
>> Xiantao
> 
> No,
> 
> But it is behaving exactly like the old code, so it is no more broken
> than the old code was.
> 
> Lets apply this and then look at the nvram issues afterwards.

Okay. :)
Xiantao


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

* RE: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-05-04  5:12                               ` Zhang, Xiantao
  0 siblings, 0 replies; 48+ messages in thread
From: Zhang, Xiantao @ 2009-05-04  5:12 UTC (permalink / raw)
  To: kvm-ia64

Jes Sorensen wrote:
> Zhang, Xiantao wrote:
>> Avi Kivity wrote:
>> Looks good to me.  Xiantao?
>> 
>> Hi, Jes
>>     Have you tested nvram support with this patch? I
>> Xiantao
> 
> No,
> 
> But it is behaving exactly like the old code, so it is no more broken
> than the old code was.
> 
> Lets apply this and then look at the nvram issues afterwards.

Okay. :)
Xiantao


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c
  2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
@ 2009-05-04  8:16                         ` Avi Kivity
  -1 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-05-04  8:16 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: Zhang, Xiantao, kvm-ia64, kvm

Jes Sorensen wrote:
> Zhang, Xiantao wrote:
>> Jes Sorensen wrote:
>> I still can't see the difference with the patch in Avi's tree except 
>> nvram stuff.  And I believe the global variable you mentioned should 
>> be only used for nvram. So I propose an incremental patch for that. :)
>
> Hi,
>
> Here is an incremental version of the patch. I think the differences
> should be pretty obvious now :-)
>
> It fixes the memcpy issues in the hob and nvram code and also cleans
> up the interfaces a lot.
>
> Avi, please add.

Added, thanks.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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

* Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base
@ 2009-05-04  8:16                         ` Avi Kivity
  0 siblings, 0 replies; 48+ messages in thread
From: Avi Kivity @ 2009-05-04  8:16 UTC (permalink / raw)
  To: kvm-ia64

Jes Sorensen wrote:
> Zhang, Xiantao wrote:
>> Jes Sorensen wrote:
>> I still can't see the difference with the patch in Avi's tree except 
>> nvram stuff.  And I believe the global variable you mentioned should 
>> be only used for nvram. So I propose an incremental patch for that. :)
>
> Hi,
>
> Here is an incremental version of the patch. I think the differences
> should be pretty obvious now :-)
>
> It fixes the memcpy issues in the hob and nvram code and also cleans
> up the interfaces a lot.
>
> Avi, please add.

Added, thanks.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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

end of thread, other threads:[~2009-05-04  8:17 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-28  9:29 [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Zhang, Xiantao
2009-04-28  9:29 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for Zhang, Xiantao
2009-04-28  9:49 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Avi Kivity
2009-04-28  9:49   ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Avi Kivity
2009-04-28 10:36   ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Zhang, Xiantao
2009-04-28 10:36     ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Zhang, Xiantao
2009-04-28 11:05     ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Avi Kivity
2009-04-28 11:05       ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Avi Kivity
2009-04-28 12:38       ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Jes Sorensen
2009-04-28 12:38         ` Jes Sorensen
2009-04-28 12:49         ` Avi Kivity
2009-04-28 12:49           ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Avi Kivity
2009-04-28 15:02           ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Jes Sorensen
2009-04-28 15:02             ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Jes Sorensen
2009-04-29  2:05           ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Zhang, Xiantao
2009-04-29  2:05             ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Zhang, Xiantao
2009-04-29  8:21             ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Jes Sorensen
2009-04-29  8:21               ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Jes Sorensen
2009-04-29  8:35               ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Zhang, Xiantao
2009-04-29  8:35                 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Zhang, Xiantao
2009-04-29  8:42                 ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Jes Sorensen
2009-04-29  8:42                   ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Jes Sorensen
2009-04-29 14:02                   ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Zhang, Xiantao
2009-04-29 14:02                     ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Zhang, Xiantao
2009-04-29 15:07                     ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Jes Sorensen
2009-04-29 15:07                       ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Jes Sorensen
2009-04-30  9:11                     ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Jes Sorensen
2009-04-30  9:11                       ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Jes Sorensen
2009-04-30  9:23                       ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Avi Kivity
2009-04-30  9:23                         ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Avi Kivity
2009-04-30 14:09                         ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Jes Sorensen
2009-04-30 14:09                           ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Jes Sorensen
2009-04-30 15:22                           ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Avi Kivity
2009-04-30 15:22                             ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Avi Kivity
2009-05-01 10:30                     ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Jes Sorensen
2009-05-01 10:30                       ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Jes Sorensen
2009-05-03 16:14                       ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Avi Kivity
2009-05-03 16:14                         ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Avi Kivity
2009-05-04  1:44                         ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Zhang, Xiantao
2009-05-04  1:44                           ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Zhang, Xiantao
2009-05-04  5:11                           ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Jes Sorensen
2009-05-04  5:11                             ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Jes Sorensen
2009-05-04  5:12                             ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Zhang, Xiantao
2009-05-04  5:12                               ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Zhang, Xiantao
2009-05-04  8:16                       ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Avi Kivity
2009-05-04  8:16                         ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Avi Kivity
2009-04-29  2:04         ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c Zhang, Xiantao
2009-04-29  2:04           ` [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Zhang, Xiantao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.