diff mbox series

[v2,06/14] plugins: Link only when required in system mode

Message ID 20250203031821.741477-7-richard.henderson@linaro.org
State New
Headers show
Series meson: Deprecate 32-bit host support | expand

Commit Message

Richard Henderson Feb. 3, 2025, 3:18 a.m. UTC
Provide out-of-line versions of some of the qemu/plugin.h API.
These will be referenced with --enable-plugin, but CONFIG_TCG
is disabled for a specific target.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 plugins/stubs.c     | 49 +++++++++++++++++++++++++++++++++++++++++++++
 plugins/meson.build |  5 ++++-
 2 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 plugins/stubs.c

Comments

Thomas Huth Feb. 3, 2025, 10:16 a.m. UTC | #1
On 03/02/2025 04.18, Richard Henderson wrote:
> Provide out-of-line versions of some of the qemu/plugin.h API.
> These will be referenced with --enable-plugin, but CONFIG_TCG
> is disabled for a specific target.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   plugins/stubs.c     | 49 +++++++++++++++++++++++++++++++++++++++++++++
>   plugins/meson.build |  5 ++++-
>   2 files changed, 53 insertions(+), 1 deletion(-)
>   create mode 100644 plugins/stubs.c

Reviewed-by: Thomas Huth <thuth@redhat.com>
Alex Bennée Feb. 3, 2025, 11:49 a.m. UTC | #2
Richard Henderson <richard.henderson@linaro.org> writes:

> Provide out-of-line versions of some of the qemu/plugin.h API.
> These will be referenced with --enable-plugin, but CONFIG_TCG
> is disabled for a specific target.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
diff mbox series

Patch

diff --git a/plugins/stubs.c b/plugins/stubs.c
new file mode 100644
index 0000000000..57af8357e4
--- /dev/null
+++ b/plugins/stubs.c
@@ -0,0 +1,49 @@ 
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Stubs for when CONFIG_PLUGIN is enabled generally, but
+ * CONFIG_TCG_TARGET is disabled for a specific target.
+ * This will only be the case for 64-bit guests on 32-bit hosts
+ * when an alternate accelerator is enabled.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/plugin.h"
+#include "qapi/error.h"
+
+
+void qemu_plugin_add_opts(void)
+{
+}
+
+void qemu_plugin_opt_parse(const char *optstr, QemuPluginList *head)
+{
+    error_report("plugin interface not enabled in this build");
+    exit(1);
+}
+
+int qemu_plugin_load_list(QemuPluginList *head, Error **errp)
+{
+    return 0;
+}
+
+void qemu_plugin_vcpu_init_hook(CPUState *cpu)
+{
+}
+
+void qemu_plugin_vcpu_exit_hook(CPUState *cpu)
+{
+}
+
+void qemu_plugin_vcpu_idle_cb(CPUState *cpu)
+{
+}
+
+void qemu_plugin_vcpu_resume_cb(CPUState *cpu)
+{
+}
+
+CPUPluginState *qemu_plugin_create_vcpu_state(void)
+{
+    /* Protected by tcg_enabled() */
+    g_assert_not_reached();
+}
diff --git a/plugins/meson.build b/plugins/meson.build
index d60be2a4d6..42442fe22b 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -57,8 +57,11 @@  if host_os == 'windows'
     command: dlltool_cmd
   )
 endif
-specific_ss.add(files(
+
+specific_ss.add(when: 'CONFIG_TCG', if_true: files(
   'loader.c',
   'core.c',
   'api.c',
+), if_false: files(
+  'stubs.c'
 ))