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-changelog

[Xen-changelog] [xen-unstable] [qemu patches] Update patches upto change

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [qemu patches] Update patches upto changeset 13108:ed815cbdc90e.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 20 Dec 2006 17:15:23 -0800
Delivery-date: Wed, 20 Dec 2006 17:16:57 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
# Date 1166628166 0
# Node ID f58b0c778b901481c37f9c401c749d7d40baf95d
# Parent  4fb80f21c77df84f6a6d7f61fdce4c337d538291
[qemu patches] Update patches upto changeset 13108:ed815cbdc90e.

Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
---
 tools/ioemu/patches/domain-timeoffset             |   10 
 tools/ioemu/patches/fix-interrupt-routing         |   17 -
 tools/ioemu/patches/ioemu-ia64                    |   38 --
 tools/ioemu/patches/qemu-bootorder                |   26 +-
 tools/ioemu/patches/series                        |    2 
 tools/ioemu/patches/tpm-tis-device                |    9 
 tools/ioemu/patches/vnc-display-find-unused       |    8 
 tools/ioemu/patches/vnc-fixes                     |    8 
 tools/ioemu/patches/vnc-listen-specific-interface |    8 
 tools/ioemu/patches/vnc-password                  |   14 -
 tools/ioemu/patches/vnc-start-vncviewer           |    8 
 tools/ioemu/patches/xen-mapcache                  |  285 +++++++++-------------
 tools/ioemu/patches/xen-support-buffered-ioreqs   |    6 
 tools/ioemu/patches/xenstore-block-device-config  |   19 -
 tools/ioemu/patches/xenstore-write-vnc-port       |    8 
 15 files changed, 198 insertions(+), 268 deletions(-)

diff -r 4fb80f21c77d -r f58b0c778b90 tools/ioemu/patches/domain-timeoffset
--- a/tools/ioemu/patches/domain-timeoffset     Wed Dec 20 15:16:13 2006 +0000
+++ b/tools/ioemu/patches/domain-timeoffset     Wed Dec 20 15:22:46 2006 +0000
@@ -1,7 +1,7 @@ Index: ioemu/hw/mc146818rtc.c
 Index: ioemu/hw/mc146818rtc.c
 ===================================================================
---- ioemu.orig/hw/mc146818rtc.c        2006-12-08 18:36:31.000000000 +0000
-+++ ioemu/hw/mc146818rtc.c     2006-12-08 18:36:36.000000000 +0000
+--- ioemu.orig/hw/mc146818rtc.c        2006-12-20 15:21:33.000000000 +0000
++++ ioemu/hw/mc146818rtc.c     2006-12-20 15:21:50.000000000 +0000
 @@ -178,10 +178,27 @@
      }
  }
@@ -46,8 +46,8 @@ Index: ioemu/hw/mc146818rtc.c
  static void rtc_copy_date(RTCState *s)
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-12-08 18:36:35.000000000 +0000
-+++ ioemu/hw/pc.c      2006-12-08 18:36:36.000000000 +0000
+--- ioemu.orig/hw/pc.c 2006-12-20 15:21:49.000000000 +0000
++++ ioemu/hw/pc.c      2006-12-20 15:21:50.000000000 +0000
 @@ -159,7 +159,7 @@
  }
  
@@ -117,8 +117,8 @@ Index: ioemu/hw/pc.c
  QEMUMachine pc_machine = {
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-12-08 18:36:35.000000000 +0000
-+++ ioemu/vl.c 2006-12-08 18:36:36.000000000 +0000
+--- ioemu.orig/vl.c    2006-12-20 15:21:49.000000000 +0000
++++ ioemu/vl.c 2006-12-20 15:21:50.000000000 +0000
 @@ -163,6 +163,8 @@
  
  int xc_handle;
@@ -162,7 +162,7 @@ Index: ioemu/vl.c
              }
          }
      }
-@@ -6492,7 +6500,8 @@
+@@ -6484,7 +6492,8 @@
  
      machine->init(ram_size, vga_ram_size, boot_device,
                    ds, fd_filename, snapshot,
@@ -174,8 +174,8 @@ Index: ioemu/vl.c
      if (usb_enabled) {
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-12-08 18:36:35.000000000 +0000
-+++ ioemu/vl.h 2006-12-08 18:36:36.000000000 +0000
+--- ioemu.orig/vl.h    2006-12-20 15:21:49.000000000 +0000
++++ ioemu/vl.h 2006-12-20 15:21:50.000000000 +0000
 @@ -576,7 +576,7 @@
                                   int boot_device,
               DisplayState *ds, const char **fd_filename, int snapshot,
diff -r 4fb80f21c77d -r f58b0c778b90 tools/ioemu/patches/fix-interrupt-routing
--- a/tools/ioemu/patches/fix-interrupt-routing Wed Dec 20 15:16:13 2006 +0000
+++ b/tools/ioemu/patches/fix-interrupt-routing Wed Dec 20 15:22:46 2006 +0000
@@ -17,23 +17,21 @@ Signed-off-by: Keir Fraser <keir@xensour
 
 Index: ioemu/Makefile.target
 ===================================================================
---- ioemu.orig/Makefile.target 2006-12-08 18:21:56.000000000 +0000
-+++ ioemu/Makefile.target      2006-12-08 18:22:35.000000000 +0000
-@@ -298,7 +298,7 @@
+--- ioemu.orig/Makefile.target 2006-12-20 15:04:55.000000000 +0000
++++ ioemu/Makefile.target      2006-12-20 15:08:16.000000000 +0000
+@@ -296,9 +296,9 @@
+ 
+ # qemu-dm objects
  ifeq ($(ARCH),ia64)
- LIBOBJS=helper2.o exec-dm.o i8259-dm.o
+-LIBOBJS=helper2.o exec-dm.o i8259-dm.o
++LIBOBJS=helper2.o exec-dm.o i8259-dm.o piix_pci-dm.o
  else
 -LIBOBJS=helper2.o exec-dm.o i8259-dm.o rtc-dm.o
 +LIBOBJS=helper2.o exec-dm.o i8259-dm.o rtc-dm.o piix_pci-dm.o
  endif
  
  all: $(PROGS)
-@@ -360,11 +360,11 @@
- # Hardware support
- VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
- ifeq ($(ARCH),ia64)
--VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o
-+VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o piix_pci.o
+@@ -364,7 +364,7 @@
  else
  VL_OBJS+= fdc.o serial.o pc.o
  endif
@@ -44,8 +42,8 @@ Index: ioemu/Makefile.target
  VL_OBJS+= xenstore.o
 Index: ioemu/target-i386-dm/i8259-dm.c
 ===================================================================
---- ioemu.orig/target-i386-dm/i8259-dm.c       2006-12-08 18:21:36.000000000 
+0000
-+++ ioemu/target-i386-dm/i8259-dm.c    2006-12-08 18:22:35.000000000 +0000
+--- ioemu.orig/target-i386-dm/i8259-dm.c       2006-12-20 15:04:54.000000000 
+0000
++++ ioemu/target-i386-dm/i8259-dm.c    2006-12-20 15:04:55.000000000 +0000
 @@ -33,7 +33,7 @@
  
  void pic_set_irq_new(void *opaque, int irq, int level)
@@ -58,7 +56,7 @@ Index: ioemu/target-i386-dm/piix_pci-dm.
 Index: ioemu/target-i386-dm/piix_pci-dm.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/target-i386-dm/piix_pci-dm.c 2006-12-08 18:22:35.000000000 +0000
++++ ioemu/target-i386-dm/piix_pci-dm.c 2006-12-20 15:08:13.000000000 +0000
 @@ -0,0 +1,397 @@
 +/*
 + * QEMU i440FX/PIIX3 PCI Bridge Emulation
diff -r 4fb80f21c77d -r f58b0c778b90 tools/ioemu/patches/ioemu-ia64
--- a/tools/ioemu/patches/ioemu-ia64    Wed Dec 20 15:16:13 2006 +0000
+++ b/tools/ioemu/patches/ioemu-ia64    Wed Dec 20 15:22:46 2006 +0000
@@ -1,7 +1,7 @@ Index: ioemu/hw/iommu.c
 Index: ioemu/hw/iommu.c
 ===================================================================
---- ioemu.orig/hw/iommu.c      2006-12-08 02:02:07.000000000 +0000
-+++ ioemu/hw/iommu.c   2006-12-08 02:02:34.000000000 +0000
+--- ioemu.orig/hw/iommu.c      2006-12-20 15:04:54.000000000 +0000
++++ ioemu/hw/iommu.c   2006-12-20 15:04:54.000000000 +0000
 @@ -82,7 +82,11 @@
  #define IOPTE_VALID         0x00000002 /* IOPTE is valid */
  #define IOPTE_WAZ           0x00000001 /* Write as zeros */
@@ -16,8 +16,8 @@ Index: ioemu/hw/iommu.c
  
 Index: ioemu/cpu-all.h
 ===================================================================
---- ioemu.orig/cpu-all.h       2006-12-08 02:02:07.000000000 +0000
-+++ ioemu/cpu-all.h    2006-12-08 02:02:34.000000000 +0000
+--- ioemu.orig/cpu-all.h       2006-12-20 15:04:54.000000000 +0000
++++ ioemu/cpu-all.h    2006-12-20 15:04:54.000000000 +0000
 @@ -835,6 +835,31 @@
                  :"=m" (*(volatile long *)addr)
                  :"dIr" (nr));
@@ -52,13 +52,17 @@ Index: ioemu/cpu-all.h
  /* memory API */
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-12-08 02:02:28.000000000 +0000
-+++ ioemu/vl.c 2006-12-08 02:02:34.000000000 +0000
-@@ -6137,6 +6137,11 @@
+--- ioemu.orig/vl.c    2006-12-20 15:04:54.000000000 +0000
++++ ioemu/vl.c 2006-12-20 15:12:00.000000000 +0000
+@@ -6137,6 +6137,15 @@
              exit(1);
      }
  
 +#if defined (__ia64__)
