From 6438461c91585f9bb92bc5bd3905b0746e48dfd2 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 12 Dec 2016 21:01:54 -0500 Subject: [PATCH] Fix sending of data with -net socket (bz #1391497) Fix keyboard issues with -ui gtk + host wayland (bz #1401211) --- ...L_INTERRUPT_CLIENT_MONITORS_CONFIG-o.patch | 67 ++++++++++++----- ...of-data-with-net-socket-listen-backe.patch | 72 +++++++++++++++++++ ...ev-keymap-when-running-under-wayland.patch | 53 ++++++++++++++ qemu.spec | 11 ++- 4 files changed, 183 insertions(+), 20 deletions(-) create mode 100644 0016-net-fix-sending-of-data-with-net-socket-listen-backe.patch create mode 100644 0017-ui-use-evdev-keymap-when-running-under-wayland.patch diff --git a/0015-qxl-Only-emit-QXL_INTERRUPT_CLIENT_MONITORS_CONFIG-o.patch b/0015-qxl-Only-emit-QXL_INTERRUPT_CLIENT_MONITORS_CONFIG-o.patch index 874e14f..5855a66 100644 --- a/0015-qxl-Only-emit-QXL_INTERRUPT_CLIENT_MONITORS_CONFIG-o.patch +++ b/0015-qxl-Only-emit-QXL_INTERRUPT_CLIENT_MONITORS_CONFIG-o.patch @@ -1,5 +1,5 @@ From: Christophe Fergeau -Date: Fri, 14 Oct 2016 14:22:36 +0200 +Date: Fri, 28 Oct 2016 16:48:40 +0200 Subject: [PATCH] qxl: Only emit QXL_INTERRUPT_CLIENT_MONITORS_CONFIG on config changes @@ -23,29 +23,36 @@ This causes https://bugzilla.redhat.com/show_bug.cgi?id=1266484 This commit makes sure that we only emit QXL_INTERRUPT_CLIENT_MONITORS_CONFIG when there are actual configuration changes the guest should act on. + +Signed-off-by: Christophe Fergeau +Message-id: 20161028144840.18326-1-cfergeau@redhat.com +Signed-off-by: Gerd Hoffmann +(cherry picked from commit 6c7565028c272c4c6f2a83c3a90b044eeaf2804a) --- - hw/display/qxl.c | 20 +++++++++++++++++++- - 1 file changed, 19 insertions(+), 1 deletion(-) + hw/display/qxl.c | 37 ++++++++++++++++++++++++++++++++++++- + 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/hw/display/qxl.c b/hw/display/qxl.c -index 0e2682d..56759f8 100644 +index 0e2682d..62d0c80 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c -@@ -1000,6 +1000,7 @@ static int interface_client_monitors_config(QXLInstance *sin, - QXLRom *rom = memory_region_get_ram_ptr(&qxl->rom_bar); - int i; - unsigned max_outputs = ARRAY_SIZE(rom->client_monitors_config.heads); -+ bool config_changed = false; +@@ -992,6 +992,34 @@ static uint32_t qxl_crc32(const uint8_t *p, unsigned len) + return crc32(0xffffffff, p, len) ^ 0xffffffff; + } - if (qxl->revision < 4) { - trace_qxl_client_monitors_config_unsupported_by_device(qxl->id, -@@ -1030,6 +1031,21 @@ static int interface_client_monitors_config(QXLInstance *sin, - } - #endif - -+ if (rom->client_monitors_config.count != MIN(monitors_config->num_of_monitors, max_outputs)) { -+ config_changed = true; ++static bool qxl_rom_monitors_config_changed(QXLRom *rom, ++ VDAgentMonitorsConfig *monitors_config, ++ unsigned int max_outputs) ++{ ++ int i; ++ unsigned int monitors_count; ++ ++ monitors_count = MIN(monitors_config->num_of_monitors, max_outputs); ++ ++ if (rom->client_monitors_config.count != monitors_count) { ++ return true; + } ++ + for (i = 0 ; i < rom->client_monitors_config.count ; ++i) { + VDAgentMonConfig *monitor = &monitors_config->monitors[i]; + QXLURect *rect = &rom->client_monitors_config.heads[i]; @@ -54,14 +61,36 @@ index 0e2682d..56759f8 100644 + (rect->top != monitor->y) || + (rect->right != monitor->x + monitor->width) || + (rect->bottom != monitor->y + monitor->height)) { -+ config_changed = true; ++ return true; + } + } ++ ++ return false; ++} ++ + /* called from main context only */ + static int interface_client_monitors_config(QXLInstance *sin, + VDAgentMonitorsConfig *monitors_config) +@@ -1000,6 +1028,7 @@ static int interface_client_monitors_config(QXLInstance *sin, + QXLRom *rom = memory_region_get_ram_ptr(&qxl->rom_bar); + int i; + unsigned max_outputs = ARRAY_SIZE(rom->client_monitors_config.heads); ++ bool config_changed = false; + + if (qxl->revision < 4) { + trace_qxl_client_monitors_config_unsupported_by_device(qxl->id, +@@ -1030,6 +1059,10 @@ static int interface_client_monitors_config(QXLInstance *sin, + } + #endif + ++ config_changed = qxl_rom_monitors_config_changed(rom, ++ monitors_config, ++ max_outputs); + memset(&rom->client_monitors_config, 0, sizeof(rom->client_monitors_config)); rom->client_monitors_config.count = monitors_config->num_of_monitors; -@@ -1059,7 +1075,9 @@ static int interface_client_monitors_config(QXLInstance *sin, +@@ -1059,7 +1092,9 @@ static int interface_client_monitors_config(QXLInstance *sin, trace_qxl_interrupt_client_monitors_config(qxl->id, rom->client_monitors_config.count, rom->client_monitors_config.heads); diff --git a/0016-net-fix-sending-of-data-with-net-socket-listen-backe.patch b/0016-net-fix-sending-of-data-with-net-socket-listen-backe.patch new file mode 100644 index 0000000..3c8db7d --- /dev/null +++ b/0016-net-fix-sending-of-data-with-net-socket-listen-backe.patch @@ -0,0 +1,72 @@ +From: "Daniel P. Berrange" +Date: Fri, 4 Nov 2016 15:46:33 +0000 +Subject: [PATCH] net: fix sending of data with -net socket, listen backend + +The use of -net socket,listen was broken in the following +commit + + commit 16a3df403b10c4ac347159e39005fd520b2648bb + Author: Zhang Chen + Date: Fri May 13 15:35:19 2016 +0800 + + net/net: Add SocketReadState for reuse codes + + This function is from net/socket.c, move it to net.c and net.h. + Add SocketReadState to make others reuse net_fill_rstate(). + suggestion from jason. + +This refactored the state out of NetSocketState into a +separate SocketReadState. This refactoring requires +that a callback is provided to be triggered upon +completion of a packet receive from the guest. + +The patch only registered this callback in the codepaths +hit by -net socket,connect, not -net socket,listen. So +as a result packets sent by the guest in the latter case +get dropped on the floor. + +This bug is hidden because net_fill_rstate() silently +does nothing if the callback is not set. + +This patch adds in the middle callback registration +and also adds an assert so that QEMU aborts if there +are any other codepaths hit which are missing the +callback. + +Signed-off-by: Daniel P. Berrange +Reviewed-by: Zhang Chen +Signed-off-by: Jason Wang +(cherry picked from commit e79cd4068063ea2859199002a049010a11202939) +--- + net/net.c | 5 ++--- + net/socket.c | 1 + + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/net/net.c b/net/net.c +index d51cb29..19b4d9e 100644 +--- a/net/net.c ++++ b/net/net.c +@@ -1648,9 +1648,8 @@ int net_fill_rstate(SocketReadState *rs, const uint8_t *buf, int size) + if (rs->index >= rs->packet_len) { + rs->index = 0; + rs->state = 0; +- if (rs->finalize) { +- rs->finalize(rs); +- } ++ assert(rs->finalize); ++ rs->finalize(rs); + } + break; + } +diff --git a/net/socket.c b/net/socket.c +index 3f98eef..dcae1ae 100644 +--- a/net/socket.c ++++ b/net/socket.c +@@ -522,6 +522,7 @@ static int net_socket_listen_init(NetClientState *peer, + s->fd = -1; + s->listen_fd = fd; + s->nc.link_down = true; ++ net_socket_rs_init(&s->rs, net_socket_rs_finalize); + + qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s); + return 0; diff --git a/0017-ui-use-evdev-keymap-when-running-under-wayland.patch b/0017-ui-use-evdev-keymap-when-running-under-wayland.patch new file mode 100644 index 0000000..54a9907 --- /dev/null +++ b/0017-ui-use-evdev-keymap-when-running-under-wayland.patch @@ -0,0 +1,53 @@ +From: "Daniel P. Berrange" +Date: Thu, 1 Dec 2016 09:41:17 +0000 +Subject: [PATCH] ui: use evdev keymap when running under wayland + +Wayland always uses evdev as its input source, so QEMU +can use the existing evdev keymap data + +Signed-off-by: Daniel P. Berrange +--- + include/ui/gtk.h | 4 ++++ + ui/gtk.c | 7 +++++++ + 2 files changed, 11 insertions(+) + +diff --git a/include/ui/gtk.h b/include/ui/gtk.h +index 42ca0fe..b3b5005 100644 +--- a/include/ui/gtk.h ++++ b/include/ui/gtk.h +@@ -18,6 +18,10 @@ + #include + #endif + ++#ifdef GDK_WINDOWING_WAYLAND ++#include ++#endif ++ + #if defined(CONFIG_OPENGL) + #include "ui/egl-helpers.h" + #include "ui/egl-context.h" +diff --git a/ui/gtk.c b/ui/gtk.c +index 58d20ee..e8cf785 100644 +--- a/ui/gtk.c ++++ b/ui/gtk.c +@@ -90,6 +90,9 @@ + #ifndef GDK_IS_X11_DISPLAY + #define GDK_IS_X11_DISPLAY(dpy) (dpy == dpy) + #endif ++#ifndef GDK_IS_WAYLAND_DISPLAY ++#define GDK_IS_WAYLAND_DISPLAY(dpy) (dpy == dpy) ++#endif + #ifndef GDK_IS_WIN32_DISPLAY + #define GDK_IS_WIN32_DISPLAY(dpy) (dpy == dpy) + #endif +@@ -1034,6 +1037,10 @@ static int gd_map_keycode(GtkDisplayState *s, GdkDisplay *dpy, int gdk_keycode) + qemu_keycode = translate_xfree86_keycode(gdk_keycode - 97); + } + #endif ++#ifdef GDK_WINDOWING_WAYLAND ++ } else if (GDK_IS_WAYLAND_DISPLAY(dpy) && gdk_keycode < 158) { ++ qemu_keycode = translate_evdev_keycode(gdk_keycode - 97); ++#endif + } else if (gdk_keycode == 208) { /* Hiragana_Katakana */ + qemu_keycode = 0x70; + } else if (gdk_keycode == 211) { /* backslash */ diff --git a/qemu.spec b/qemu.spec index 6e8cf85..a47817f 100644 --- a/qemu.spec +++ b/qemu.spec @@ -68,7 +68,7 @@ Summary: QEMU is a FAST! processor emulator Name: qemu Version: 2.7.0 -Release: 7%{?rcrel}%{?dist} +Release: 8%{?rcrel}%{?dist} Epoch: 2 License: GPLv2+ and LGPLv2+ and BSD Group: Development/Tools @@ -133,6 +133,11 @@ Patch0013: 0013-usb-redir-allocate-buffers-before-waking-up-the-host.patch Patch0014: 0014-ppc-kvm-Mark-64kB-page-size-support-as-disabled-if-n.patch # Fix flickering display with boxes + wayland VM (bz #1266484) Patch0015: 0015-qxl-Only-emit-QXL_INTERRUPT_CLIENT_MONITORS_CONFIG-o.patch +# Fix sending of data with -net socket (bz #1391497) +Patch0016: 0016-net-fix-sending-of-data-with-net-socket-listen-backe.patch +# Fix keyboard issues with -ui gtk + host wayland (bz #1401211) +# Posted but not yet applied upstream +Patch0017: 0017-ui-use-evdev-keymap-when-running-under-wayland.patch # documentation deps BuildRequires: texi2html @@ -1604,6 +1609,10 @@ getent passwd qemu >/dev/null || \ %changelog +* Mon Dec 12 2016 Cole Robinson - 2:2.7.0-8 +- Fix sending of data with -net socket (bz #1391497) +- Fix keyboard issues with -ui gtk + host wayland (bz #1401211) + * Tue Oct 25 2016 Cole Robinson - 2:2.7.0-7 - Fix PPC64 build with memlock file (bz #1387601)