[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 40/54] vl: support -plugin option
From: |
Alex Bennée |
Subject: |
[PATCH v6 40/54] vl: support -plugin option |
Date: |
Thu, 17 Oct 2019 14:16:01 +0100 |
From: Lluís Vilanova <address@hidden>
Signed-off-by: Lluís Vilanova <address@hidden>
[ cota: s/instrument/plugin ]
Signed-off-by: Emilio G. Cota <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Alex Bennée <address@hidden>
---
qemu-options.hx | 17 +++++++++++++++++
vl.c | 11 +++++++++++
2 files changed, 28 insertions(+)
diff --git a/qemu-options.hx b/qemu-options.hx
index 793d70ff93..37f13689e7 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4166,6 +4166,23 @@ HXCOMM HX does not support conditional compilation of
text.
@findex -trace
@include qemu-option-trace.texi
ETEXI
+DEF("plugin", HAS_ARG, QEMU_OPTION_plugin,
+ "-plugin [file=]<file>[,arg=<string>]\n"
+ " load a plugin\n",
+ QEMU_ARCH_ALL)
+STEXI
+@item -plugin file=@var{file}[,arg=@var{string}]
+@findex -plugin
+
+Load a plugin.
+
+@table @option
+@item file=@var{file}
+Load the given plugin from a shared library file.
+@item arg=@var{string}
+Argument string passed to the plugin. (Can be given multiple times.)
+@end table
+ETEXI
HXCOMM Internal use
DEF("qtest", HAS_ARG, QEMU_OPTION_qtest, "", QEMU_ARCH_ALL)
diff --git a/vl.c b/vl.c
index 4489cfb2bb..8b1b4133e4 100644
--- a/vl.c
+++ b/vl.c
@@ -110,6 +110,7 @@ int main(int argc, char **argv)
#include "trace-root.h"
#include "trace/control.h"
+#include "qemu/plugin.h"
#include "qemu/queue.h"
#include "sysemu/arch_init.h"
@@ -2854,6 +2855,7 @@ int main(int argc, char **argv, char **envp)
bool list_data_dirs = false;
char *dir, **dirs;
BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
+ QemuPluginList plugin_list = QTAILQ_HEAD_INITIALIZER(plugin_list);
os_set_line_buffering();
@@ -2884,6 +2886,7 @@ int main(int argc, char **argv, char **envp)
qemu_add_opts(&qemu_global_opts);
qemu_add_opts(&qemu_mon_opts);
qemu_add_opts(&qemu_trace_opts);
+ qemu_plugin_add_opts();
qemu_add_opts(&qemu_option_rom_opts);
qemu_add_opts(&qemu_machine_opts);
qemu_add_opts(&qemu_accel_opts);
@@ -3678,6 +3681,9 @@ int main(int argc, char **argv, char **envp)
g_free(trace_file);
trace_file = trace_opt_parse(optarg);
break;
+ case QEMU_OPTION_plugin:
+ qemu_plugin_opt_parse(optarg, &plugin_list);
+ break;
case QEMU_OPTION_readconfig:
{
int ret = qemu_read_config_file(optarg);
@@ -3991,6 +3997,11 @@ int main(int argc, char **argv, char **envp)
machine_class->default_machine_opts, 0);
}
+ /* process plugin before CPUs are created, but once -smp has been parsed */
+ if (qemu_plugin_load_list(&plugin_list)) {
+ exit(1);
+ }
+
qemu_opts_foreach(qemu_find_opts("device"),
default_driver_check, NULL, NULL);
qemu_opts_foreach(qemu_find_opts("global"),
--
2.20.1
- [PATCH v6 18/54] *-user: notify plugin of exit, (continued)
- [PATCH v6 18/54] *-user: notify plugin of exit, Alex Bennée, 2019/10/17
- [PATCH v6 36/54] plugin: add API symbols to qemu-plugins.symbols, Alex Bennée, 2019/10/17
- [PATCH v6 25/54] target/sh4: fetch code with translator_ld, Alex Bennée, 2019/10/17
- [PATCH v6 33/54] target/openrisc: fetch code with translator_ld, Alex Bennée, 2019/10/17
- [PATCH v6 54/54] scripts/checkpatch.pl: don't complain about (foo, /* empty */), Alex Bennée, 2019/10/17
- [PATCH v6 20/54] cpu: hook plugin vcpu events, Alex Bennée, 2019/10/17
- [PATCH v6 44/54] tests/tcg: set QEMU_OPTS for all cris runs, Alex Bennée, 2019/10/17
- [PATCH v6 22/54] translator: add translator_ld{ub,sw,uw,l,q}, Alex Bennée, 2019/10/17
- [PATCH v6 32/54] target/xtensa: fetch code with translator_ld, Alex Bennée, 2019/10/17
- [PATCH v6 30/54] target/riscv: fetch code with translator_ld, Alex Bennée, 2019/10/17
- [PATCH v6 40/54] vl: support -plugin option,
Alex Bennée <=
- [PATCH v6 51/54] accel/stubs: reduce headers from tcg-stub, Alex Bennée, 2019/10/17
- [PATCH v6 52/54] include/exec: wrap cpu_ldst.h in CONFIG_TCG, Alex Bennée, 2019/10/17
- [PATCH v6 31/54] target/sparc: fetch code with translator_ld, Alex Bennée, 2019/10/17
- [PATCH v6 53/54] .travis.yml: add --enable-plugins tests, Alex Bennée, 2019/10/17
- [PATCH v6 41/54] linux-user: support -plugin option, Alex Bennée, 2019/10/17
- [PATCH v6 43/54] tests/tcg/Makefile.target: fix path to config-host.mak, Alex Bennée, 2019/10/17
- [PATCH v6 16/54] plugins: implement helpers for resolving hwaddr, Alex Bennée, 2019/10/17
- [PATCH v6 17/54] translate-all: notify plugin code of tb_flush, Alex Bennée, 2019/10/17
- [PATCH v6 28/54] target/m68k: fetch code with translator_ld, Alex Bennée, 2019/10/17
- [PATCH v6 27/54] target/hppa: fetch code with translator_ld, Alex Bennée, 2019/10/17