++    /* ram_size passed from xend has added on GFW memory,
++       so we must subtract it here */
++    ram_size -= 16 * MEM_M;
++
 +    if (ram_size > MMIO_START)
 +        ram_size += 1 * MEM_G; /* skip 3G-4G MMIO, LEGACY_IO_SPACE etc. */
 +#endif
@@ -66,7 +70,7 @@ Index: ioemu/vl.c
      /* init the memory */
      phys_ram_size = ram_size + vga_ram_size + bios_size;
  
-@@ -6161,6 +6166,7 @@
+@@ -6161,6 +6170,7 @@
          exit(-1);
      }
  
@@ -74,41 +78,29 @@ Index: ioemu/vl.c
      for ( i = 0; i < tmp_nr_pages; i++)
          page_array[i] = i;
  
-@@ -6185,6 +6191,48 @@
+@@ -6185,6 +6195,36 @@
  
      free(page_array);
  
 +#elif defined(__ia64__)
 +  
-+    if (xc_ia64_get_pfn_list(xc_handle, domid, page_array,
-+                             IO_PAGE_START >> PAGE_SHIFT, 3) != 3) {
-+        fprintf(logfile, "xc_ia64_get_pfn_list returned error %d\n", errno);
-+        exit(-1);
-+    }
-+
 +    shared_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
 +                                       PROT_READ|PROT_WRITE,
-+                                       page_array[0]);
-+
-+    fprintf(logfile, "shared page at pfn:%lx, mfn: %016lx\n",
-+            IO_PAGE_START >> PAGE_SHIFT, page_array[0]);
++                                       IO_PAGE_START >> PAGE_SHIFT);
 +
 +    buffered_io_page =xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
 +                                       PROT_READ|PROT_WRITE,
-+                                       page_array[2]);
-+    fprintf(logfile, "Buffered IO page at pfn:%lx, mfn: %016lx\n",
-+            BUFFER_IO_PAGE_START >> PAGE_SHIFT, page_array[2]);
-+
-+    if (xc_ia64_get_pfn_list(xc_handle, domid,
-+                             page_array, 0, nr_pages) != nr_pages) {
-+        fprintf(logfile, "xc_ia64_get_pfn_list returned error %d\n", errno);
-+        exit(-1);
-+    }
-+
++                                       BUFFER_IO_PAGE_START >> PAGE_SHIFT);
++
++    for (i = 0; i < tmp_nr_pages; i++)
++        page_array[i] = i;
++      
++    /* VTI will not use memory between 3G~4G, so we just pass a legal pfn
++       to make QEMU map continuous virtual memory space */
 +    if (ram_size > MMIO_START) {      
 +        for (i = 0 ; i < (MEM_G >> PAGE_SHIFT); i++)
 +            page_array[(MMIO_START >> PAGE_SHIFT) + i] =
-+                page_array[(IO_PAGE_START >> PAGE_SHIFT) + 1];
++                (STORE_PAGE_START >> PAGE_SHIFT); 
 +    }
 +
 +    phys_ram_base = xc_map_foreign_batch(xc_handle, domid,
@@ -125,8 +117,8 @@ Index: ioemu/vl.c
      phys_ram_base = qemu_vmalloc(phys_ram_size);
 Index: ioemu/exec-all.h
 ===================================================================
---- ioemu.orig/exec-all.h      2006-12-08 02:02:07.000000000 +0000
-+++ ioemu/exec-all.h   2006-12-08 02:02:34.000000000 +0000
+--- ioemu.orig/exec-all.h      2006-12-20 15:04:54.000000000 +0000
++++ ioemu/exec-all.h   2006-12-20 15:04:54.000000000 +0000
 @@ -462,12 +462,13 @@
  }
  #endif
@@ -146,8 +138,8 @@ Index: ioemu/exec-all.h
  
 Index: ioemu/target-i386-dm/cpu.h
 ===================================================================
---- ioemu.orig/target-i386-dm/cpu.h    2006-12-08 02:02:07.000000000 +0000
-+++ ioemu/target-i386-dm/cpu.h 2006-12-08 02:02:34.000000000 +0000
+--- ioemu.orig/target-i386-dm/cpu.h    2006-12-20 15:04:54.000000000 +0000
++++ ioemu/target-i386-dm/cpu.h 2006-12-20 15:10:13.000000000 +0000
 @@ -78,7 +78,11 @@
  /* helper2.c */
  int main_loop(void);
@@ -163,7 +155,7 @@ Index: ioemu/ia64_intrinsic.h
 Index: ioemu/ia64_intrinsic.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/ia64_intrinsic.h     2006-12-08 02:02:34.000000000 +0000
++++ ioemu/ia64_intrinsic.h     2006-12-20 15:04:54.000000000 +0000
 @@ -0,0 +1,276 @@
 +#ifndef IA64_INTRINSIC_H
 +#define IA64_INTRINSIC_H
diff -r 4fb80f21c77d -r f58b0c778b90 tools/ioemu/patches/qemu-bootorder
--- a/tools/ioemu/patches/qemu-bootorder        Wed Dec 20 15:16:13 2006 +0000
+++ b/tools/ioemu/patches/qemu-bootorder        Wed Dec 20 15:22:46 2006 +0000
@@ -1,7 +1,7 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-12-08 02:02:38.000000000 +0000
-+++ ioemu/vl.c 2006-12-08 02:02:38.000000000 +0000
+--- ioemu.orig/vl.c    2006-12-20 15:12:08.000000000 +0000
++++ ioemu/vl.c 2006-12-20 15:21:19.000000000 +0000
 @@ -125,7 +125,7 @@
  struct sockaddr_in vnclisten_addr;
  const char* keyboard_layout = NULL;
