WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] [PATCH] Qemu serial patch

To: "Yang, Xiaowei" <xiaowei.yang@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-devel] [PATCH] Qemu serial patch
From: "Ian Pratt" <m+Ian.Pratt@xxxxxxxxxxxx>
Date: Sun, 24 Sep 2006 23:13:51 +0100
Cc: Chris Carr <Chris.Carr@xxxxxxxxxxxxx>, "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
Delivery-date: Sun, 24 Sep 2006 15:14:41 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E42673822206994F8293A048721B91A5061489@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcbcjNMapVSa1WgARTaJFcfhrmJz1QDmMrcw
Thread-topic: [Xen-devel] [PATCH] Qemu serial patch
> Original Qemu serial.c uses non-waiting write. If it's bound to a
> physical serial port, there are chances that write need to wait for a
> while. In this occasion, the characters are lost. This patch adds an
up
> to 100ms wait for write. In addition, it turns off output processing.

Xiaowei,
Thanks for investigating this. A couple of questions:

diff -r 041be3f6b38e tools/ioemu/hw/serial.c
--- a/tools/ioemu/hw/serial.c   Tue Sep 19 13:26:47 2006
+++ b/tools/ioemu/hw/serial.c   Tue Sep 19 15:47:11 2006
@@ -160,7 +160,8 @@
             s->lsr &= ~UART_LSR_THRE;
             serial_update_irq(s);
             ch = val;
-            qemu_chr_write(s->chr, &ch, 1);
+            if (qemu_chr_write(s->chr, &ch, 1) == -1)
+                fprintf(logfile, "serial write error\n");
             s->thr_ipending = 1;
             s->lsr |= UART_LSR_THRE;
             s->lsr |= UART_LSR_TEMT;

Doesn't the above mean we still drop the character? Shouldn't we be
storing the character somewhere and retrying it later? We should
probably also clear the tx ready bit (bit 5) in the UART's Line Status
Register. We should then retry the write in ~100ms, and set the tx ready
bit again.


diff -r 041be3f6b38e tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Tue Sep 19 13:26:47 2006
+++ b/tools/ioemu/vl.c  Tue Sep 19 15:47:11 2006
@@ -1191,7 +1191,7 @@
         FD_ZERO(&writefds);
         FD_SET(fd, &writefds);
         timeout.tv_sec = 0;
-        timeout.tv_usec = 0;
+        timeout.tv_usec = 100000;
         sel_ret = select(max_fd + 1, NULL, &writefds, 0, &timeout);
         if (sel_ret <= 0) {
             /* Timeout or select error */
@@ -1674,7 +1674,8 @@
 
     tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
                           |INLCR|IGNCR|ICRNL|IXON);
-    tty.c_oflag |= OPOST;
+    tty.c_oflag &= ~OPOST;
+    
     tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG);
     tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS);
     switch(data_bits) {

What does this part of the patch do? I don't know my tcsetattrs very
well.

Thanks,
Ian


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>