summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu/qemu-0.14.0/spice-qxl-locking-fix-for-qemu-kvm.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu-0.14.0/spice-qxl-locking-fix-for-qemu-kvm.patch')
-rw-r--r--meta/recipes-devtools/qemu/qemu-0.14.0/spice-qxl-locking-fix-for-qemu-kvm.patch150
1 files changed, 150 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu-0.14.0/spice-qxl-locking-fix-for-qemu-kvm.patch b/meta/recipes-devtools/qemu/qemu-0.14.0/spice-qxl-locking-fix-for-qemu-kvm.patch
new file mode 100644
index 0000000000..87d5927850
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu-0.14.0/spice-qxl-locking-fix-for-qemu-kvm.patch
@@ -0,0 +1,150 @@
1Description: spice/qxl: locking fix for qemu-kvm
2Author: Gerd Hoffmann <kraxel@redhat.com>
3Source: upstream, http://patchwork.ozlabs.org/patch/84704/
4Forwarding: not-needed
5
6Index: qemu-0.14.0/hw/qxl.c
7===================================================================
8--- qemu-0.14.0.orig/hw/qxl.c
9+++ qemu-0.14.0/hw/qxl.c
10@@ -125,6 +125,27 @@ static void qxl_reset_memslots(PCIQXLDev
11 static void qxl_reset_surfaces(PCIQXLDevice *d);
12 static void qxl_ring_set_dirty(PCIQXLDevice *qxl);
13
14+/* qemu-kvm locking ... */
15+void qxl_unlock_iothread(SimpleSpiceDisplay *ssd)
16+{
17+ if (cpu_single_env) {
18+ assert(ssd->env == NULL);
19+ ssd->env = cpu_single_env;
20+ cpu_single_env = NULL;
21+ }
22+ qemu_mutex_unlock_iothread();
23+}
24+
25+void qxl_lock_iothread(SimpleSpiceDisplay *ssd)
26+{
27+ qemu_mutex_lock_iothread();
28+ if (ssd->env) {
29+ assert(cpu_single_env == NULL);
30+ cpu_single_env = ssd->env;
31+ ssd->env = NULL;
32+ }
33+}
34+
35 static inline uint32_t msb_mask(uint32_t val)
36 {
37 uint32_t mask;
38@@ -662,10 +683,10 @@ static void qxl_hard_reset(PCIQXLDevice
39 dprint(d, 1, "%s: start%s\n", __FUNCTION__,
40 loadvm ? " (loadvm)" : "");
41
42- qemu_mutex_unlock_iothread();
43+ qxl_unlock_iothread(&d->ssd);
44 d->ssd.worker->reset_cursor(d->ssd.worker);
45 d->ssd.worker->reset_image_cache(d->ssd.worker);
46- qemu_mutex_lock_iothread();
47+ qxl_lock_iothread(&d->ssd);
48 qxl_reset_surfaces(d);
49 qxl_reset_memslots(d);
50
51@@ -795,9 +816,9 @@ static void qxl_reset_surfaces(PCIQXLDev
52 {
53 dprint(d, 1, "%s:\n", __FUNCTION__);
54 d->mode = QXL_MODE_UNDEFINED;
55- qemu_mutex_unlock_iothread();
56+ qxl_unlock_iothread(&d->ssd);
57 d->ssd.worker->destroy_surfaces(d->ssd.worker);
58- qemu_mutex_lock_iothread();
59+ qxl_lock_iothread(&d->ssd);
60 memset(&d->guest_surfaces.cmds, 0, sizeof(d->guest_surfaces.cmds));
61 }
62
63@@ -866,9 +887,9 @@ static void qxl_destroy_primary(PCIQXLDe
64 dprint(d, 1, "%s\n", __FUNCTION__);
65
66 d->mode = QXL_MODE_UNDEFINED;
67- qemu_mutex_unlock_iothread();
68+ qxl_unlock_iothread(&d->ssd);
69 d->ssd.worker->destroy_primary_surface(d->ssd.worker, 0);
70- qemu_mutex_lock_iothread();
71+ qxl_lock_iothread(&d->ssd);
72 }
73
74 static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm)
75@@ -938,10 +959,10 @@ static void ioport_write(void *opaque, u
76 case QXL_IO_UPDATE_AREA:
77 {
78 QXLRect update = d->ram->update_area;
79- qemu_mutex_unlock_iothread();
80+ qxl_unlock_iothread(&d->ssd);
81 d->ssd.worker->update_area(d->ssd.worker, d->ram->update_surface,
82 &update, NULL, 0, 0);
83- qemu_mutex_lock_iothread();
84+ qxl_lock_iothread(&d->ssd);
85 break;
86 }
87 case QXL_IO_NOTIFY_CMD:
88Index: qemu-0.14.0/ui/spice-display.c
89===================================================================
90--- qemu-0.14.0.orig/ui/spice-display.c
91+++ qemu-0.14.0/ui/spice-display.c
92@@ -186,18 +186,18 @@ void qemu_spice_create_host_primary(Simp
93 surface.mem = (intptr_t)ssd->buf;
94 surface.group_id = MEMSLOT_GROUP_HOST;
95
96- qemu_mutex_unlock_iothread();
97+ qxl_unlock_iothread(ssd);
98 ssd->worker->create_primary_surface(ssd->worker, 0, &surface);
99- qemu_mutex_lock_iothread();
100+ qxl_lock_iothread(ssd);
101 }
102
103 void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd)
104 {
105 dprint(1, "%s:\n", __FUNCTION__);
106
107- qemu_mutex_unlock_iothread();
108+ qxl_unlock_iothread(ssd);
109 ssd->worker->destroy_primary_surface(ssd->worker, 0);
110- qemu_mutex_lock_iothread();
111+ qxl_lock_iothread(ssd);
112 }
113
114 void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason)
115@@ -207,9 +207,9 @@ void qemu_spice_vm_change_state_handler(
116 if (running) {
117 ssd->worker->start(ssd->worker);
118 } else {
119- qemu_mutex_unlock_iothread();
120+ qxl_unlock_iothread(ssd);
121 ssd->worker->stop(ssd->worker);
122- qemu_mutex_lock_iothread();
123+ qxl_lock_iothread(ssd);
124 }
125 ssd->running = running;
126 }
127Index: qemu-0.14.0/ui/spice-display.h
128===================================================================
129--- qemu-0.14.0.orig/ui/spice-display.h
130+++ qemu-0.14.0/ui/spice-display.h
131@@ -43,6 +43,9 @@ typedef struct SimpleSpiceDisplay {
132 QXLRect dirty;
133 int notify;
134 int running;
135+
136+ /* qemu-kvm locking ... */
137+ void *env;
138 } SimpleSpiceDisplay;
139
140 typedef struct SimpleSpiceUpdate {
141@@ -52,6 +55,9 @@ typedef struct SimpleSpiceUpdate {
142 uint8_t *bitmap;
143 } SimpleSpiceUpdate;
144
145+void qxl_unlock_iothread(SimpleSpiceDisplay *ssd);
146+void qxl_lock_iothread(SimpleSpiceDisplay *ssd);
147+
148 int qemu_spice_rect_is_empty(const QXLRect* r);
149 void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r);
150