qemu-0.14.0: Removed redundant parallel-build.patch
authorKhem Raj <raj.khem@gmail.com>
Wed, 16 Mar 2011 07:18:29 +0000 (00:18 -0700)
committerKhem Raj <raj.khem@gmail.com>
Wed, 16 Mar 2011 07:18:29 +0000 (00:18 -0700)
* Import patches from ubuntu

Signed-off-by: Khem Raj <raj.khem@gmail.com>
recipes/qemu/qemu-0.14.0/Detect-and-use-GCC-atomic-builtins-for-locking.patch [new file with mode: 0644]
recipes/qemu/qemu-0.14.0/larger_default_ram_size.patch [new file with mode: 0644]
recipes/qemu/qemu-0.14.0/parallel-build.patch [deleted file]
recipes/qemu/qemu-0.14.0/spice-qxl-locking-fix-for-qemu-kvm.patch [new file with mode: 0644]
recipes/qemu/qemu_0.14.0.bb

diff --git a/recipes/qemu/qemu-0.14.0/Detect-and-use-GCC-atomic-builtins-for-locking.patch b/recipes/qemu/qemu-0.14.0/Detect-and-use-GCC-atomic-builtins-for-locking.patch
new file mode 100644 (file)
index 0000000..82bfca2
--- /dev/null
@@ -0,0 +1,84 @@
+From de01f17a2cb88dc5ff53cc321342b888c33b120a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Lo=C3=AFc=20Minier?= <lool@dooz.org>
+Date: Thu, 11 Feb 2010 17:42:33 +0100
+Subject: [PATCH] Detect and use GCC atomic builtins for locking
+
+---
+ configure   |   17 +++++++++++++++++
+ qemu-lock.h |   13 +++++++++++++
+ 2 files changed, 30 insertions(+), 0 deletions(-)
+
+Index: qemu-0.14.0/configure
+===================================================================
+--- qemu-0.14.0.orig/configure
++++ qemu-0.14.0/configure
+@@ -2242,6 +2242,20 @@ fi
+ ##########################################
+ ##########################################
++# check if we have gcc atomic built-ins
++gcc_atomic_builtins=no
++cat > $TMPC << EOF
++int main(void) {
++    int i;
++    __sync_lock_test_and_set(&i, 1);
++    __sync_lock_release(&i);
++}
++EOF
++if compile_prog "" ""; then
++    gcc_atomic_builtins=yes
++fi
++
++##########################################
+ # check if we have fdatasync
+ fdatasync=no
+@@ -2730,6 +2744,9 @@ fi
+ if test "$gcc_attribute_warn_unused_result" = "yes" ; then
+   echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
+ fi
++if test "$gcc_atomic_builtins" = "yes" ; then
++  echo "CONFIG_GCC_ATOMIC_BUILTINS=y" >> $config_host_mak
++fi
+ if test "$fdatasync" = "yes" ; then
+   echo "CONFIG_FDATASYNC=y" >> $config_host_mak
+ fi
+Index: qemu-0.14.0/qemu-lock.h
+===================================================================
+--- qemu-0.14.0.orig/qemu-lock.h
++++ qemu-0.14.0/qemu-lock.h
+@@ -33,6 +33,14 @@
+ #else
++#ifdef CONFIG_GCC_ATOMIC_BUILTINS
++typedef int spinlock_t;
++
++#define SPIN_LOCK_UNLOCKED 0
++
++#define resetlock(p) __sync_lock_release((p))
++#else /* CONFIG_GCC_ATOMIC_BUILTINS */
++
+ #if defined(__hppa__)
+ typedef int spinlock_t[4];
+@@ -56,7 +64,11 @@ static inline void resetlock (spinlock_t
+ }
+ #endif
++#endif /* !CONFIG_GCC_ATOMIC_BUILTINS */
++#ifdef CONFIG_GCC_ATOMIC_BUILTINS
++#define testandset(p) __sync_lock_test_and_set((p), 1)
++#else /* CONFIG_GCC_ATOMIC_BUILTINS */
+ #if defined(_ARCH_PPC)
+ static inline int testandset (int *p)
+ {
+@@ -213,6 +225,7 @@ static inline int testandset (int *p)
+ #else
+ #error unimplemented CPU support
+ #endif
++#endif /* !CONFIG_GCC_ATOMIC_BUILTINS */
+ #if defined(CONFIG_USER_ONLY)
+ static inline void spin_lock(spinlock_t *lock)
diff --git a/recipes/qemu/qemu-0.14.0/larger_default_ram_size.patch b/recipes/qemu/qemu-0.14.0/larger_default_ram_size.patch
new file mode 100644 (file)
index 0000000..2d965c9
--- /dev/null
@@ -0,0 +1,13 @@
+Index: qemu-0.14.0/vl.c
+===================================================================
+--- qemu-0.14.0.orig/vl.c
++++ qemu-0.14.0/vl.c
+@@ -168,7 +168,7 @@ int main(int argc, char **argv)
+ //#define DEBUG_NET
+ //#define DEBUG_SLIRP
+-#define DEFAULT_RAM_SIZE 128
++#define DEFAULT_RAM_SIZE 384
+ #define MAX_VIRTIO_CONSOLES 1
diff --git a/recipes/qemu/qemu-0.14.0/parallel-build.patch b/recipes/qemu/qemu-0.14.0/parallel-build.patch
deleted file mode 100644 (file)
index 2b77624..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-This patch is taken from 
-https://bugs.gentoo.org/show_bug.cgi?id=343175
--Khem
-
-Index: qemu-0.14.0/rules.mak
-===================================================================
---- qemu-0.14.0.orig/rules.mak
-+++ qemu-0.14.0/rules.mak
-@@ -14,13 +14,13 @@ MAKEFLAGS += -rR
- # Flags for dependency generation
- QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
--%.o: %.c
-+%.o: %.c $(GENERATED_HEADERS)
-       $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
--%.o: %.S
-+%.o: %.S $(GENERATED_HEADERS)
-       $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  AS    $(TARGET_DIR)$@")
--%.o: %.m
-+%.o: %.m $(GENERATED_HEADERS)
-       $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
- LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(LIBS),"  LINK  $(TARGET_DIR)$@")
diff --git a/recipes/qemu/qemu-0.14.0/spice-qxl-locking-fix-for-qemu-kvm.patch b/recipes/qemu/qemu-0.14.0/spice-qxl-locking-fix-for-qemu-kvm.patch
new file mode 100644 (file)
index 0000000..87d5927
--- /dev/null
@@ -0,0 +1,150 @@
+Description: spice/qxl: locking fix for qemu-kvm
+Author: Gerd Hoffmann <kraxel@redhat.com>
+Source: upstream, http://patchwork.ozlabs.org/patch/84704/
+Forwarding: not-needed
+
+Index: qemu-0.14.0/hw/qxl.c
+===================================================================
+--- qemu-0.14.0.orig/hw/qxl.c
++++ qemu-0.14.0/hw/qxl.c
+@@ -125,6 +125,27 @@ static void qxl_reset_memslots(PCIQXLDev
+ static void qxl_reset_surfaces(PCIQXLDevice *d);
+ static void qxl_ring_set_dirty(PCIQXLDevice *qxl);
++/* qemu-kvm locking ... */
++void qxl_unlock_iothread(SimpleSpiceDisplay *ssd)
++{
++    if (cpu_single_env) {
++        assert(ssd->env == NULL);
++        ssd->env = cpu_single_env;
++        cpu_single_env = NULL;
++    }
++    qemu_mutex_unlock_iothread();
++}
++
++void qxl_lock_iothread(SimpleSpiceDisplay *ssd)
++{
++    qemu_mutex_lock_iothread();
++    if (ssd->env) {
++        assert(cpu_single_env == NULL);
++        cpu_single_env = ssd->env;
++        ssd->env = NULL;
++    }
++}
++
+ static inline uint32_t msb_mask(uint32_t val)
+ {
+     uint32_t mask;
+@@ -662,10 +683,10 @@ static void qxl_hard_reset(PCIQXLDevice
+     dprint(d, 1, "%s: start%s\n", __FUNCTION__,
+            loadvm ? " (loadvm)" : "");
+-    qemu_mutex_unlock_iothread();
++    qxl_unlock_iothread(&d->ssd);
+     d->ssd.worker->reset_cursor(d->ssd.worker);
+     d->ssd.worker->reset_image_cache(d->ssd.worker);
+-    qemu_mutex_lock_iothread();
++    qxl_lock_iothread(&d->ssd);
+     qxl_reset_surfaces(d);
+     qxl_reset_memslots(d);
+@@ -795,9 +816,9 @@ static void qxl_reset_surfaces(PCIQXLDev
+ {
+     dprint(d, 1, "%s:\n", __FUNCTION__);
+     d->mode = QXL_MODE_UNDEFINED;
+-    qemu_mutex_unlock_iothread();
++    qxl_unlock_iothread(&d->ssd);
+     d->ssd.worker->destroy_surfaces(d->ssd.worker);
+-    qemu_mutex_lock_iothread();
++    qxl_lock_iothread(&d->ssd);
+     memset(&d->guest_surfaces.cmds, 0, sizeof(d->guest_surfaces.cmds));
+ }
+@@ -866,9 +887,9 @@ static void qxl_destroy_primary(PCIQXLDe
+     dprint(d, 1, "%s\n", __FUNCTION__);
+     d->mode = QXL_MODE_UNDEFINED;
+-    qemu_mutex_unlock_iothread();
++    qxl_unlock_iothread(&d->ssd);
+     d->ssd.worker->destroy_primary_surface(d->ssd.worker, 0);
+-    qemu_mutex_lock_iothread();
++    qxl_lock_iothread(&d->ssd);
+ }
+ static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm)
+@@ -938,10 +959,10 @@ static void ioport_write(void *opaque, u
+     case QXL_IO_UPDATE_AREA:
+     {
+         QXLRect update = d->ram->update_area;
+-        qemu_mutex_unlock_iothread();
++        qxl_unlock_iothread(&d->ssd);
+         d->ssd.worker->update_area(d->ssd.worker, d->ram->update_surface,
+                                    &update, NULL, 0, 0);
+-        qemu_mutex_lock_iothread();
++        qxl_lock_iothread(&d->ssd);
+         break;
+     }
+     case QXL_IO_NOTIFY_CMD:
+Index: qemu-0.14.0/ui/spice-display.c
+===================================================================
+--- qemu-0.14.0.orig/ui/spice-display.c
++++ qemu-0.14.0/ui/spice-display.c
+@@ -186,18 +186,18 @@ void qemu_spice_create_host_primary(Simp
+     surface.mem        = (intptr_t)ssd->buf;
+     surface.group_id   = MEMSLOT_GROUP_HOST;
+-    qemu_mutex_unlock_iothread();
++    qxl_unlock_iothread(ssd);
+     ssd->worker->create_primary_surface(ssd->worker, 0, &surface);
+-    qemu_mutex_lock_iothread();
++    qxl_lock_iothread(ssd);
+ }
+ void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd)
+ {
+     dprint(1, "%s:\n", __FUNCTION__);
+-    qemu_mutex_unlock_iothread();
++    qxl_unlock_iothread(ssd);
+     ssd->worker->destroy_primary_surface(ssd->worker, 0);
+-    qemu_mutex_lock_iothread();
++    qxl_lock_iothread(ssd);
+ }
+ void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason)
+@@ -207,9 +207,9 @@ void qemu_spice_vm_change_state_handler(
+     if (running) {
+         ssd->worker->start(ssd->worker);
+     } else {
+-        qemu_mutex_unlock_iothread();
++        qxl_unlock_iothread(ssd);
+         ssd->worker->stop(ssd->worker);
+-        qemu_mutex_lock_iothread();
++        qxl_lock_iothread(ssd);
+     }
+     ssd->running = running;
+ }
+Index: qemu-0.14.0/ui/spice-display.h
+===================================================================
+--- qemu-0.14.0.orig/ui/spice-display.h
++++ qemu-0.14.0/ui/spice-display.h
+@@ -43,6 +43,9 @@ typedef struct SimpleSpiceDisplay {
+     QXLRect dirty;
+     int notify;
+     int running;
++
++    /* qemu-kvm locking ... */
++    void *env;
+ } SimpleSpiceDisplay;
+ typedef struct SimpleSpiceUpdate {
+@@ -52,6 +55,9 @@ typedef struct SimpleSpiceUpdate {
+     uint8_t *bitmap;
+ } SimpleSpiceUpdate;
++void qxl_unlock_iothread(SimpleSpiceDisplay *ssd);
++void qxl_lock_iothread(SimpleSpiceDisplay *ssd);
++
+ int qemu_spice_rect_is_empty(const QXLRect* r);
+ void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r);
index a74cfdf..2c12a06 100644 (file)
@@ -1,13 +1,15 @@
 LICENSE = "GPL"
 DEPENDS = "zlib ncurses gnutls"
-PR = "r0"
+PR = "r1"
 SRC_URI = "\
     http://download.savannah.gnu.org/releases/qemu/qemu-${PV}.tar.gz \
     file://leftover.patch \
     file://91-oh-sdl-cursor.patch \
     file://fix_baum_c_compilation.patch \
     file://fallback.to.safe.mmap_min_addr.patch \
-    file://parallel-build.patch \
+    file://spice-qxl-locking-fix-for-qemu-kvm.patch \
+    file://Detect-and-use-GCC-atomic-builtins-for-locking.patch \
+    file://larger_default_ram_size.patch \
     "
 SRC_URI[md5sum] = "f9d145d5c09de9f0984ffe9bd1229970"
 SRC_URI[sha256sum] = "ba21e84d7853217830e167dae9999cdbff481189c6a0bb600ac7fb7201453108"