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/
Home Products Support Community News


Re: [Xen-users] Is Xen and Qemu serial driver code related ?

To: "Petersson, Mats" <Mats.Petersson@xxxxxxx>, xen-users@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-users] Is Xen and Qemu serial driver code related ?
From: Aleš Rom <ales.rom@xxxxxxxxxxxx>
Date: Thu, 08 Feb 2007 15:32:34 +0100
Delivery-date: Thu, 08 Feb 2007 06:32:37 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <907625E08839C4409CE5768403633E0B018E1958@xxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <907625E08839C4409CE5768403633E0B018E1958@xxxxxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird (X11/20061219)
Petersson, Mats pravi:
-----Original Message-----
From: xen-users-bounces@xxxxxxxxxxxxxxxxxxx [mailto:xen-users-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Aleš Rom
Sent: 08 February 2007 12:55
To: xen-users@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-users] Is Xen and Qemu serial driver code related ?


A noticed a very strange thing. A few weeks ago I installed WindowsXP under qemu. I have serial device attached to COM1 port and comunication works. Basicaly I have to download a few hundred bytes from that serial device to computer. Every time comunication stops at 83% (5/6).

The weird thing is, that when I use Xen, I can see exactly same thing. Stops at 83%. Is this related or just coincidence? Is it my hardware? Windows on "real" hardware doesn't have this problem.

Sounds like it could be the same problem - Xen in HVM mode uses QEMU (a slightly modified source that builds the binary called qemu-dm, which lives in /usr/lib{64}/xen/bin or some such) to emulate the hardware in the guest. Serial port(s) is part of this emulated hardware.
However, it could be "just about anything". If it's caused by the software, it would probably help to "log" the serial comms 
somehow (I've successfully written code to take two serial ports on a machine and "copy" the data from one port to the other, making it a 
"logging station", but there may be other ways to do it, for example let qemu dump the serial port data onto a file - probably requires a 
little bit of hacking in qemu, but not terribly hard work, if you know a bit about programming). A good place to start this would be in 
".../tools/ioemu/hw/serial.c" - the functons serial_ioport_write() and serial_ioport_read(), particularly "addr 0", which is the 
"data" address. Here's what I would add:
New variable around the beginning of serial.c (after the #include statements):
FILE *serial_log;
In serial_init() add:
   serial_log = fopen("/tmp/serial.log", "w");
if (serial_log == NULL) { fprintf(logfile, "Failed to open /tmp/serial.log"); exit(1); }

In serial_ioport_write():
At "case 0", just before the "break" add:
   fprintf(serial_log, "TX: %02x\n", val);

In serial_ioport_read():
At "case 0", just before the "break" add:
   fprintf(serial_log, "RX: %02x\n", ret);



Xen-users mailing list

Thanks for your help. I'm running Xen on FC6, and xen was installed from rpm package. If I understand correctly I have to install xen source, modify serial.c, rebuild xen (hopefully just qemu-dm) and run serial connection again. I'm NOT a programmer, but with a little help can do that. :)
I'm really interested to debug this issue.


Xen-users mailing list