@@ -17,15 +17,17 @@ Index: ioemu/vl.c
              case QEMU_OPTION_boot:
 -                boot_device = optarg[0];
 -                if (boot_device != 'a' && 
+-#ifdef TARGET_SPARC
+-                  // Network boot
+-                  boot_device != 'n' &&
+-#endif
+-                    boot_device != 'c' && boot_device != 'd') {
+-                    fprintf(stderr, "qemu: invalid boot device '%c'\n", 
boot_device);
 +                boot_device = strdup(optarg);
 +                if (strspn(boot_device, "acd"
- #ifdef TARGET_SPARC
--                  // Network boot
--                  boot_device != 'n' &&
++#if defined(TARGET_SPARC) || defined(TARGET_I386)
 +                           "n"
- #endif
--                    boot_device != 'c' && boot_device != 'd') {
--                    fprintf(stderr, "qemu: invalid boot device '%c'\n", 
boot_device);
++#endif
 +                        ) != strlen(boot_device)) {
 +                    fprintf(stderr, "qemu: invalid boot device in '%s'\n",
 +                            boot_device);
@@ -48,7 +50,7 @@ Index: ioemu/vl.c
  #endif /* !CONFIG_DM */
  
      setvbuf(stdout, NULL, _IOLBF, 0);
-@@ -6598,6 +6600,7 @@
+@@ -6590,6 +6592,7 @@
                    ds, fd_filename, snapshot,
                    kernel_filename, kernel_cmdline, initrd_filename,
                    timeoffset);
@@ -58,8 +60,8 @@ Index: ioemu/vl.c
      if (usb_enabled) {
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-12-08 02:02:38.000000000 +0000
-+++ ioemu/vl.h 2006-12-08 02:02:38.000000000 +0000
+--- ioemu.orig/vl.h    2006-12-20 15:12:08.000000000 +0000
++++ ioemu/vl.h 2006-12-20 15:21:14.000000000 +0000
 @@ -578,7 +578,7 @@
  #ifndef QEMU_TOOL
  
@@ -80,9 +82,9 @@ Index: ioemu/vl.h
                            uint32_t initrd_image, uint32_t initrd_size,
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-12-08 02:02:38.000000000 +0000
-+++ ioemu/hw/pc.c      2006-12-08 02:02:38.000000000 +0000
-@@ -158,8 +158,23 @@
+--- ioemu.orig/hw/pc.c 2006-12-20 15:12:08.000000000 +0000
++++ ioemu/hw/pc.c      2006-12-20 15:21:19.000000000 +0000
+@@ -158,8 +158,25 @@
      rtc_set_memory(s, info_ofs + 8, sectors);
  }
  
@@ -96,6 +98,8 @@ Index: ioemu/hw/pc.c
 +            return 0x02;            /* hard drive */
 +        case 'd':
 +            return 0x03;            /* cdrom */
++        case 'n':
++            return 0x04;            /* network */
 +        }
 +    }
 +    return 0x00;                /* no device */
@@ -107,7 +111,7 @@ Index: ioemu/hw/pc.c
  {
      RTCState *s = rtc_state;
      int val;
-@@ -205,21 +220,14 @@
+@@ -205,21 +222,14 @@
      rtc_set_memory(s, 0x34, val);
      rtc_set_memory(s, 0x35, val >> 8);
      
@@ -137,7 +141,7 @@ Index: ioemu/hw/pc.c
  
      /* floppy type */
  
-@@ -617,7 +625,7 @@
+@@ -617,7 +627,7 @@
  #define NOBIOS 1
  
  /* PC hardware initialisation */
@@ -146,7 +150,7 @@ Index: ioemu/hw/pc.c
                       DisplayState *ds, const char **fd_filename, int snapshot,
                       const char *kernel_filename, const char *kernel_cmdline,
                       const char *initrd_filename, time_t timeoffset,
-@@ -919,7 +927,7 @@
+@@ -919,7 +929,7 @@
      }
  }
  
@@ -155,7 +159,7 @@ Index: ioemu/hw/pc.c
                          DisplayState *ds, const char **fd_filename, 
                          int snapshot, 
                          const char *kernel_filename, 
-@@ -933,7 +941,7 @@
+@@ -933,7 +943,7 @@
               initrd_filename, timeoffset, 1);
  }
  
diff -r 4fb80f21c77d -r f58b0c778b90 tools/ioemu/patches/series
--- a/tools/ioemu/patches/series        Wed Dec 20 15:16:13 2006 +0000
+++ b/tools/ioemu/patches/series        Wed Dec 20 15:22:46 2006 +0000
@@ -67,5 +67,5 @@ vnc-monitor-shift-key-processing
 vnc-monitor-shift-key-processing
 ide-error-reporting
 vnc-numpad-handling
-xen-mapcache -p3
+xen-mapcache
 usb-mouse-tablet-status-check -p3
diff -r 4fb80f21c77d -r f58b0c778b90 tools/ioemu/patches/tpm-tis-device
--- a/tools/ioemu/patches/tpm-tis-device        Wed Dec 20 15:16:13 2006 +0000
+++ b/tools/ioemu/patches/tpm-tis-device        Wed Dec 20 15:22:46 2006 +0000
@@ -22,8 +22,8 @@ Signed-off-by: Stefan Berger <stefanb@us
 
 Index: ioemu/Makefile.target
 ===================================================================
---- ioemu.orig/Makefile.target 2006-12-08 18:33:48.000000000 +0000
-+++ ioemu/Makefile.target      2006-12-08 18:35:14.000000000 +0000
+--- ioemu.orig/Makefile.target 2006-12-20 15:21:55.000000000 +0000
++++ ioemu/Makefile.target      2006-12-20 15:21:55.000000000 +0000
 @@ -369,6 +369,7 @@
  VL_OBJS+= piix4acpi.o
  VL_OBJS+= xenstore.o
@@ -34,9 +34,9 @@ Index: ioemu/Makefile.target
  ifeq ($(TARGET_BASE_ARCH), ppc)
 Index: ioemu/hw/pc.c
 ===================================================================
---- ioemu.orig/hw/pc.c 2006-12-08 18:33:47.000000000 +0000
-+++ ioemu/hw/pc.c      2006-12-08 18:33:48.000000000 +0000
-@@ -875,6 +875,9 @@
+--- ioemu.orig/hw/pc.c 2006-12-20 15:21:54.000000000 +0000
++++ ioemu/hw/pc.c      2006-12-20 15:21:55.000000000 +0000
+@@ -877,6 +877,9 @@
          }
      }
  
@@ -49,7 +49,7 @@ Index: ioemu/hw/tpm_tis.c
 Index: ioemu/hw/tpm_tis.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/hw/tpm_tis.c 2006-12-08 18:35:25.000000000 +0000
++++ ioemu/hw/tpm_tis.c 2006-12-20 15:21:55.000000000 +0000
 @@ -0,0 +1,1120 @@
 +/*
 + * tpm_tis.c - QEMU emulator for a 1.2 TPM with TIS interface
@@ -1173,8 +1173,8 @@ Index: ioemu/hw/tpm_tis.c
 +}
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-12-08 18:33:48.000000000 +0000
-+++ ioemu/vl.h 2006-12-08 18:35:14.000000000 +0000
+--- ioemu.orig/vl.h    2006-12-20 15:21:55.000000000 +0000
++++ ioemu/vl.h 2006-12-20 15:21:55.000000000 +0000
 @@ -932,6 +932,10 @@
  void piix4_pm_init(PCIBus *bus, int devfn);
  void acpi_bios_init(void);
diff -r 4fb80f21c77d -r f58b0c778b90 tools/ioemu/patches/vnc-display-find-unused
--- a/tools/ioemu/patches/vnc-display-find-unused       Wed Dec 20 15:16:13 
2006 +0000
+++ b/tools/ioemu/patches/vnc-display-find-unused       Wed Dec 20 15:22:46 
2006 +0000
@@ -1,7 +1,7 @@ Index: ioemu/vnc.c
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-12-08 02:02:36.000000000 +0000
-+++ ioemu/vnc.c        2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/vnc.c   2006-12-20 15:21:52.000000000 +0000
++++ ioemu/vnc.c        2006-12-20 15:21:52.000000000 +0000
 @@ -1197,7 +1197,7 @@
      }
  }
@@ -50,8 +50,8 @@ Index: ioemu/vnc.c
  int vnc_start_viewer(int port)
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-12-08 02:02:36.000000000 +0000
-+++ ioemu/vl.c 2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/vl.c    2006-12-20 15:21:51.000000000 +0000
++++ ioemu/vl.c 2006-12-20 15:21:52.000000000 +0000
 @@ -121,6 +121,7 @@
  static DisplayState display_state;
  int nographic;
@@ -104,7 +104,7 @@ Index: ioemu/vl.c
              }
          }
      }
-@@ -6468,7 +6478,7 @@
+@@ -6460,7 +6470,7 @@
      if (nographic) {
          dumb_display_init(ds);
      } else if (vnc_display != -1) {
@@ -115,8 +115,8 @@ Index: ioemu/vl.c
      } else {
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-12-08 02:02:36.000000000 +0000
-+++ ioemu/vl.h 2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/vl.h    2006-12-20 15:21:51.000000000 +0000
++++ ioemu/vl.h 2006-12-20 15:21:52.000000000 +0000
 @@ -785,7 +785,7 @@
  void cocoa_display_init(DisplayState *ds, int full_screen);
  
diff -r 4fb80f21c77d -r f58b0c778b90 tools/ioemu/patches/vnc-fixes
--- a/tools/ioemu/patches/vnc-fixes     Wed Dec 20 15:16:13 2006 +0000
+++ b/tools/ioemu/patches/vnc-fixes     Wed Dec 20 15:22:46 2006 +0000
@@ -1,8 +1,8 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-12-08 02:02:36.000000000 +0000
-+++ ioemu/vl.c 2006-12-08 02:02:36.000000000 +0000
-@@ -6519,8 +6519,10 @@
+--- ioemu.orig/vl.c    2006-12-20 15:21:51.000000000 +0000
++++ ioemu/vl.c 2006-12-20 15:21:51.000000000 +0000
+@@ -6511,8 +6511,10 @@
          }
      }
  
@@ -17,8 +17,8 @@ Index: ioemu/vl.c
      if (use_gdbstub) {
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-12-08 02:02:36.000000000 +0000
-+++ ioemu/vnc.c        2006-12-08 02:02:36.000000000 +0000
+--- ioemu.orig/vnc.c   2006-12-20 15:21:51.000000000 +0000
++++ ioemu/vnc.c        2006-12-20 15:21:51.000000000 +0000
 @@ -3,6 +3,7 @@
   * 
   * Copyright (C) 2006 Anthony Liguori <anthony@xxxxxxxxxxxxx>
@@ -531,8 +531,8 @@ Index: ioemu/vnc.c
  }
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-12-08 02:02:36.000000000 +0000
-+++ ioemu/vl.h 2006-12-08 02:02:36.000000000 +0000
+--- ioemu.orig/vl.h    2006-12-20 15:21:51.000000000 +0000
++++ ioemu/vl.h 2006-12-20 15:21:51.000000000 +0000
 @@ -319,6 +319,7 @@
  int is_graphic_console(void);
  CharDriverState *text_console_init(DisplayState *ds);
diff -r 4fb80f21c77d -r f58b0c778b90 
tools/ioemu/patches/vnc-listen-specific-interface
--- a/tools/ioemu/patches/vnc-listen-specific-interface Wed Dec 20 15:16:13 
2006 +0000
+++ b/tools/ioemu/patches/vnc-listen-specific-interface Wed Dec 20 15:22:46 
2006 +0000
@@ -20,8 +20,8 @@ Signed-off-by:  Daniel P. Berrange <berr
 
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-12-08 02:02:37.000000000 +0000
-+++ ioemu/vl.c 2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/vl.c    2006-12-20 15:21:52.000000000 +0000
++++ ioemu/vl.c 2006-12-20 15:21:52.000000000 +0000
 @@ -122,6 +122,7 @@
  int nographic;
  int vncviewer;
@@ -114,7 +114,7 @@ Index: ioemu/vl.c
              }
          }
      }
-@@ -6478,7 +6493,7 @@
+@@ -6470,7 +6485,7 @@
      if (nographic) {
          dumb_display_init(ds);
      } else if (vnc_display != -1) {
@@ -125,8 +125,8 @@ Index: ioemu/vl.c
      } else {
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-12-08 02:02:37.000000000 +0000
-+++ ioemu/vl.h 2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/vl.h    2006-12-20 15:21:52.000000000 +0000
++++ ioemu/vl.h 2006-12-20 15:21:52.000000000 +0000
 @@ -37,6 +37,8 @@
  #include <unistd.h>
  #include <fcntl.h>
@@ -147,8 +147,8 @@ Index: ioemu/vl.h
  /* ide.c */
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-12-08 02:02:37.000000000 +0000
-+++ ioemu/vnc.c        2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/vnc.c   2006-12-20 15:21:52.000000000 +0000
++++ ioemu/vnc.c        2006-12-20 15:21:52.000000000 +0000
 @@ -1197,9 +1197,8 @@
      }
  }
diff -r 4fb80f21c77d -r f58b0c778b90 tools/ioemu/patches/vnc-password
--- a/tools/ioemu/patches/vnc-password  Wed Dec 20 15:16:13 2006 +0000
+++ b/tools/ioemu/patches/vnc-password  Wed Dec 20 15:22:46 2006 +0000
@@ -17,8 +17,8 @@ Signed-off-by: Masami Watanabe <masami.w
 
 Index: ioemu/Makefile.target
 ===================================================================
---- ioemu.orig/Makefile.target 2006-12-08 18:20:53.000000000 +0000
-+++ ioemu/Makefile.target      2006-12-08 18:20:53.000000000 +0000
+--- ioemu.orig/Makefile.target 2006-12-20 15:21:55.000000000 +0000
++++ ioemu/Makefile.target      2006-12-20 15:21:55.000000000 +0000
 @@ -407,6 +407,7 @@
  VL_OBJS+=sdl.o
  endif
@@ -39,8 +39,8 @@ Index: ioemu/Makefile.target
  
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-12-08 18:20:52.000000000 +0000
-+++ ioemu/vl.c 2006-12-08 18:20:53.000000000 +0000
+--- ioemu.orig/vl.c    2006-12-20 15:21:54.000000000 +0000
++++ ioemu/vl.c 2006-12-20 15:21:55.000000000 +0000
 @@ -171,6 +171,9 @@
  char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
  extern int domid;
@@ -59,7 +59,7 @@ Index: ioemu/vl.c
  #ifndef CONFIG_DM
  #ifdef TARGET_PPC
      cdrom_index = 1;
-@@ -6543,6 +6547,10 @@
+@@ -6535,6 +6539,10 @@
  
      init_ioports();
  
@@ -72,8 +72,8 @@ Index: ioemu/vl.c
          dumb_display_init(ds);
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-12-08 18:20:52.000000000 +0000
-+++ ioemu/vl.h 2006-12-08 18:20:53.000000000 +0000
+--- ioemu.orig/vl.h    2006-12-20 15:21:54.000000000 +0000
++++ ioemu/vl.h 2006-12-20 15:21:55.000000000 +0000
 @@ -1214,6 +1214,7 @@
  void xenstore_process_event(void *opaque);
  void xenstore_check_new_media_present(int timeout);
@@ -92,8 +92,8 @@ Index: ioemu/vl.h
  #endif /* VL_H */
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-12-08 18:20:52.000000000 +0000
-+++ ioemu/vnc.c        2006-12-08 18:20:53.000000000 +0000
+--- ioemu.orig/vnc.c   2006-12-20 15:21:52.000000000 +0000
++++ ioemu/vnc.c        2006-12-20 15:21:55.000000000 +0000
 @@ -44,6 +44,7 @@
  
  #include "vnc_keysym.h"
@@ -244,8 +244,8 @@ Index: ioemu/vnc.c
 +}
 Index: ioemu/xenstore.c
 ===================================================================
---- ioemu.orig/xenstore.c      2006-12-08 18:20:52.000000000 +0000
-+++ ioemu/xenstore.c   2006-12-08 18:20:53.000000000 +0000
+--- ioemu.orig/xenstore.c      2006-12-20 15:21:54.000000000 +0000
++++ ioemu/xenstore.c   2006-12-20 15:21:55.000000000 +0000
 @@ -213,3 +213,54 @@
      free(portstr);
      free(buf);
@@ -304,7 +304,7 @@ Index: ioemu/d3des.c
 Index: ioemu/d3des.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/d3des.c      2006-12-08 18:20:53.000000000 +0000
