From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um24t-0003eH-O0 for qemu-devel@nongnu.org; Mon, 10 Jun 2013 09:24:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Um24m-0005Hk-Tr for qemu-devel@nongnu.org; Mon, 10 Jun 2013 09:24:07 -0400 Received: from cantor2.suse.de ([195.135.220.15]:48149 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um24m-0005HD-Je for qemu-devel@nongnu.org; Mon, 10 Jun 2013 09:24:00 -0400 Message-ID: <51B5D367.1020000@suse.de> Date: Mon, 10 Jun 2013 15:23:51 +0200 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <4543955.Y102znvq4W@al> <51B56A71.406@redhat.com> <1840622.xrNe1LmldJ@al> <51B5CD5F.5090602@redhat.com> In-Reply-To: <51B5CD5F.5090602@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] chardev: add baud parameter for serial host device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann , Peter Wu Cc: Anthony Liguori , qemu-devel@nongnu.org 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 inclu= ding >>>> 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=3D9600` to over= ride 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 h= as >>> to reprogram the uart anyway (and qemu will apply the guest changes t= o >>> the host uart). >> >> FWIW, when I tried MODE.COM in ms-dos to change the baud rate, `stty -= F=20 >> /dev/ttyS0 -a` still reported 115200 baud. This is on Linux 3.9 if tha= t >> matters. >=20 > 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? >=20 >> Besides this comment, any other feedback on the patch itself? >=20 > Style is fine. But it appears to paper over some bug, and I'd prefer t= o > 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 =3D 115200; hw/char/serial-pci.c: s->baudbase =3D 115200; hw/char/serial-pci.c: s->baudbase =3D 115200; hw/display/sm501.c: 115200, chr, DEVICE_NATIVE_ENDIAN); 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, serial_hds[0], hw/openrisc/openrisc_sim.c: 115200, serial_hds[0], DEVICE_NATIVE_ENDIAN); hw/ppc/ppc405_boards.c: bd.bi_baudrate =3D 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], DEVICE_BIG_ENDIAN); hw/xtensa/xtensa_lx60.c: 115200, serial_hds[0], DEVICE_NATIVE_ENDIAN); qemu-char.c: check_speed(115200); qemu-char.c:#ifdef B1152000 qemu-char.c: check_speed(1152000); qemu-char.c: spd =3D 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... Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg