From 35d9baa7416a03615e12d9dacc68446c9c555b40 Mon Sep 17 00:00:00 2001 From: gson Date: Fri, 11 Jul 2014 19:15:08 +0000 Subject: Fix qemu bug 1335444 aka PR pkg/48071. Patches from Kirill Batuzov, with minor changes to make them apply to 2.0.0. Bump PKGREVISION. --- emulators/qemu/Makefile | 4 +- emulators/qemu/distinfo | 4 +- emulators/qemu/patches/patch-hw_char_serial.c | 86 +++++++++++++++++++++++++++ emulators/qemu/patches/patch-qemu-char.c | 29 +++++++++ 4 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 emulators/qemu/patches/patch-hw_char_serial.c create mode 100644 emulators/qemu/patches/patch-qemu-char.c (limited to 'emulators') diff --git a/emulators/qemu/Makefile b/emulators/qemu/Makefile index 2685bb048f9..5b13dda125e 100644 --- a/emulators/qemu/Makefile +++ b/emulators/qemu/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.129 2014/05/29 23:36:33 wiz Exp $ +# $NetBSD: Makefile,v 1.130 2014/07/11 19:15:08 gson Exp $ DISTNAME= qemu-2.0.0 -PKGREVISION= 3 +PKGREVISION= 4 CATEGORIES= emulators MASTER_SITES= http://wiki.qemu.org/download/ EXTRACT_SUFX= .tar.bz2 diff --git a/emulators/qemu/distinfo b/emulators/qemu/distinfo index 3968d873e12..e1eedc9024f 100644 --- a/emulators/qemu/distinfo +++ b/emulators/qemu/distinfo @@ -1,10 +1,11 @@ -$NetBSD: distinfo,v 1.95 2014/05/15 12:28:13 wiz Exp $ +$NetBSD: distinfo,v 1.96 2014/07/11 19:15:08 gson Exp $ SHA1 (qemu-2.0.0.tar.bz2) = cc24a60a93ba697057a67b6a7224b95627eaf1a6 RMD160 (qemu-2.0.0.tar.bz2) = ecd05e036431c14930ae2455a032495dd7ebaf85 Size (qemu-2.0.0.tar.bz2) = 12839647 bytes SHA1 (patch-ef) = 6e57de87f91067e8a9a1388c91133a31b3582b3a SHA1 (patch-et) = 036e1a254ce40df635dfb6107d2707879467e127 +SHA1 (patch-hw_char_serial.c) = fb6b12afc98bbcc9fa5d6cc5d43de3b28be08d88 SHA1 (patch-hw_display_omap__dss.c) = 6b13242f28e32346bc70548c216c578d98fd3420 SHA1 (patch-hw_net_etraxfs__eth.c) = e5dd1661d60dbcd27b332403e0843500ba9544bc SHA1 (patch-hw_net_xilinx__axienet.c) = ebcd2676d64ce6f31e4a8c976d4fdf530ad5e8b7 @@ -12,6 +13,7 @@ SHA1 (patch-hw_ppc_mac__newworld.c) = 9a0ec3ba0b6da2879fdaba6a7937fb16a02685f5 SHA1 (patch-hw_ppc_mac__oldworld.c) = 46322c77c87be6d517c43466325c344db99cd463 SHA1 (patch-hw_virtio_virtio.c) = 9aa4553a4eda81fb014b116c2207ec4b59265fca SHA1 (patch-memory.c) = 14df9c835ca318fc79a8d3a46bb94d2f229277cc +SHA1 (patch-qemu-char.c) = 8567c5d763cab574a888bb00d150bc5e94facbd7 SHA1 (patch-slirp_tcp__subr.c) = cfc8289384fa987289e32b64532c13a83a890820 SHA1 (patch-user-exec.c) = eb83832c7c9e5f69313f8cad2c2f77b304072556 SHA1 (patch-util_hbitmap.c) = 7ca62f7f7a82526007d034dfe7d5e2d4ff96f900 diff --git a/emulators/qemu/patches/patch-hw_char_serial.c b/emulators/qemu/patches/patch-hw_char_serial.c new file mode 100644 index 00000000000..f268a0b9525 --- /dev/null +++ b/emulators/qemu/patches/patch-hw_char_serial.c @@ -0,0 +1,86 @@ +$NetBSD: patch-hw_char_serial.c,v 1.1 2014/07/11 19:15:08 gson Exp $ + +Part of fix for qemu bug 1335444, aka PR 48071. From Kirill Batuzov, +backported to 2.0 by gson. + +--- hw/char/serial.c.orig 2014-04-17 13:44:44.000000000 +0000 ++++ hw/char/serial.c +@@ -223,37 +223,42 @@ static gboolean serial_xmit(GIOChannel * + { + SerialState *s = opaque; + +- if (s->tsr_retry <= 0) { +- if (s->fcr & UART_FCR_FE) { +- if (fifo8_is_empty(&s->xmit_fifo)) { ++ do { ++ if (s->tsr_retry <= 0) { ++ if (s->fcr & UART_FCR_FE) { ++ if (fifo8_is_empty(&s->xmit_fifo)) { ++ return FALSE; ++ } ++ s->tsr = fifo8_pop(&s->xmit_fifo); ++ if (!s->xmit_fifo.num) { ++ s->lsr |= UART_LSR_THRE; ++ } ++ } else if ((s->lsr & UART_LSR_THRE)) { + return FALSE; +- } +- s->tsr = fifo8_pop(&s->xmit_fifo); +- if (!s->xmit_fifo.num) { ++ } else { ++ s->tsr = s->thr; + s->lsr |= UART_LSR_THRE; ++ s->lsr &= ~UART_LSR_TEMT; + } +- } else if ((s->lsr & UART_LSR_THRE)) { +- return FALSE; +- } else { +- s->tsr = s->thr; +- s->lsr |= UART_LSR_THRE; +- s->lsr &= ~UART_LSR_TEMT; + } +- } + +- if (s->mcr & UART_MCR_LOOP) { +- /* in loopback mode, say that we just received a char */ +- serial_receive1(s, &s->tsr, 1); +- } else if (qemu_chr_fe_write(s->chr, &s->tsr, 1) != 1) { +- if (s->tsr_retry >= 0 && s->tsr_retry < MAX_XMIT_RETRY && +- qemu_chr_fe_add_watch(s->chr, G_IO_OUT, serial_xmit, s) > 0) { +- s->tsr_retry++; +- return FALSE; ++ if (s->mcr & UART_MCR_LOOP) { ++ /* in loopback mode, say that we just received a char */ ++ serial_receive1(s, &s->tsr, 1); ++ } else if (qemu_chr_fe_write(s->chr, &s->tsr, 1) != 1) { ++ if (s->tsr_retry >= 0 && s->tsr_retry < MAX_XMIT_RETRY && ++ qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP, ++ serial_xmit, s) > 0) { ++ s->tsr_retry++; ++ return FALSE; ++ } ++ s->tsr_retry = 0; ++ } else { ++ s->tsr_retry = 0; + } +- s->tsr_retry = 0; +- } else { +- s->tsr_retry = 0; +- } ++ /* Transmit another byte if it is already available. It is only ++ possible when FIFO is enabled and not empty. */ ++ } while ((s->fcr & UART_FCR_FE) && !fifo8_is_empty(&s->xmit_fifo)); + + s->last_xmit_ts = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + +@@ -293,7 +298,9 @@ static void serial_ioport_write(void *op + s->thr_ipending = 0; + s->lsr &= ~UART_LSR_THRE; + serial_update_irq(s); +- serial_xmit(NULL, G_IO_OUT, s); ++ if (s->tsr_retry <= 0) { ++ serial_xmit(NULL, G_IO_OUT, s); ++ } + } + break; + case 1: diff --git a/emulators/qemu/patches/patch-qemu-char.c b/emulators/qemu/patches/patch-qemu-char.c new file mode 100644 index 00000000000..67d4f903063 --- /dev/null +++ b/emulators/qemu/patches/patch-qemu-char.c @@ -0,0 +1,29 @@ +$NetBSD: patch-qemu-char.c,v 1.1 2014/07/11 19:15:08 gson Exp $ + +Part of fix for qemu bug 1335444, aka PR 48071. From Kirill Batuzov. + +--- qemu-char.c.orig 2014-04-17 13:44:45.000000000 +0000 ++++ qemu-char.c +@@ -519,6 +519,12 @@ static Notifier muxes_realize_notify = { + .notify = muxes_realize_done, + }; + ++static GSource *mux_chr_add_watch(CharDriverState *s, GIOCondition cond) ++{ ++ MuxDriver *d = s->opaque; ++ return d->drv->chr_add_watch(d->drv, cond); ++} ++ + static CharDriverState *qemu_chr_open_mux(CharDriverState *drv) + { + CharDriverState *chr; +@@ -535,6 +541,9 @@ static CharDriverState *qemu_chr_open_mu + chr->chr_accept_input = mux_chr_accept_input; + /* Frontend guest-open / -close notification is not support with muxes */ + chr->chr_set_fe_open = NULL; ++ if (drv->chr_add_watch) { ++ chr->chr_add_watch = mux_chr_add_watch; ++ } + /* only default to opened state if we've realized the initial + * set of muxes + */ -- cgit v1.2.3