From: armbru@redhat.com
To: qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, afaerber@suse.de, anthony@codemonkey.ws,
peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH RFC 9/9] qdev: Do not let the user try to device_add when it cannot work
Date: Thu, 10 Oct 2013 16:42:54 +0200 [thread overview]
Message-ID: <1381416174-5110-10-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1381416174-5110-1-git-send-email-armbru@redhat.com>
From: Markus Armbruster <armbru@redhat.com>
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:
$ 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)
I call that a regression. Fix it.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
qdev-monitor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 36f6f09..c538fec 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -477,7 +477,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
}
}
- if (!obj) {
+ if (!obj || DEVICE_CLASS(obj)->cannot_instantiate_with_device_add_yet) {
qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", "device type");
return NULL;
}
--
1.8.1.4
next prev parent reply other threads:[~2013-10-10 14:43 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-10 14:42 [Qemu-devel] [PATCH RFC 0/9] Clean up and fix no_user armbru
2013-10-10 14:42 ` [Qemu-devel] [PATCH RFC 1/9] qdev: Replace no_user by cannot_instantiate_with_device_add_yet armbru
2013-10-10 14:42 ` [Qemu-devel] [PATCH RFC 2/9] sysbus: Set cannot_instantiate_with_device_add_yet armbru
2013-10-10 14:42 ` [Qemu-devel] [PATCH RFC 3/9] apic: Document why cannot_instantiate_with_device_add_yet armbru
2013-10-10 14:42 ` [Qemu-devel] [PATCH RFC 4/9] pci-host: Consistently set cannot_instantiate_with_device_add_yet armbru
2013-10-10 14:42 ` [Qemu-devel] [PATCH RFC 5/9] ich9: Document why cannot_instantiate_with_device_add_yet armbru
2013-10-10 16:01 ` Paolo Bonzini
2013-10-10 16:03 ` Paolo Bonzini
2013-10-11 6:13 ` Markus Armbruster
2013-10-10 14:42 ` [Qemu-devel] [PATCH RFC 6/9] piix3 piix4: " armbru
2013-10-10 14:42 ` [Qemu-devel] [PATCH RFC 7/9] vt82c686: " armbru
2013-10-10 14:42 ` [Qemu-devel] [PATCH RFC 8/9] isa: Clean up use of cannot_instantiate_with_device_add_yet armbru
2013-10-15 12:43 ` [Qemu-devel] Should the i8259 devices remain no-user? (was: [PATCH RFC 8/9] isa: Clean up use of cannot_instantiate_with_device_add_yet) Markus Armbruster
2013-10-15 12:54 ` [Qemu-devel] Should the i8259 devices remain no-user? Paolo Bonzini
2013-10-16 9:51 ` Markus Armbruster
2013-10-16 11:06 ` Paolo Bonzini
2013-10-16 16:12 ` Markus Armbruster
2013-10-16 16:21 ` BALATON Zoltan
2013-10-16 16:23 ` Paolo Bonzini
2013-10-26 20:00 ` [Qemu-devel] fix clearing i8259 IRQ lines (Was: Should the i8259 devices remain no-user?) Matthew Ogilvie
2013-10-29 16:27 ` BALATON Zoltan
2013-10-10 14:42 ` armbru [this message]
2013-10-15 12:24 ` [Qemu-devel] Why is TYPE_CPU no-user? (was: [PATCH RFC 0/9] Clean up and fix no_user) Markus Armbruster
2013-10-15 12:37 ` Peter Maydell
2013-10-15 14:01 ` [Qemu-devel] Why is TYPE_CPU no-user? Markus Armbruster
2013-10-15 13:08 ` Andreas Färber
2013-10-16 9:55 ` Markus Armbruster
2013-10-15 13:21 ` [Qemu-devel] Which functions of southbridges should be no-user? (was: [PATCH RFC 0/9] Clean up and fix no_user) Markus Armbruster
2013-10-15 13:31 ` [Qemu-devel] Which functions of southbridges should be no-user? Andreas Färber
2013-10-15 14:41 ` Kevin Wolf
2013-10-15 14:53 ` Andreas Färber
2013-10-16 9:58 ` Markus Armbruster
2013-10-15 15:09 ` Anthony Liguori
2013-10-16 10:00 ` Markus Armbruster
2013-10-16 11:02 ` Andreas Färber
2013-10-17 9:47 ` Markus Armbruster
2013-10-16 17:53 ` Anthony Liguori
2013-10-17 9:49 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381416174-5110-10-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=borntraeger@de.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).