From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3lvO-0005XE-Gg for qemu-devel@nongnu.org; Fri, 20 May 2016 11:01:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3lvJ-0000m8-FG for qemu-devel@nongnu.org; Fri, 20 May 2016 11:01:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3lvJ-0000lq-9c for qemu-devel@nongnu.org; Fri, 20 May 2016 11:01:09 -0400 References: <1463629417-31330-1-git-send-email-zxq_yx_007@163.com> <67f81dc3-6cd0-fd15-177f-e0f0a8a5d3c1@redhat.com> <573E7948.2020006@163.com> <87r3cw3hoo.fsf@dusky.pond.sub.org> From: Paolo Bonzini Message-ID: Date: Fri, 20 May 2016 17:01:01 +0200 MIME-Version: 1.0 In-Reply-To: <87r3cw3hoo.fsf@dusky.pond.sub.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 0/4] QOM'ify hw/char devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , xiaoqiang zhao Cc: michael@walle.cc, peter.maydell@linaro.org, edgar.iglesias@gmail.com, Paolo Bonzini , qemu-devel@nongnu.org, agraf@suse.de On 20/05/2016 16:52, Markus Armbruster wrote: > xiaoqiang zhao writes: >=20 >> =E5=9C=A8 2016=E5=B9=B405=E6=9C=8819=E6=97=A5 21:45, michael@walle.cc = =E5=86=99=E9=81=93: >>> Am 2016-05-19 13:32, schrieb Paolo Bonzini: >>>> Michael, can you test patches 3 and 4? >>> >>> Doesn't work for me: >>> $ qemu-system-lm32 -kernel serial.bin -serial vc -serial vc >>> Unexpected error in parse_chr() at >>> /home/mwalle/repos/qemu/hw/core/qdev-properties-system.c:149: >>> qemu-system-lm32: Property 'lm32-uart.chardev' can't take value >>> 'serial0', it's in use >>> >>> serial0 seems already be claimed. Please note that even >>> $ qemu-system-lm32 -kernel serial.bin >>> and >>> $ qemu-system-lm32 >>> does not work. >>> >>> "-serial .. -serial --" should still work, shouldn't it? >>> >>> I've uploaded a small test binary to >>> http://milkymist.walle.cc/tests/ which should prints 'A' and 'U' >>> characters on the UARTs. >> >> It seems that qemu_char_get_next_serial() call the qemu_chr_fe_claim, >> which is also called by >> qdev_prop_set_chr ! This cause chr->avail_connectinos less than 1. as >> the error message said: >> "it's in use". >> A stright fix is to call the qemu_chr_fe_release after >> qemu_char_get_next_serial and the call the >> qdev_prop_set_chr, the error is gone! I have test with your test cases >> and it works. >> >> Or another way, can we modify qemu_char_get_next_serial and just skip >> the call of qemu_chr_fe_claim? >=20 > Uh, how come qemu_char_get_next_serial() gets called? > QOMified/qdevified devices should never call it. It's called by the board. Paolo