From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LfJSQ-0002KE-Or for qemu-devel@nongnu.org; Thu, 05 Mar 2009 14:42:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LfJSP-0002JL-D2 for qemu-devel@nongnu.org; Thu, 05 Mar 2009 14:42:13 -0500 Received: from [199.232.76.173] (port=48539 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LfJSP-0002J7-3m for qemu-devel@nongnu.org; Thu, 05 Mar 2009 14:42:13 -0500 Received: from savannah.gnu.org ([199.232.41.3]:38603 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LfJSO-0003hl-EW for qemu-devel@nongnu.org; Thu, 05 Mar 2009 14:42:12 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1LfJSG-0002TP-R2 for qemu-devel@nongnu.org; Thu, 05 Mar 2009 19:42:04 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1LfJSG-0002TL-H5 for qemu-devel@nongnu.org; Thu, 05 Mar 2009 19:42:04 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Thu, 05 Mar 2009 19:42:04 +0000 Subject: [Qemu-devel] [6692] char: Fix initial reset (Jan Kiszka) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6692 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6692 Author: aliguori Date: 2009-03-05 19:42:04 +0000 (Thu, 05 Mar 2009) Log Message: ----------- char: Fix initial reset (Jan Kiszka) Recent changes to the graphical console initialization broke the initial CHR_EVENT_RESET distribution. The reset BHs generated on char device initialization are now already consumed during machine init (ide init ... -> qemu_aio_wait -> qemu_bh_poll). Therefore, this patch moves the initial qemu_chr_reset calls into a separate funtion which is called after machine init. Signed-off-by: Jan Kiszka Signed-off-by: Anthony Liguori Modified Paths: -------------- branches/stable_0_10_0/qemu-char.c branches/stable_0_10_0/qemu-char.h branches/stable_0_10_0/vl.c Modified: branches/stable_0_10_0/qemu-char.c =================================================================== --- branches/stable_0_10_0/qemu-char.c 2009-03-05 19:01:53 UTC (rev 6691) +++ branches/stable_0_10_0/qemu-char.c 2009-03-05 19:42:04 UTC (rev 6692) @@ -101,6 +101,10 @@ /***********************************************************/ /* character device */ +static TAILQ_HEAD(CharDriverStateHead, CharDriverState) chardevs = + TAILQ_HEAD_INITIALIZER(chardevs); +static int initial_reset_issued; + static void qemu_chr_event(CharDriverState *s, int event) { if (!s->chr_event) @@ -118,12 +122,23 @@ void qemu_chr_reset(CharDriverState *s) { - if (s->bh == NULL) { + if (s->bh == NULL && initial_reset_issued) { s->bh = qemu_bh_new(qemu_chr_reset_bh, s); qemu_bh_schedule(s->bh); } } +void qemu_chr_initial_reset(void) +{ + CharDriverState *chr; + + initial_reset_issued = 1; + + TAILQ_FOREACH(chr, &chardevs, next) { + qemu_chr_reset(chr); + } +} + int qemu_chr_write(CharDriverState *s, const uint8_t *buf, int len) { return s->chr_write(s, buf, len); @@ -2076,9 +2091,6 @@ return NULL; } -static TAILQ_HEAD(CharDriverStateHead, CharDriverState) chardevs -= TAILQ_HEAD_INITIALIZER(chardevs); - CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s)) { const char *p; Modified: branches/stable_0_10_0/qemu-char.h =================================================================== --- branches/stable_0_10_0/qemu-char.h 2009-03-05 19:01:53 UTC (rev 6691) +++ branches/stable_0_10_0/qemu-char.h 2009-03-05 19:42:04 UTC (rev 6692) @@ -74,6 +74,7 @@ void *opaque); int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg); void qemu_chr_reset(CharDriverState *s); +void qemu_chr_initial_reset(void); int qemu_chr_can_read(CharDriverState *s); void qemu_chr_read(CharDriverState *s, uint8_t *buf, int len); void qemu_chr_accept_input(CharDriverState *s); Modified: branches/stable_0_10_0/vl.c =================================================================== --- branches/stable_0_10_0/vl.c 2009-03-05 19:01:53 UTC (rev 6691) +++ branches/stable_0_10_0/vl.c 2009-03-05 19:42:04 UTC (rev 6692) @@ -5693,6 +5693,7 @@ } text_consoles_set_display(display_state); + qemu_chr_initial_reset(); if (monitor_device && monitor_hd) monitor_init(monitor_hd, !nographic);