++++ ioemu/d3des.c      2006-12-20 15:21:55.000000000 +0000
 @@ -0,0 +1,434 @@
 +/*
 + * This is D3DES (V5.09) by Richard Outerbridge with the double and
@@ -743,7 +743,7 @@ Index: ioemu/d3des.h
 Index: ioemu/d3des.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/d3des.h      2006-12-08 18:20:53.000000000 +0000
++++ ioemu/d3des.h      2006-12-20 15:21:55.000000000 +0000
 @@ -0,0 +1,51 @@
 +/*
 + * This is D3DES (V5.09) by Richard Outerbridge with the double and
diff -r 4fb80f21c77d -r f58b0c778b90 tools/ioemu/patches/vnc-start-vncviewer
--- a/tools/ioemu/patches/vnc-start-vncviewer   Wed Dec 20 15:16:13 2006 +0000
+++ b/tools/ioemu/patches/vnc-start-vncviewer   Wed Dec 20 15:22:46 2006 +0000
@@ -1,7 +1,7 @@ Index: ioemu/vnc.c
 Index: ioemu/vnc.c
 ===================================================================
---- ioemu.orig/vnc.c   2006-12-08 02:02:36.000000000 +0000
-+++ ioemu/vnc.c        2006-12-08 02:02:36.000000000 +0000
+--- ioemu.orig/vnc.c   2006-12-20 15:21:51.000000000 +0000
++++ ioemu/vnc.c        2006-12-20 15:21:51.000000000 +0000
 @@ -1189,3 +1189,25 @@
  
      vnc_dpy_resize(vs->ds, 640, 400);
@@ -30,8 +30,8 @@ Index: ioemu/vnc.c
 +}
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-12-08 02:02:36.000000000 +0000
-+++ ioemu/vl.c 2006-12-08 02:02:36.000000000 +0000
+--- ioemu.orig/vl.c    2006-12-20 15:21:51.000000000 +0000
++++ ioemu/vl.c 2006-12-20 15:21:51.000000000 +0000
 @@ -120,6 +120,7 @@
  int bios_size;
  static DisplayState display_state;
@@ -82,7 +82,7 @@ Index: ioemu/vl.c
              }
          }
      }
-@@ -6461,6 +6469,8 @@
+@@ -6453,6 +6461,8 @@
          dumb_display_init(ds);
      } else if (vnc_display != -1) {
        vnc_display_init(ds, vnc_display);
@@ -93,8 +93,8 @@ Index: ioemu/vl.c
          sdl_display_init(ds, full_screen);
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-12-08 02:02:36.000000000 +0000
-+++ ioemu/vl.h 2006-12-08 02:02:36.000000000 +0000
+--- ioemu.orig/vl.h    2006-12-20 15:21:51.000000000 +0000
++++ ioemu/vl.h 2006-12-20 15:21:51.000000000 +0000
 @@ -786,6 +786,7 @@
  
  /* vnc.c */
diff -r 4fb80f21c77d -r f58b0c778b90 tools/ioemu/patches/xen-mapcache
--- a/tools/ioemu/patches/xen-mapcache  Wed Dec 20 15:16:13 2006 +0000
+++ b/tools/ioemu/patches/xen-mapcache  Wed Dec 20 15:22:46 2006 +0000
@@ -15,22 +15,179 @@ Signed-off-by: Dexuan Cui <dexuan.cui@in
 Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
 Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
 
-diff -r 3f0ca90351e2 -r 67a06a9b7b1d tools/ioemu/target-i386-dm/cpu.h
---- a/tools/ioemu/target-i386-dm/cpu.h Thu Dec 07 10:54:43 2006 +0000
-+++ b/tools/ioemu/target-i386-dm/cpu.h Thu Dec 07 11:12:52 2006 +0000
-@@ -25,7 +25,8 @@
- #ifdef TARGET_X86_64
- #define TARGET_LONG_BITS 64
- #else
--#define TARGET_LONG_BITS 32
-+/* #define TARGET_LONG_BITS 32 */
-+#define TARGET_LONG_BITS 64 /* for Qemu map cache */
- #endif
- 
- /* target supports implicit self modifying code */
-diff -r 3f0ca90351e2 -r 67a06a9b7b1d tools/ioemu/target-i386-dm/exec-dm.c
---- a/tools/ioemu/target-i386-dm/exec-dm.c     Thu Dec 07 10:54:43 2006 +0000
-+++ b/tools/ioemu/target-i386-dm/exec-dm.c     Thu Dec 07 11:12:52 2006 +0000
+Index: ioemu/vl.c
+===================================================================
+--- ioemu.orig/vl.c    2006-12-20 15:12:08.000000000 +0000
++++ ioemu/vl.c 2006-12-20 15:13:00.000000000 +0000
+@@ -5808,6 +5808,91 @@
+     return 0;
+ }
+ 
++#if defined(__i386__) || defined(__x86_64__)
++static struct map_cache *mapcache_entry;
++static unsigned long nr_buckets;
++
++static int qemu_map_cache_init(unsigned long nr_pages)
++{
++    unsigned long max_pages = MAX_MCACHE_SIZE >> PAGE_SHIFT;
++    int i;
++
++    if (nr_pages < max_pages)
++        max_pages = nr_pages;
++
++    nr_buckets   = max_pages + (1UL << (MCACHE_BUCKET_SHIFT - PAGE_SHIFT)) - 
1;
++    nr_buckets >>= (MCACHE_BUCKET_SHIFT - PAGE_SHIFT);
++    fprintf(logfile, "qemu_map_cache_init nr_buckets = %lx\n", nr_buckets);
++
++    mapcache_entry = malloc(nr_buckets * sizeof(struct map_cache));
++    if (mapcache_entry == NULL) {
++        errno = ENOMEM;
++        return -1;
++    }
++
++    memset(mapcache_entry, 0, nr_buckets * sizeof(struct map_cache));
++
++    /*
++     * To avoid ENOMEM from xc_map_foreign_batch() at runtime, we
++     * pre-fill all the map caches in advance.
++     */
++    for (i = 0; i < nr_buckets; i++)
++       (void)qemu_map_cache(((target_phys_addr_t)i) << MCACHE_BUCKET_SHIFT);
++
++    return 0;
++}
++
++uint8_t *qemu_map_cache(target_phys_addr_t phys_addr)
++{
++    struct map_cache *entry;
++    unsigned long address_index  = phys_addr >> MCACHE_BUCKET_SHIFT;
++    unsigned long address_offset = phys_addr & (MCACHE_BUCKET_SIZE-1);
++
++    /* For most cases (>99.9%), the page address is the same. */
++    static unsigned long last_address_index = ~0UL;
++    static uint8_t      *last_address_vaddr;
++
++    if (address_index == last_address_index)
++        return last_address_vaddr + address_offset;
++
++    entry = &mapcache_entry[address_index % nr_buckets];
++
++    if (entry->vaddr_base == NULL || entry->paddr_index != address_index) {
++        /* We need to remap a bucket. */
++        uint8_t *vaddr_base;
++        unsigned long pfns[MCACHE_BUCKET_SIZE >> PAGE_SHIFT];
++        unsigned int i;
++
++        if (entry->vaddr_base != NULL) {
++            errno = munmap(entry->vaddr_base, MCACHE_BUCKET_SIZE);
++            if (errno) {
++                fprintf(logfile, "unmap fails %d\n", errno);
++                exit(-1);
++            }
++        }
++
++        for (i = 0; i < MCACHE_BUCKET_SIZE >> PAGE_SHIFT; i++)
++            pfns[i] = (address_index << (MCACHE_BUCKET_SHIFT-PAGE_SHIFT)) + i;
++
++        vaddr_base = xc_map_foreign_batch(
++            xc_handle, domid, PROT_READ|PROT_WRITE,
++            pfns, MCACHE_BUCKET_SIZE >> PAGE_SHIFT);
++        if (vaddr_base == NULL) {
++            fprintf(logfile, "xc_map_foreign_batch error %d\n", errno);
++            exit(-1);
++        }
++
++        entry->vaddr_base  = vaddr_base;
++        entry->paddr_index = address_index;;
++    }
++
++    last_address_index = address_index;
++    last_address_vaddr = entry->vaddr_base;
++
++    return last_address_vaddr + address_offset;
++}
++#endif
++
+ int main(int argc, char **argv)
+ {
+ #ifdef CONFIG_GDBSTUB
+@@ -6130,6 +6215,7 @@
+                 break;
+             case QEMU_OPTION_m:
+                 ram_size = atol(optarg) * 1024 * 1024;
++                ram_size = (uint64_t)atol(optarg) * 1024 * 1024;
+                 if (ram_size <= 0)
+                     help();
+ #ifndef CONFIG_DM
+@@ -6404,50 +6490,41 @@
+         shared_page_nr = nr_pages - 1;
+ #endif
+ 
+-    page_array = (xen_pfn_t *)malloc(tmp_nr_pages * sizeof(xen_pfn_t));
+-    if (page_array == NULL) {
+-        fprintf(logfile, "malloc returned error %d\n", errno);
+-        exit(-1);
+-    }
+-
+ #if defined(__i386__) || defined(__x86_64__)
+-    for ( i = 0; i < tmp_nr_pages; i++)
+-        page_array[i] = i;
+ 
+-    phys_ram_base = xc_map_foreign_batch(xc_handle, domid,
+-                                         PROT_READ|PROT_WRITE, page_array,
+-                                         tmp_nr_pages);
+-    if (phys_ram_base == NULL) {
+-        fprintf(logfile, "batch map guest memory returned error %d\n", errno);
++    if ( qemu_map_cache_init(tmp_nr_pages) )
++    {
++        fprintf(logfile, "qemu_map_cache_init returned: error %d\n", errno);
+         exit(-1);
+     }
+ 
+     shared_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
+-                                       PROT_READ|PROT_WRITE,
+-                                       page_array[shared_page_nr]);
++                                       PROT_READ|PROT_WRITE, shared_page_nr);
+     if (shared_page == NULL) {
+         fprintf(logfile, "map shared IO page returned error %d\n", errno);
+         exit(-1);
+     }
+ 
+-    fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n",
+-            shared_page_nr, (uint64_t)(page_array[shared_page_nr]));
++    fprintf(logfile, "shared page at pfn:%lx\n", shared_page_nr);
+ 
+     buffered_io_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
+                                             PROT_READ|PROT_WRITE,
+-                                            page_array[shared_page_nr - 2]);
++                                            shared_page_nr - 2);
+     if (buffered_io_page == NULL) {
+         fprintf(logfile, "map buffered IO page returned error %d\n", errno);
+         exit(-1);
+     }
+ 
+-    fprintf(logfile, "buffered io page at pfn:%lx, mfn: %"PRIx64"\n",
+-            shared_page_nr - 2, (uint64_t)(page_array[shared_page_nr - 2]));
+-
+-    free(page_array);
++    fprintf(logfile, "buffered io page at pfn:%lx\n", shared_page_nr - 2);
+ 
+ #elif defined(__ia64__)
+-  
++
++    page_array = (xen_pfn_t *)malloc(tmp_nr_pages * sizeof(xen_pfn_t));
++    if (page_array == NULL) {
++        fprintf(logfile, "malloc returned error %d\n", errno);
++        exit(-1);
++    }
++
+     shared_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
+                                        PROT_READ|PROT_WRITE,
+                                        IO_PAGE_START >> PAGE_SHIFT);
+Index: ioemu/target-i386-dm/exec-dm.c
+===================================================================
+--- ioemu.orig/target-i386-dm/exec-dm.c        2006-12-20 15:10:13.000000000 
+0000
++++ ioemu/target-i386-dm/exec-dm.c     2006-12-20 15:12:13.000000000 +0000
 @@ -36,6 +36,7 @@
  
  #include "cpu.h"
