qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [6700] char: Fix initial reset (Jan Kiszka)
@ 2009-03-05 22:59 Anthony Liguori
  0 siblings, 0 replies; only message in thread
From: Anthony Liguori @ 2009-03-05 22:59 UTC (permalink / raw)
  To: qemu-devel

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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-05 23:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-05 22:59 [Qemu-devel] [6700] char: Fix initial reset (Jan Kiszka) Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).