aboutsummaryrefslogtreecommitdiff
path: root/softmmu/qdev-monitor.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-12-15 21:24:31 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-12-15 21:24:31 +0000
commitaf3f37319cb1e1ca0c42842ecdbd1bcfc64a4b6f (patch)
tree101575a319b7c2f95e75ef44cf1483a87a564226 /softmmu/qdev-monitor.c
parent657ee88ef3ec55c3a6164da88c11a6640ca7507c (diff)
parentbbd2d5a8120771ec59b86a80a1f51884e0a26e53 (diff)
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging
* New -action option and set-action QMP command (Alejandro) * More vl.c cleanup (myself with help from Daniel and Igor) * Remove deprecated options (Philippe, Thomas) * Dirty bitmap fix (Zenghui) * icount caching speedup (Pavel) * SCSI race fix (Maxim) * Remove pre-GCC 4.8 code (Marc-André) # gpg: Signature made Tue 15 Dec 2020 17:53:24 GMT # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini-gitlab/tags/for-upstream: (45 commits) build: -no-pie is no functional linker flag scripts/git.orderfile: Keep files with .inc extension sorted compiler.h: remove QEMU_GNUC_PREREQ linux-user: remove GNUC check compiler: remove GNUC check xen: remove GNUC check poison: remove GNUC check compiler.h: explicit case for Clang printf attribute virtiofsd: replace _Static_assert with QEMU_BUILD_BUG_ON tests: remove GCC < 4 fallbacks qemu-plugin.h: remove GCC < 4 compiler.h: remove GCC < 3 __builtin_expect fallback accel/tcg: Remove special case for GCC < 4.6 qemu/atomic: Drop special case for unsupported compiler hw/core: Restrict 'fw-path-provider.c' to system mode emulation docs: set CONFDIR when running sphinx vl: rename local variable in configure_accelerators qemu-option: pass QemuOptsList to opts_accepts_any qemu-option: simplify search for end of key kvm: Take into account the unaligned section size when preparing bitmap ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org> # Conflicts: # softmmu/vl.c
Diffstat (limited to 'softmmu/qdev-monitor.c')
-rw-r--r--softmmu/qdev-monitor.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index 8c072e3efc..2c57e36c9a 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -25,6 +25,7 @@
#include "sysemu/arch_init.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-qdev.h"
+#include "qapi/qmp/dispatch.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qerror.h"
#include "qemu/config-file.h"
@@ -244,7 +245,7 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp)
dc = DEVICE_CLASS(oc);
if (!dc->user_creatable ||
- (qdev_hotplug && !dc->hotpluggable)) {
+ (phase_check(PHASE_MACHINE_READY) && !dc->hotpluggable)) {
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver",
"a pluggable device type");
return NULL;
@@ -626,7 +627,7 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
}
}
- if (qdev_hotplug && bus && !qbus_is_hotpluggable(bus)) {
+ if (phase_check(PHASE_MACHINE_READY) && bus && !qbus_is_hotpluggable(bus)) {
error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
return NULL;
}
@@ -640,15 +641,17 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
dev = qdev_new(driver);
/* Check whether the hotplug is allowed by the machine */
- if (qdev_hotplug && !qdev_hotplug_allowed(dev, errp)) {
- goto err_del_dev;
- }
+ if (phase_check(PHASE_MACHINE_READY)) {
+ if (!qdev_hotplug_allowed(dev, errp)) {
+ goto err_del_dev;
+ }
- if (!bus && qdev_hotplug && !qdev_get_machine_hotplug_handler(dev)) {
- /* No bus, no machine hotplug handler --> device is not hotpluggable */
- error_setg(errp, "Device '%s' can not be hotplugged on this machine",
- driver);
- goto err_del_dev;
+ if (!bus && !qdev_get_machine_hotplug_handler(dev)) {
+ /* No bus, no machine hotplug handler --> device is not hotpluggable */
+ error_setg(errp, "Device '%s' can not be hotplugged on this machine",
+ driver);
+ goto err_del_dev;
+ }
}
qdev_set_id(dev, qemu_opts_id(opts));
@@ -983,3 +986,14 @@ int qemu_global_option(const char *str)
return 0;
}
+
+bool qmp_command_available(const QmpCommand *cmd, Error **errp)
+{
+ if (!phase_check(PHASE_MACHINE_READY) &&
+ !(cmd->options & QCO_ALLOW_PRECONFIG)) {
+ error_setg(errp, "The command '%s' is permitted only after machine initialization has completed",
+ cmd->name);
+ return false;
+ }
+ return true;
+}