@@ -39,7 +196,51 @@ diff -r 3f0ca90351e2 -r 67a06a9b7b1d too
  
  //#define DEBUG_TB_INVALIDATE
  //#define DEBUG_FLUSH
-@@ -426,6 +427,12 @@ static inline int paddr_is_ram(target_ph
+@@ -127,10 +128,28 @@
+ FILE *logfile;
+ int loglevel;
+ 
++
++#if defined(__i386__) || defined(__x86_64__)
++#define MAPCACHE
++#endif
++
++#ifdef MAPCACHE
++static pthread_mutex_t mapcache_mutex;
++#define mapcache_lock() pthread_mutex_lock(&mapcache_mutex)
++#define mapcache_unlock() pthread_mutex_unlock(&mapcache_mutex)
++#else 
++#define mapcache_lock() ( (void)0 )
++#define mapcache_unlock() ( (void)0 )
++#endif
++
++
+ void cpu_exec_init(CPUState *env)
+ {
+     CPUState **penv;
+     int cpu_index;
++#ifdef MAPCACHE
++    pthread_mutexattr_t mxattr; 
++#endif
+ 
+     env->next_cpu = NULL;
+     penv = &first_cpu;
+@@ -144,6 +163,14 @@
+ 
+     /* alloc dirty bits array */
+     phys_ram_dirty = qemu_malloc(phys_ram_size >> TARGET_PAGE_BITS);
++
++#ifdef MAPCACHE
++    /* setup memory access mutex to protect mapcache */
++    pthread_mutexattr_init(&mxattr); 
++    pthread_mutexattr_settype(&mxattr, PTHREAD_MUTEX_RECURSIVE);
++    pthread_mutex_init(&mapcache_mutex, &mxattr); 
++    pthread_mutexattr_destroy(&mxattr); 
++#endif
+ }
+ 
+ /* enable or disable low levels log */
+@@ -426,19 +453,27 @@
  #endif
  }
  
