From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3lnB-0003IH-Q1 for qemu-devel@nongnu.org; Fri, 20 May 2016 10:52:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3ln8-0006g2-KM for qemu-devel@nongnu.org; Fri, 20 May 2016 10:52:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36245) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3ln8-0006fs-Eg for qemu-devel@nongnu.org; Fri, 20 May 2016 10:52:42 -0400 From: Markus Armbruster References: <1463629417-31330-1-git-send-email-zxq_yx_007@163.com> <67f81dc3-6cd0-fd15-177f-e0f0a8a5d3c1@redhat.com> <573E7948.2020006@163.com> Date: Fri, 20 May 2016 16:52:39 +0200 In-Reply-To: <573E7948.2020006@163.com> (xiaoqiang zhao's message of "Fri, 20 May 2016 10:41:12 +0800") Message-ID: <87r3cw3hoo.fsf@dusky.pond.sub.org> MIME-Version: 1.0 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: xiaoqiang zhao Cc: michael@walle.cc, Paolo Bonzini , peter.maydell@linaro.org, edgar.iglesias@gmail.com, Paolo Bonzini , qemu-devel@nongnu.org, agraf@suse.de xiaoqiang zhao writes: > =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. >> >> -michael > > Hi, michael: > > 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? Uh, how come qemu_char_get_next_serial() gets called? QOMified/qdevified devices should never call it.