[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

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

Thanks Mats. I added these few lines in qemu source (xen was too much for me - sorry), rebuild and serial.log produced by qemu is here: http://www.p-rom.si/serial.log
The last few lines before data download stops are:

RX: 6f
RX: 6e
RX: 36
RX: 20
RX: 20
RX: 20
RX: 20

It looks that the communication stops because there is no data from serial device?


Xen-users mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.