Received: from eggs.gnu.org ([2001:4830:134:3::10]:36539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkboN-0000GP-NL for qemu-devel@nongnu.org; Sat, 01 Nov 2014 12:46:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XkboH-0003KV-CQ for qemu-devel@nongnu.org; Sat, 01 Nov 2014 12:45:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60603) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkboH-0003KP-36 for qemu-devel@nongnu.org; Sat, 01 Nov 2014 12:45:53 -0400 Date: Sat, 1 Nov 2014 14:45:45 -0200 From: Eduardo Habkost Message-ID: <20141101164545.GD3298@thinpad.lan.raisama.net> References: <1414857371-12294-1-git-send-email-ehabkost@redhat.com> <1414857371-12294-4-git-send-email-ehabkost@redhat.com> <54550CF4.3050200@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <54550CF4.3050200@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/3] qdev: Use qdev_device_add_get_class() for -device , help List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Igor Mammedov , Gonglei , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini On Sat, Nov 01, 2014 at 05:40:20PM +0100, Andreas F=E4rber wrote: > Hi Eduardo, >=20 > Am 01.11.2014 um 16:56 schrieb Eduardo Habkost: > > Make sure we try to list properties from classes that can be safely u= sed with > > "-device". > >=20 > > Fixes the following crashes: > >=20 > > $ qemu-system-x86_64 -device x86_64-cpu,help > > ** > > ERROR:qom/object.c:336:object_initialize_with_type: assertion faile= d: (type->abstract =3D=3D false) > > Aborted (core dumped) > > $ qemu-system-x86_64 -device host-x86_64-cpu,help > > qemu-system-x86_64: [...]/target-i386/cpu.c:1329: host_x86_cpu_init= fn: Assertion `(kvm_allowed)' failed. > > Aborted (core dumped) > >=20 > > After applying this patch: > >=20 > > $ qemu-system-x86_64 -device x86_64-cpu,help > > Parameter 'driver' expects non-abstract device type > > $ qemu-system-x86_64 -device host-x86_64-cpu,help > > Parameter 'driver' expects pluggable device type > >=20 > > Signed-off-by: Eduardo Habkost > > --- > > qdev-monitor.c | 9 +++------ > > 1 file changed, 3 insertions(+), 6 deletions(-) > >=20 > > diff --git a/qdev-monitor.c b/qdev-monitor.c > > index a9702d8..ebfa701 100644 > > --- a/qdev-monitor.c > > +++ b/qdev-monitor.c > > @@ -235,12 +235,9 @@ int qdev_device_help(QemuOpts *opts) > > return 0; > > } > > =20 > > - if (!object_class_by_name(driver)) { > > - const char *typename =3D find_typename_by_alias(driver); > > - > > - if (typename) { > > - driver =3D typename; > > - } > > + qdev_get_device_class(&driver, &local_err); > > + if (local_err) { > > + goto error; > > } > > =20 > > prop_list =3D qmp_device_list_properties(driver, &local_err); >=20 > Is dc->cannot_instantiate_with_device_add_yet || (qdev_hotplug && > !dc->hotpluggable) really relevant here? Or should that rather remain > outside the common function in 1/3? cannot_instantiate_with_device_add_yet makes sure we won't try to instantiate classes that are not device_add-safe yet (like X86CPU, that has lots of assumptions and side-effects inside instance_init()). --=20 Eduardo