WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Fix ia64 HVM boot failure.

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "Ian.Jackson@xxxxxxxxxxxxx" <Ian.Jackson@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Fix ia64 HVM boot failure.
From: "Zhang, Xiantao" <xiantao.zhang@xxxxxxxxx>
Date: Tue, 7 Apr 2009 17:19:55 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: "xen-ia64-devel@xxxxxxxxxxxxxxxxxxx" <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 07 Apr 2009 02:20:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acm3YgPf2zays0VSRmu0g0ikWOXLWQ==
Thread-topic: [PATCH] Fix ia64 HVM boot failure.
For Non-MAPCACHE case, to get the virtual address corresponding to guest 
physical address, only an offset value is added to guest physical address.
With this patch, ia64 HVM boot failure bug can be fixed. 
Xiantao


>From 2b766d9ad3c6cb8c0e2a41976108b8a28416ecbb Mon Sep 17 00:00:00 2001
From: Xiantao Zhang <xiantao.zhang@xxxxxxxxx>
Date: Tue, 7 Apr 2009 17:07:36 +0800
Subject: [PATCH] For non-mapcache case, only need to use phys_ram_addr
to get host virtual address correponsidng to guest
physical address.

Signed-off-by: Xiantao Zhang <xiantao.zhang@xxxxxxxxx>
---
 hw/xen_machine_fv.c |    9 ++++++
 i386-dm/exec-dm.c   |   77 +-------------------------------------------------
 qemu-xen.h          |   10 ++++--
 3 files changed, 18 insertions(+), 78 deletions(-)

diff --git a/hw/xen_machine_fv.c b/hw/xen_machine_fv.c
index cbd32c7..a5292c1 100644
--- a/hw/xen_machine_fv.c
+++ b/hw/xen_machine_fv.c
@@ -256,6 +256,15 @@ void qemu_invalidate_map_cache(void)
 
     mapcache_unlock();
 }
+#else
+uint8_t *qemu_map_cache(target_phys_addr_t phys_addr, uint8_t lock)
+{
+       return phys_ram_addr(phys_addr);
+}
+
+void qemu_invalidate_map_cache(void) {};
+
+void qemu_invalidate_entry(uint8_t *buffer) {};
 
 #endif /* defined(MAPCACHE) */
 
diff --git a/i386-dm/exec-dm.c b/i386-dm/exec-dm.c
index 40c8868..daf5f56 100644
--- a/i386-dm/exec-dm.c
+++ b/i386-dm/exec-dm.c
@@ -453,12 +453,6 @@ void unregister_iomem(target_phys_addr_t start)
 }
 
 
-#if defined(__i386__) || defined(__x86_64__)
-#define phys_ram_addr(x) (qemu_map_cache(x, 0))
-#elif defined(__ia64__)
-#define phys_ram_addr(x) (((x) < ram_size) ? (phys_ram_base + (x)) : NULL)
-#endif
-
 unsigned long *logdirty_bitmap;
 unsigned long logdirty_bitmap_size;
 
@@ -795,7 +789,6 @@ static void cpu_notify_map_clients(void)
     }
 }
 