@@ -52,7 +253,15 @@ diff -r 3f0ca90351e2 -r 67a06a9b7b1d too
  void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, 
                              int len, int is_write)
  {
-@@ -438,7 +445,7 @@ void cpu_physical_memory_rw(target_phys_
+     int l, io_index;
+     uint8_t *ptr;
+     uint32_t val;
+-    
++
++    mapcache_lock();
++
+     while (len > 0) {
+         /* How much can we copy before the next page boundary? */
          l = TARGET_PAGE_SIZE - (addr & ~TARGET_PAGE_MASK); 
          if (l > len)
              l = len;
@@ -61,7 +270,7 @@ diff -r 3f0ca90351e2 -r 67a06a9b7b1d too
          io_index = iomem_index(addr);
          if (is_write) {
              if (io_index) {
-@@ -460,9 +467,10 @@ void cpu_physical_memory_rw(target_phys_
+@@ -460,9 +495,10 @@
                  }
              } else if (paddr_is_ram(addr)) {
                  /* Reading from RAM */
@@ -74,7 +283,7 @@ diff -r 3f0ca90351e2 -r 67a06a9b7b1d too
  #endif 
              }
          } else {
-@@ -485,7 +493,8 @@ void cpu_physical_memory_rw(target_phys_
+@@ -485,7 +521,8 @@
                  }
              } else if (paddr_is_ram(addr)) {
                  /* Reading from RAM */
@@ -84,194 +293,20 @@ diff -r 3f0ca90351e2 -r 67a06a9b7b1d too
              } else {
                  /* Neither RAM nor known MMIO space */
                  memset(buf, 0xff, len); 
-diff -r 3f0ca90351e2 -r 67a06a9b7b1d tools/ioemu/vl.c
---- a/tools/ioemu/vl.c Thu Dec 07 10:54:43 2006 +0000
-+++ b/tools/ioemu/vl.c Thu Dec 07 11:12:52 2006 +0000
-@@ -5807,6 +5807,92 @@ int set_mm_mapping(int xc_handle, uint32
- 
-     return 0;
- }
-+
-+#if defined(__i386__) || defined(__x86_64__)
-+static struct map_cache *mapcache_entry;
-+static unsigned long nr_buckets;
-+
-+static int qemu_map_cache_init(unsigned long nr_pages)
-+{
-+    unsigned long max_pages = MAX_MCACHE_SIZE >> PAGE_SHIFT;
-+    int i;
-+
-+    if (nr_pages < max_pages)
-+        max_pages = nr_pages;
-+
-+    nr_buckets = (max_pages << PAGE_SHIFT) >> MCACHE_BUCKET_SHIFT;
-+
-+    fprintf(logfile, "qemu_map_cache_init nr_buckets = %lx\n", nr_buckets);
-+
-+    mapcache_entry = malloc(nr_buckets * sizeof(struct map_cache));
-+    if (mapcache_entry == NULL) {
-+        errno = ENOMEM;
-+        return -1;
-+    }
-+
-+    memset(mapcache_entry, 0, nr_buckets * sizeof(struct map_cache));
-+
-+    /*
-+     * To avoid ENOMEM from xc_map_foreign_batch() at runtime, we
-+     * pre-fill all the map caches in advance.
-+     */
-+    for (i = 0; i < nr_buckets; i++)
-+       (void)qemu_map_cache(((target_phys_addr_t)i) << MCACHE_BUCKET_SHIFT);
-+
-+    return 0;
-+}
-+
-+uint8_t *qemu_map_cache(target_phys_addr_t phys_addr)
-+{
-+    struct map_cache *entry;
-+    unsigned long address_index  = phys_addr >> MCACHE_BUCKET_SHIFT;
-+    unsigned long address_offset = phys_addr & (MCACHE_BUCKET_SIZE-1);
-+
-+    /* For most cases (>99.9%), the page address is the same. */
-+    static unsigned long last_address_index = ~0UL;
-+    static uint8_t      *last_address_vaddr;
-+
-+    if (address_index == last_address_index)
-+        return last_address_vaddr + address_offset;
-+
-+    entry = &mapcache_entry[address_index % nr_buckets];
-+
-+    if (entry->vaddr_base == NULL || entry->paddr_index != address_index)
-+    { 
-+        /* We need to remap a bucket. */
-+        uint8_t *vaddr_base;
-+        unsigned long pfns[MCACHE_BUCKET_SIZE >> PAGE_SHIFT];
-+        unsigned int i;
-+
-+        if (entry->vaddr_base != NULL) {
-+            errno = munmap(entry->vaddr_base, MCACHE_BUCKET_SIZE);
-+            if (errno) {
-+                fprintf(logfile, "unmap fails %d\n", errno);
-+                exit(-1);
-+            }
-+        }
-+
-+        for (i = 0; i < MCACHE_BUCKET_SIZE >> PAGE_SHIFT; i++)
-+            pfns[i] = (address_index << (MCACHE_BUCKET_SHIFT-PAGE_SHIFT)) + i;
-+
-+        vaddr_base = xc_map_foreign_batch(
-+            xc_handle, domid, PROT_READ|PROT_WRITE,
-+            pfns, MCACHE_BUCKET_SIZE >> PAGE_SHIFT);
-+        if (vaddr_base == NULL) {
-+            fprintf(logfile, "xc_map_foreign_batch error %d\n", errno);
-+            exit(-1);
-+        }
-+
-+        entry->vaddr_base  = vaddr_base;
-+        entry->paddr_index = address_index;;
-+    }
-+
-+    last_address_index = address_index;
-+    last_address_vaddr = entry->vaddr_base;
-+
-+    return last_address_vaddr + address_offset;
-+}
-+#endif
- 
- int main(int argc, char **argv)
- {
-@@ -6130,6 +6216,7 @@ int main(int argc, char **argv)
-                 break;
-             case QEMU_OPTION_m:
-                 ram_size = atol(optarg) * 1024 * 1024;
-+                ram_size = (uint64_t)atol(optarg) * 1024 * 1024;
-                 if (ram_size <= 0)
-                     help();
- #ifndef CONFIG_DM
-@@ -6400,50 +6487,41 @@ int main(int argc, char **argv)
-         shared_page_nr = nr_pages - 1;
- #endif
- 
-+#if defined(__i386__) || defined(__x86_64__)
-+
-+    if ( qemu_map_cache_init(tmp_nr_pages) )
-+    {
-+        fprintf(logfile, "qemu_map_cache_init returned: error %d\n", errno);
-+        exit(-1);
-+    }
-+
-+    shared_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
-+                                       PROT_READ|PROT_WRITE, shared_page_nr);
-+    if (shared_page == NULL) {
-+        fprintf(logfile, "map shared IO page returned error %d\n", errno);
-+        exit(-1);
-+    }
-+
-+    fprintf(logfile, "shared page at pfn:%lx\n", shared_page_nr);
-+
-+    buffered_io_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
-+                                            PROT_READ|PROT_WRITE,
-+                                            shared_page_nr - 2);
-+    if (buffered_io_page == NULL) {
-+        fprintf(logfile, "map buffered IO page returned error %d\n", errno);
-+        exit(-1);
-+    }
-+
-+    fprintf(logfile, "buffered io page at pfn:%lx\n", shared_page_nr - 2);
-+
-+#elif defined(__ia64__)
-+
-     page_array = (xen_pfn_t *)malloc(tmp_nr_pages * sizeof(xen_pfn_t));
-     if (page_array == NULL) {
-         fprintf(logfile, "malloc returned error %d\n", errno);
-         exit(-1);
-     }
- 
--#if defined(__i386__) || defined(__x86_64__)
--    for ( i = 0; i < tmp_nr_pages; i++)
--        page_array[i] = i;
--
--    phys_ram_base = xc_map_foreign_batch(xc_handle, domid,
--                                         PROT_READ|PROT_WRITE, page_array,
--                                         tmp_nr_pages);
--    if (phys_ram_base == NULL) {
--        fprintf(logfile, "batch map guest memory returned error %d\n", errno);
--        exit(-1);
--    }
--
--    shared_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
--                                       PROT_READ|PROT_WRITE,
--                                       page_array[shared_page_nr]);
--    if (shared_page == NULL) {
--        fprintf(logfile, "map shared IO page returned error %d\n", errno);
--        exit(-1);
--    }
--
--    fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n",
--            shared_page_nr, (uint64_t)(page_array[shared_page_nr]));
--
--    buffered_io_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
--                                            PROT_READ|PROT_WRITE,
--                                            page_array[shared_page_nr - 2]);
--    if (buffered_io_page == NULL) {
--        fprintf(logfile, "map buffered IO page returned error %d\n", errno);
--        exit(-1);
--    }
--
--    fprintf(logfile, "buffered io page at pfn:%lx, mfn: %"PRIx64"\n",
--            shared_page_nr - 2, (uint64_t)(page_array[shared_page_nr - 2]));
--
--    free(page_array);
--
--#elif defined(__ia64__)
--  
-     if (xc_ia64_get_pfn_list(xc_handle, domid, page_array,
-                              IO_PAGE_START >> PAGE_SHIFT, 3) != 3) {
-         fprintf(logfile, "xc_ia64_get_pfn_list returned error %d\n", errno);
-diff -r 3f0ca90351e2 -r 67a06a9b7b1d tools/ioemu/vl.h
---- a/tools/ioemu/vl.h Thu Dec 07 10:54:43 2006 +0000
-+++ b/tools/ioemu/vl.h Thu Dec 07 11:12:52 2006 +0000
-@@ -156,6 +156,26 @@ extern void *shared_vram;
+@@ -495,6 +532,8 @@
+         buf += l;
+         addr += l;
+     }
++
++    mapcache_unlock();
+ }
+ #endif
+ 
+Index: ioemu/vl.h
+===================================================================
+--- ioemu.orig/vl.h    2006-12-20 15:12:08.000000000 +0000
++++ ioemu/vl.h 2006-12-20 15:12:13.000000000 +0000
+@@ -156,6 +156,26 @@
  
  extern FILE *logfile;
  
@@ -298,3 +333,17 @@ diff -r 3f0ca90351e2 -r 67a06a9b7b1d too
  extern int xc_handle;
  extern int domid;
  
+Index: ioemu/target-i386-dm/cpu.h
+===================================================================
+--- ioemu.orig/target-i386-dm/cpu.h    2006-12-20 15:10:13.000000000 +0000
++++ ioemu/target-i386-dm/cpu.h 2006-12-20 15:12:13.000000000 +0000
+@@ -25,7 +25,8 @@
+ #ifdef TARGET_X86_64
+ #define TARGET_LONG_BITS 64
+ #else
+-#define TARGET_LONG_BITS 32
++/* #define TARGET_LONG_BITS 32 */
++#define TARGET_LONG_BITS 64 /* for Qemu map cache */
+ #endif
+ 
+ /* target supports implicit self modifying code */
diff -r 4fb80f21c77d -r f58b0c778b90 
tools/ioemu/patches/xen-support-buffered-ioreqs
--- a/tools/ioemu/patches/xen-support-buffered-ioreqs   Wed Dec 20 15:16:13 
2006 +0000
+++ b/tools/ioemu/patches/xen-support-buffered-ioreqs   Wed Dec 20 15:22:46 
2006 +0000
@@ -1,7 +1,7 @@ Index: ioemu/vl.c
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-12-08 02:02:37.000000000 +0000
-+++ ioemu/vl.c 2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/vl.c    2006-12-20 15:21:54.000000000 +0000
++++ ioemu/vl.c 2006-12-20 15:21:54.000000000 +0000
 @@ -5838,6 +5838,7 @@
      unsigned long nr_pages, tmp_nr_pages, shared_page_nr;
      xen_pfn_t *page_array;
