[Top][All Lists]

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

Re: [Qemu-devel] [PATCH] chardev: add baud parameter for serial host dev

From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH] chardev: add baud parameter for serial host device
Date: Mon, 10 Jun 2013 15:23:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

Am 10.06.2013 14:58, schrieb Gerd Hoffmann:
> On 06/10/13 10:42, Peter Wu wrote:
>> On Monday 10 June 2013 07:56:01 Gerd Hoffmann wrote:
>>> On 06/08/13 23:49, Peter Wu wrote:
>>>> When QEMU starts, it always changes the serial port parameters including
>>>> baud rate. This confused my guest which thought it was outputting at 9600
>>>> baud while it was in fact changed to 115200.
>>>> After this patch, I can use `-serial /dev/ttyS0,baud=9600` to override the
>>>> default baud rate of 115200.
>>> I think we should just flip the default to 9600.  IIRC this is the
>>> power-on default baud rate of the 8250 uart family, so this should be
>>> the qemu default too.  If a guest wants to use a higher baudrate it has
>>> to reprogram the uart anyway (and qemu will apply the guest changes to
>>> the host uart).
>> FWIW, when I tried MODE.COM in ms-dos to change the baud rate, `stty -F 
>> /dev/ttyS0 -a` still reported 115200 baud. This is on Linux 3.9 if that
>> matters.
> Hmm, with a linux guest changing the baudrate works just fine.  Any
> chance mode.com takes a shortcut in case it thinks the rate didn't
> change?  Does setting the speed first to 4800, then to 9600 work?
>> Besides this comment, any other feedback on the patch itself?
> Style is fine.  But it appears to paper over some bug, and I'd prefer to
> find+fix the bug instead of allowing/requiring the user to set the baud
> rate manually to the correct value.

Well, there's two instances of hardcoded 115200 baudrate: in the chardev
for the host and in the device for the guest - I don't see the latter
changed here:

hw/arm/nseries.c:    stw_raw(w ++, 115200);                     /* u32
console_speed */
hw/char/serial-isa.c:    s->baudbase = 115200;
hw/char/serial-pci.c:    s->baudbase = 115200;
hw/char/serial-pci.c:        s->baudbase = 115200;
hw/display/sm501.c:                       115200, chr,
hw/lm32/lm32_hwsetup.h:    hwsetup_add_u32(hw, 115200); /* baudrate */
hw/microblaze/petalogix_ml605_mmu.c:                   irq[5], 115200,
serial_hds[0], DEVICE_LITTLE_ENDIAN);
hw/mips/mips_mipssim.c:        serial_init(0x3f8, env->irq[4], 115200,
hw/openrisc/openrisc_sim.c:                   115200, serial_hds[0],
hw/ppc/ppc405_boards.c:        bd.bi_baudrate = 115200;
hw/ppc/virtex_ml507.c:    serial_mm_init(address_space_mem,
0x83e01003ULL, 2, irq[9], 115200,
hw/sparc64/sun4u.c:                       NULL, 115200, serial_hds[i],
hw/xtensa/xtensa_lx60.c:            115200, serial_hds[0],
qemu-char.c:        check_speed(115200);
qemu-char.c:#ifdef B1152000
qemu-char.c:        check_speed(1152000);
qemu-char.c:        spd = B115200;
qemu-char.c:    tty_serial_init(fd, 115200, 'N', 8, 1);
slirp/slirp.h:#define DEFAULT_BAUD 115200

(The slirp define seems unused.)

So yes, MS-DOS will get reported from hardware that it is at 115200,
whatever you set for the chardev on the host side with your changes.
Thought I pointed you to that fact on IRC already...


SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

reply via email to

[Prev in Thread] Current Thread [Next in Thread]