-#ifdef MAPCACHE
 /* Map a physical memory region into a host virtual address.
  * May map a subset of the requested range, given by and returned in *plen.
  * May return NULL if resources needed to perform the mapping are exhausted.
@@ -807,9 +800,11 @@ void *cpu_physical_memory_map(target_phys_addr_t addr,
                               target_phys_addr_t *plen,
                               int is_write)
 {
+#ifdef MAPCACHE
     unsigned long l = MCACHE_BUCKET_SIZE - (addr & (MCACHE_BUCKET_SIZE-1));
     if ((*plen) > l)
         *plen = l;
+#endif
     return qemu_map_cache(addr, 1);
 }
 
@@ -822,71 +817,3 @@ void cpu_physical_memory_unmap(void *buffer, 
target_phys_addr_t len,
 {
     qemu_invalidate_entry(buffer);
 }
-#else
-/* Map a physical memory region into a host virtual address.
- * May map a subset of the requested range, given by and returned in *plen.
- * May return NULL if resources needed to perform the mapping are exhausted.
- * Use only for reads OR writes - not for read-modify-write operations.
- * Use cpu_register_map_client() to know when retrying the map operation is
- * likely to succeed.
- */
-void *cpu_physical_memory_map(target_phys_addr_t addr,
-                              target_phys_addr_t *plen,
-                              int is_write)
-{
-    target_phys_addr_t len = *plen;
-    target_phys_addr_t done = 0;
-    int l;
-    uint8_t *ret = NULL;
-    uint8_t *ptr;
-    target_phys_addr_t page;
-    PhysPageDesc *p;
-    unsigned long addr1;
-
-    while (len > 0) {
-        page = addr & TARGET_PAGE_MASK;
-        l = (page + TARGET_PAGE_SIZE) - addr;
-        if (l > len)
-            l = len;
-
-        if (done || bounce.buffer) {
-            break;
-        }
-       bounce.buffer = qemu_memalign(TARGET_PAGE_SIZE, TARGET_PAGE_SIZE);
-        bounce.addr = addr;
-        bounce.len = l;
-        if (!is_write) {
-            cpu_physical_memory_rw(addr, bounce.buffer, l, 0);
-        }
-        ptr = bounce.buffer;
-
-        if (!done) {
-            ret = ptr;
-        } else if (ret + done != ptr) {
-            break;
-        }
-
-        len -= l;
-        addr += l;
-        done += l;
-    }
-    *plen = done;
-    return ret;
-}
-
-/* Unmaps a memory region previously mapped by cpu_physical_memory_map().
- * Will also mark the memory as dirty if is_write == 1.  access_len gives
- * the amount of memory that was actually read or written by the caller.
- */
-void cpu_physical_memory_unmap(void *buffer, target_phys_addr_t len,
-                               int is_write, target_phys_addr_t access_len)
-{
-    assert(buffer == bounce.buffer);
-    if (is_write) {
-        cpu_physical_memory_write(bounce.addr, bounce.buffer, access_len);
-    }
-    qemu_free(bounce.buffer);
-    bounce.buffer = NULL;
-    cpu_notify_map_clients();
-}
-#endif
diff --git a/qemu-xen.h b/qemu-xen.h
index 06d4f27..41fbc53 100644
--- a/qemu-xen.h
+++ b/qemu-xen.h
@@ -5,6 +5,12 @@
 extern int restore;
 extern int vga_ram_size;
 
+#if defined(__i386__) || defined(__x86_64__)
+#define phys_ram_addr(x) (qemu_map_cache(x, 0))
+#elif defined(__ia64__)
+#define phys_ram_addr(x) (((x) < ram_size) ? (phys_ram_base + (x)) : NULL)
+#endif
+
 /* xen_machine_fv.c */
 
 #if (defined(__i386__) || defined(__x86_64__)) && !defined(QEMU_TOOL)
@@ -19,13 +25,11 @@ extern int vga_ram_size;
 #endif
 
 #define MCACHE_BUCKET_SIZE (1UL << MCACHE_BUCKET_SHIFT)
+#endif
 
 uint8_t *qemu_map_cache(target_phys_addr_t phys_addr, uint8_t lock);
 void     qemu_invalidate_entry(uint8_t *buffer);
 void     qemu_invalidate_map_cache(void);
-#else 
-#define qemu_invalidate_map_cache() ((void)0)
-#endif
 
 #define mapcache_lock()   ((void)0)
 #define mapcache_unlock() ((void)0)
-- 
1.5.2.4

Attachment: 0001-For-non-mapcache-case-only-need-to-use-phys_ram_add.patch
Description: 0001-For-non-mapcache-case-only-need-to-use-phys_ram_add.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>