From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org
Subject: [PULL 25/26] qemu-config: load modules when instantiating option groups
Date: Thu, 20 May 2021 10:22:56 +0200 [thread overview]
Message-ID: <20210520082257.187061-26-pbonzini@redhat.com> (raw)
In-Reply-To: <20210520082257.187061-1-pbonzini@redhat.com>
Right now the SPICE module is special cased to be loaded when processing
of the -spice command line option. However, the spice option group
can also be brought in via -readconfig, in which case the module is
not loaded.
Add a generic hook to load modules that provide a QemuOpts group,
and use it for the "spice" and "iscsi" groups.
Fixes: #194
Fixes: https://bugs.launchpad.net/qemu/+bug/1910696
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/qemu/config-file.h | 2 +-
softmmu/vl.c | 21 +++++++++++++++++----
stubs/meson.build | 1 +
stubs/module-opts.c | 6 ++++++
util/qemu-config.c | 1 +
5 files changed, 26 insertions(+), 5 deletions(-)
create mode 100644 stubs/module-opts.c
diff --git a/include/qemu/config-file.h b/include/qemu/config-file.h
index 8d3e53ae4d..0500b3668d 100644
--- a/include/qemu/config-file.h
+++ b/include/qemu/config-file.h
@@ -1,7 +1,7 @@
#ifndef QEMU_CONFIG_FILE_H
#define QEMU_CONFIG_FILE_H
-
+void qemu_load_module_for_opts(const char *group);
QemuOptsList *qemu_find_opts(const char *group);
QemuOptsList *qemu_find_opts_err(const char *group, Error **errp);
QemuOpts *qemu_find_opts_singleton(const char *group);
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 21e55718a6..6054f6f0b9 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2627,6 +2627,23 @@ void qmp_x_exit_preconfig(Error **errp)
}
}
+#ifdef CONFIG_MODULES
+void qemu_load_module_for_opts(const char *group)
+{
+ static bool spice_tried;
+ if (g_str_equal(group, "spice") && !spice_tried) {
+ ui_module_load_one("spice-core");
+ spice_tried = true;
+ }
+
+ static bool iscsi_tried;
+ if (g_str_equal(group, "iscsi") && !iscsi_tried) {
+ block_module_load_one("iscsi");
+ iscsi_tried = true;
+ }
+}
+#endif
+
void qemu_init(int argc, char **argv, char **envp)
{
QemuOpts *opts;
@@ -3386,10 +3403,6 @@ void qemu_init(int argc, char **argv, char **envp)
break;
case QEMU_OPTION_spice:
olist = qemu_find_opts_err("spice", NULL);
- if (!olist) {
- ui_module_load_one("spice-core");
- olist = qemu_find_opts("spice");
- }
if (!olist) {
error_report("spice support is disabled");
exit(1);
diff --git a/stubs/meson.build b/stubs/meson.build
index 3faef16892..f3f979c3fe 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -22,6 +22,7 @@ stub_ss.add(files('isa-bus.c'))
stub_ss.add(files('is-daemonized.c'))
stub_ss.add(when: 'CONFIG_LINUX_AIO', if_true: files('linux-aio.c'))
stub_ss.add(files('migr-blocker.c'))
+stub_ss.add(files('module-opts.c'))
stub_ss.add(files('monitor.c'))
stub_ss.add(files('monitor-core.c'))
stub_ss.add(files('pci-bus.c'))
diff --git a/stubs/module-opts.c b/stubs/module-opts.c
new file mode 100644
index 0000000000..a7d0e4ad6e
--- /dev/null
+++ b/stubs/module-opts.c
@@ -0,0 +1,6 @@
+#include "qemu/osdep.h"
+#include "qemu/config-file.h"
+
+void qemu_load_module_for_opts(const char *group)
+{
+}
diff --git a/util/qemu-config.c b/util/qemu-config.c
index 670bd6ebca..34974c4b47 100644
--- a/util/qemu-config.c
+++ b/util/qemu-config.c
@@ -16,6 +16,7 @@ static QemuOptsList *find_list(QemuOptsList **lists, const char *group,
{
int i;
+ qemu_load_module_for_opts(group);
for (i = 0; lists[i] != NULL; i++) {
if (strcmp(lists[i]->name, group) == 0)
break;
--
2.31.1
next prev parent reply other threads:[~2021-05-20 8:45 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-20 8:22 [PULL 00/26] Misc patches for 2021-05-20 Paolo Bonzini
2021-05-20 8:22 ` [PULL 01/26] configure: Only clone softfloat-3 repositories if TCG is enabled Paolo Bonzini
2021-05-20 8:22 ` [PULL 02/26] configure: check for submodules if --with-git-submodules=ignore Paolo Bonzini
2021-05-20 8:22 ` [PULL 03/26] configure: simplify assignment to GIT_SUBMODULES Paolo Bonzini
2021-05-20 8:22 ` [PULL 04/26] hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on' Paolo Bonzini
2021-05-20 8:22 ` [PULL 05/26] i386/cpu: Expose AVX_VNNI instruction to guest Paolo Bonzini
2021-05-20 8:22 ` [PULL 06/26] meson: bump submodule to 0.57.2 Paolo Bonzini
2021-05-20 8:22 ` [PULL 07/26] object: add more commands to preconfig mode Paolo Bonzini
2021-05-20 8:22 ` [PULL 08/26] qtest: add a QOM object for qtest Paolo Bonzini
2021-05-20 8:22 ` [PULL 09/26] KVM: do not allow setting properties at runtime Paolo Bonzini
2021-05-20 8:22 ` [PULL 10/26] memory: Introduce log_sync_global() to memory listener Paolo Bonzini
2021-05-20 8:22 ` [PULL 11/26] KVM: Use a big lock to replace per-kml slots_lock Paolo Bonzini
2021-05-20 8:22 ` [PULL 12/26] KVM: Create the KVMSlot dirty bitmap on flag changes Paolo Bonzini
2021-05-20 8:22 ` [PULL 13/26] KVM: Provide helper to get kvm dirty log Paolo Bonzini
2021-05-20 8:22 ` [PULL 14/26] KVM: Provide helper to sync dirty bitmap from slot to ramblock Paolo Bonzini
2021-05-20 8:22 ` [PULL 15/26] KVM: Simplify dirty log sync in kvm_set_phys_mem Paolo Bonzini
2021-05-20 8:22 ` [PULL 16/26] KVM: Cache kvm slot dirty bitmap size Paolo Bonzini
2021-05-20 8:22 ` [PULL 17/26] KVM: Add dirty-ring-size property Paolo Bonzini
2021-05-20 8:22 ` [PULL 18/26] KVM: Disable manual dirty log when dirty ring enabled Paolo Bonzini
2021-05-20 8:22 ` [PULL 19/26] KVM: Dirty ring support Paolo Bonzini
2021-05-20 8:22 ` [PULL 20/26] tests/qtest/fuzz: Fix build failure Paolo Bonzini
2021-05-20 8:22 ` [PULL 21/26] meson: Set implicit_include_directories to false Paolo Bonzini
2021-05-20 8:22 ` [PULL 22/26] remove qemu-options* from root directory Paolo Bonzini
2021-05-20 8:22 ` [PULL 23/26] replication: move include out of " Paolo Bonzini
2021-05-20 8:22 ` [PULL 24/26] vl: allow not specifying size in -m when using -M memory-backend Paolo Bonzini
2021-05-20 8:22 ` Paolo Bonzini [this message]
2021-05-20 8:22 ` [PULL 26/26] scsi-generic: pass max_segments via max_iov field in BlockLimits Paolo Bonzini
2021-05-20 8:54 ` [PULL 00/26] Misc patches for 2021-05-20 no-reply
2021-05-20 13:26 ` Peter Maydell
2021-05-20 14:20 ` Peter Maydell
2021-05-20 14:25 ` Peter Maydell
2021-05-21 13:27 ` Paolo Bonzini
2021-05-21 13:44 ` Peter Maydell
2021-05-24 9:42 ` Paolo Bonzini
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=20210520082257.187061-26-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@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).