Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LfMXq-0007gn-GZ for qemu-devel@nongnu.org; Thu, 05 Mar 2009 18:00:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LfMXo-0007fM-Rc for qemu-devel@nongnu.org; Thu, 05 Mar 2009 18:00:02 -0500 Received: from [199.232.76.173] (port=43390 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LfMXo-0007fF-MT for qemu-devel@nongnu.org; Thu, 05 Mar 2009 18:00:00 -0500 Received: from savannah.gnu.org ([199.232.41.3]:59744 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 1LfMXo-0005TV-9p for qemu-devel@nongnu.org; Thu, 05 Mar 2009 18:00:00 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1LfMXn-0000AV-Ow for qemu-devel@nongnu.org; Thu, 05 Mar 2009 22:59:59 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1LfMXn-0000A2-DK for qemu-devel@nongnu.org; Thu, 05 Mar 2009 22:59:59 +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 22:59:59 +0000 Subject: [Qemu-devel] [6700] 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: 6700 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6700 Author: aliguori Date: 2009-03-05 22:59:58 +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: -------------- trunk/qemu-char.c trunk/qemu-char.h trunk/vl.c Modified: trunk/qemu-char.c =================================================================== --- trunk/qemu-char.c 2009-03-05 19:42:40 UTC (rev 6699) +++ trunk/qemu-char.c 2009-03-05 22:59:58 UTC (rev 6700) @@ -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: trunk/qemu-char.h =================================================================== --- trunk/qemu-char.h 2009-03-05 19:42:40 UTC (rev 6699) +++ trunk/qemu-char.h 2009-03-05 22:59:58 UTC (rev 6700) @@ -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: trunk/vl.c =================================================================== --- trunk/vl.c 2009-03-05 19:42:40 UTC (rev 6699) +++ trunk/vl.c 2009-03-05 22:59:58 UTC (rev 6700) @@ -5693,6 +5693,7 @@ } text_consoles_set_display(display_state); + qemu_chr_initial_reset(); if (monitor_device && monitor_hd) monitor_init(monitor_hd, !nographic);