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, qemu-xen too] ioemu: fix vram tracking when !s->lfb_

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH, qemu-xen too] ioemu: fix vram tracking when !s->lfb_addr
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Tue, 22 Jul 2008 14:48:36 +0100
Delivery-date: Tue, 22 Jul 2008 06:49:01 -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>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
ioemu: fix vram tracking when !s->lfb_addr

When we don't have an LFB (standard VGA), we can not and do not need
vram tracking at all since we always get explicit dirtying.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>

diff -r 69268d1f7dba tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c      Tue Jul 22 12:44:33 2008 +0100
+++ b/tools/ioemu/hw/vga.c      Tue Jul 22 14:46:01 2008 +0100
@@ -1511,51 +1511,52 @@
            width, height, v, line_offset, s->cr[9], s->cr[0x17], 
s->line_compare, s->sr[0x01]);
 #endif
 
-    if (height - 1 > s->line_compare || multi_run || (s->cr[0x17] & 3) != 3
-            || !s->lfb_addr) {
-        /* Tricky things happen, just track all video memory */
-        start = 0;
-        end = s->vram_size;
-    } else {
-        /* Tricky things won't have any effect, i.e. we are in the very simple
-         * (and very usual) case of a linear buffer. */
-        /* use page table dirty bit tracking for the LFB plus border */
-        start = (s->start_addr * 4) & TARGET_PAGE_MASK;
-        end = ((s->start_addr * 4 + height * line_offset) + TARGET_PAGE_SIZE - 
1) & TARGET_PAGE_MASK;
+    if (s->lfb_addr) {
+        if (height - 1 > s->line_compare || multi_run || (s->cr[0x17] & 3) != 
3) {
+            /* Tricky things happen, just track all video memory */
+            start = 0;
+            end = s->vram_size;
+        } else {
+            /* Tricky things won't have any effect, i.e. we are in the very 
simple
+             * (and very usual) case of a linear buffer. */
+            /* use page table dirty bit tracking for the LFB plus border */
+            start = (s->start_addr * 4) & TARGET_PAGE_MASK;
+            end = ((s->start_addr * 4 + height * line_offset) + 
TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
+        }
+
+        for (y = 0 ; y < start; y += TARGET_PAGE_SIZE)
+            /* We will not read that anyway. */
+            cpu_physical_memory_set_dirty(s->vram_offset + y);
+
+        {
+            unsigned long npages = (end - y) / TARGET_PAGE_SIZE;
+            const int width = sizeof(unsigned long) * 8;
+            unsigned long bitmap[(npages + width - 1) / width];
+            int err;
+
+            if (!(err = xc_hvm_track_dirty_vram(xc_handle, domid,
+                        (s->lfb_addr + y) / TARGET_PAGE_SIZE, npages, 
bitmap))) {
+                int i, j;
+                for (i = 0; i < sizeof(bitmap) / sizeof(*bitmap); i++) {
+                    unsigned long map = bitmap[i];
+                    for (j = i * width; map && j < npages; map >>= 1, j++)
+                        if (map & 1)
+                            cpu_physical_memory_set_dirty(s->vram_offset + y
+                                + j * TARGET_PAGE_SIZE);
+                }
+                y += npages * TARGET_PAGE_SIZE;
+            } else {
+                /* ENODATA just means we have changed mode and will succeed
+                 * next time */
+                if (err != -ENODATA)
+                    fprintf(stderr, "track_dirty_vram(%lx, %lx) failed 
(%d)\n", s->lfb_addr + y, npages, err);
+            }
+        }
+
+        for ( ; y < s->vram_size; y += TARGET_PAGE_SIZE)
+            /* We will not read that anyway. */
+            cpu_physical_memory_set_dirty(s->vram_offset + y);
     }
-
-    for (y = 0 ; y < start; y += TARGET_PAGE_SIZE)
-        /* We will not read that anyway. */
-        cpu_physical_memory_set_dirty(s->vram_offset + y);
-
-    {
-        unsigned long npages = (end - y) / TARGET_PAGE_SIZE;
-        const int width = sizeof(unsigned long) * 8;
-        unsigned long bitmap[(npages + width - 1) / width];
-        int err;
-
-        if (!(err = xc_hvm_track_dirty_vram(xc_handle, domid,
-                    (s->lfb_addr + y) / TARGET_PAGE_SIZE, npages, bitmap))) {
-            int i, j;
-            for (i = 0; i < sizeof(bitmap) / sizeof(*bitmap); i++) {
-                unsigned long map = bitmap[i];
-                for (j = i * width; map && j < npages; map >>= 1, j++)
-                    if (map & 1)
-                        cpu_physical_memory_set_dirty(s->vram_offset + y
-                            + j * TARGET_PAGE_SIZE);
-            }
-            y += npages * TARGET_PAGE_SIZE;
-        } else {
-            /* ENODATA just means we have changed mode and will succeed
-             * next time */
-            if (err != -ENODATA)
-                fprintf(stderr, "track_dirty_vram(%lx, %lx) failed (%d)\n", 
s->lfb_addr + y, npages, err);
-        }
-    }
-
-    for ( ; y < s->vram_size; y += TARGET_PAGE_SIZE)
-        /* We will not read that anyway. */
-        cpu_physical_memory_set_dirty(s->vram_offset + y);
 
     addr1 = (s->start_addr * 4);
     bwidth = (width * bits + 7) / 8;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH, qemu-xen too] ioemu: fix vram tracking when !s->lfb_addr, Samuel Thibault <=