Received: from eggs.gnu.org ([2001:4830:134:3::10]:39937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsSc0-00062n-AF for qemu-devel@nongnu.org; Mon, 16 Dec 2013 02:29:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsSbv-0006vW-8s for qemu-devel@nongnu.org; Mon, 16 Dec 2013 02:29:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:6967) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsSbv-0006vP-1G for qemu-devel@nongnu.org; Mon, 16 Dec 2013 02:29:03 -0500 From: Markus Armbruster References: <1385656023-11519-1-git-send-email-armbru@redhat.com> <1385656023-11519-11-git-send-email-armbru@redhat.com> <52AE104C.9090703@suse.de> Date: Mon, 16 Dec 2013 08:28:52 +0100 In-Reply-To: <52AE104C.9090703@suse.de> ("Andreas =?utf-8?Q?F=C3=A4rber=22?= =?utf-8?Q?'s?= message of "Sun, 15 Dec 2013 21:25:48 +0100") Message-ID: <878uvlntjf.fsf@blackfin.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 10/10] qdev: Do not let the user try to device_add when it cannot work List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?utf-8?Q?F=C3=A4rber?= Cc: peter.maydell@linaro.org, marcel.a@redhat.com, qemu-devel@nongnu.org, Luiz Capitulino , borntraeger@de.ibm.com, aliguori@amazon.com Andreas F=C3=A4rber writes: > Am 28.11.2013 17:27, schrieb armbru@redhat.com: >> From: Markus Armbruster >>=20 >> Such devices have always been unavailable and omitted from the list of >> available devices shown by device_add help. Until commit 18b6dad >> silently broke the former, setting up nasty traps for unwary users, >> like this one: >>=20 >> $ qemu-system-x86_64 -nodefaults -monitor stdio -display none >> QEMU 1.6.50 monitor - type 'help' for more information >> (qemu) device_add apic >> Segmentation fault (core dumped) >>=20 >> I call that a regression. Fix it. >>=20 >> Signed-off-by: Markus Armbruster >> Reviewed-by: Marcel Apfelbaum >> --- >> qdev-monitor.c | 5 +++++ >> 1 file changed, 5 insertions(+) >>=20 >> diff --git a/qdev-monitor.c b/qdev-monitor.c >> index e6825ba..177b849 100644 >> --- a/qdev-monitor.c >> +++ b/qdev-monitor.c >> @@ -490,6 +490,11 @@ DeviceState *qdev_device_add(QemuOpts *opts) if (!oc) { qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", "device t= ype"); return NULL; } if (object_class_is_abstract(oc)) { qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", "non-abstract device type"); return NULL; >> } >>=20=20 >> dc =3D DEVICE_CLASS(oc); >> + if (dc->cannot_instantiate_with_device_add_yet) { >> + qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", >> + "pluggable device type"); > > Is this a restoration of a previous state? Because I thought we > shouldn't use QERR_* any more for new code... See the additional context: I'm sticking to what the existing nearby code does. >> + return NULL; >> + } >>=20=20 >> /* find bus */ >> path =3D qemu_opt_get(opts, "bus"); >>=20