@@ -10,7 +10,7 @@ Index: ioemu/vl.c
  
      char qemu_dm_logfilename[64];
  
-@@ -6418,6 +6419,17 @@
+@@ -6422,6 +6423,17 @@
      fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n",
              shared_page_nr, (uint64_t)(page_array[shared_page_nr]));
  
@@ -30,8 +30,8 @@ Index: ioemu/vl.c
  #elif defined(__ia64__)
 Index: ioemu/target-i386-dm/helper2.c
 ===================================================================
---- ioemu.orig/target-i386-dm/helper2.c        2006-12-08 02:02:35.000000000 
+0000
-+++ ioemu/target-i386-dm/helper2.c     2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/target-i386-dm/helper2.c        2006-12-20 15:21:47.000000000 
+0000
++++ ioemu/target-i386-dm/helper2.c     2006-12-20 15:21:54.000000000 +0000
 @@ -76,6 +76,10 @@
  
  shared_iopage_t *shared_page = NULL;
diff -r 4fb80f21c77d -r f58b0c778b90 
tools/ioemu/patches/xenstore-block-device-config
--- a/tools/ioemu/patches/xenstore-block-device-config  Wed Dec 20 15:16:13 
2006 +0000
+++ b/tools/ioemu/patches/xenstore-block-device-config  Wed Dec 20 15:22:46 
2006 +0000
@@ -1,7 +1,7 @@ Index: ioemu/Makefile.target
 Index: ioemu/Makefile.target
 ===================================================================
---- ioemu.orig/Makefile.target 2006-12-08 02:02:36.000000000 +0000
-+++ ioemu/Makefile.target      2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/Makefile.target 2006-12-20 15:21:51.000000000 +0000
++++ ioemu/Makefile.target      2006-12-20 15:21:53.000000000 +0000
 @@ -359,6 +359,7 @@
  VL_OBJS+= cirrus_vga.o mixeng.o parallel.o acpi.o piix_pci.o
  VL_OBJS+= usb-uhci.o
@@ -13,7 +13,7 @@ Index: ioemu/xenstore.c
 Index: ioemu/xenstore.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ioemu/xenstore.c   2006-12-08 02:02:37.000000000 +0000
++++ ioemu/xenstore.c   2006-12-20 15:21:53.000000000 +0000
 @@ -0,0 +1,187 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General
@@ -204,8 +204,8 @@ Index: ioemu/xenstore.c
 +}
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-12-08 02:02:37.000000000 +0000
-+++ ioemu/vl.c 2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/vl.c    2006-12-20 15:21:52.000000000 +0000
++++ ioemu/vl.c 2006-12-20 15:21:53.000000000 +0000
 @@ -5256,9 +5256,11 @@
             "Standard options:\n"
             "-M machine      select emulated machine (-M ? for list)\n"
@@ -359,7 +359,7 @@ Index: ioemu/vl.c
  
      setvbuf(stdout, NULL, _IOLBF, 0);
      
-@@ -6441,6 +6472,7 @@
+@@ -6433,6 +6464,7 @@
  
  #endif /* !CONFIG_DM */
  
@@ -367,7 +367,7 @@ Index: ioemu/vl.c
      /* we always create the cdrom drive, even if no disk is there */
      bdrv_init();
      if (cdrom_index >= 0) {
-@@ -6467,6 +6499,7 @@
+@@ -6459,6 +6491,7 @@
              }
          }
      }
@@ -375,7 +375,7 @@ Index: ioemu/vl.c
  
      /* we always create at least one floppy disk */
      fd_table[0] = bdrv_new("fda");
-@@ -6545,6 +6578,8 @@
+@@ -6537,6 +6570,8 @@
          }
      }
  
@@ -386,8 +386,8 @@ Index: ioemu/vl.c
                    kernel_filename, kernel_cmdline, initrd_filename,
 Index: ioemu/monitor.c
 ===================================================================
---- ioemu.orig/monitor.c       2006-12-08 02:02:35.000000000 +0000
-+++ ioemu/monitor.c    2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/monitor.c       2006-12-20 15:21:47.000000000 +0000
++++ ioemu/monitor.c    2006-12-20 15:21:53.000000000 +0000
 @@ -24,6 +24,7 @@
  #include "vl.h"
  #include "disas.h"
@@ -416,8 +416,8 @@ Index: ioemu/monitor.c
      int i;
 Index: ioemu/block.c
 ===================================================================
---- ioemu.orig/block.c 2006-12-08 02:02:06.000000000 +0000
-+++ ioemu/block.c      2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/block.c 2006-12-20 15:21:31.000000000 +0000
++++ ioemu/block.c      2006-12-20 15:21:53.000000000 +0000
 @@ -758,6 +758,7 @@
  static void raw_close(BlockDriverState *bs)
  {
@@ -428,8 +428,8 @@ Index: ioemu/block.c
  
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-12-08 02:02:37.000000000 +0000
-+++ ioemu/vl.h 2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/vl.h    2006-12-20 15:21:52.000000000 +0000
++++ ioemu/vl.h 2006-12-20 15:21:53.000000000 +0000
 @@ -1191,6 +1191,8 @@
  void term_print_help(void);
  void monitor_readline(const char *prompt, int is_password,
@@ -455,8 +455,8 @@ Index: ioemu/vl.h
  extern char domain_name[];
 Index: ioemu/hw/ide.c
 ===================================================================
---- ioemu.orig/hw/ide.c        2006-12-08 02:02:35.000000000 +0000
-+++ ioemu/hw/ide.c     2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/hw/ide.c        2006-12-20 15:21:49.000000000 +0000
++++ ioemu/hw/ide.c     2006-12-20 15:21:53.000000000 +0000
 @@ -1158,6 +1158,7 @@
          } else {
              ide_atapi_cmd_error(s, SENSE_NOT_READY, 
diff -r 4fb80f21c77d -r f58b0c778b90 tools/ioemu/patches/xenstore-write-vnc-port
--- a/tools/ioemu/patches/xenstore-write-vnc-port       Wed Dec 20 15:16:13 
2006 +0000
+++ b/tools/ioemu/patches/xenstore-write-vnc-port       Wed Dec 20 15:22:46 
2006 +0000
@@ -1,7 +1,7 @@ Index: ioemu/xenstore.c
 Index: ioemu/xenstore.c
 ===================================================================
---- ioemu.orig/xenstore.c      2006-12-08 02:02:37.000000000 +0000
-+++ ioemu/xenstore.c   2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/xenstore.c      2006-12-20 15:21:53.000000000 +0000
++++ ioemu/xenstore.c   2006-12-20 15:21:54.000000000 +0000
 @@ -185,3 +185,31 @@
      free(image);
      free(vec);
@@ -36,9 +36,9 @@ Index: ioemu/xenstore.c
 +}
 Index: ioemu/vl.c
 ===================================================================
---- ioemu.orig/vl.c    2006-12-08 02:02:37.000000000 +0000
-+++ ioemu/vl.c 2006-12-08 02:02:37.000000000 +0000
-@@ -6535,6 +6535,7 @@
+--- ioemu.orig/vl.c    2006-12-20 15:21:53.000000000 +0000
++++ ioemu/vl.c 2006-12-20 15:21:54.000000000 +0000
+@@ -6527,6 +6527,7 @@
        vnc_display = vnc_display_init(ds, vnc_display, vncunused, 
&vnclisten_addr);
        if (vncviewer)
            vnc_start_viewer(vnc_display);
@@ -48,8 +48,8 @@ Index: ioemu/vl.c
          sdl_display_init(ds, full_screen);
 Index: ioemu/vl.h
 ===================================================================
---- ioemu.orig/vl.h    2006-12-08 02:02:37.000000000 +0000
-+++ ioemu/vl.h 2006-12-08 02:02:37.000000000 +0000
+--- ioemu.orig/vl.h    2006-12-20 15:21:53.000000000 +0000
++++ ioemu/vl.h 2006-12-20 15:21:54.000000000 +0000
 @@ -1210,6 +1210,7 @@
  int xenstore_fd(void);
  void xenstore_process_event(void *opaque);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [qemu patches] Update patches upto changeset 13108:ed815cbdc90e., Xen patchbot-unstable <=