aboutsummaryrefslogtreecommitdiff
path: root/plugins/core.c
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2024-02-27 14:43:28 +0000
committerAlex Bennée <alex.bennee@linaro.org>2024-02-28 09:11:42 +0000
commitc006147122dede4440c027142ce3025f64e199c0 (patch)
treee250bdbb06eca51818dd140bf3a99505b0a90fbd /plugins/core.c
parentc3d0b46645d4b95b1fa24f4911738cb59d26173e (diff)
plugins: create CPUPluginState and migrate plugin_mask
As we expand the per-vCPU data for plugins we don't want to pollute CPUState. For now this just moves the plugin_mask (renamed to event_mask) as the memory callbacks are accessed directly by TCG generated code. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240227144335.1196131-23-alex.bennee@linaro.org>
Diffstat (limited to 'plugins/core.c')
-rw-r--r--plugins/core.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/core.c b/plugins/core.c
index 2392bbb888..2db4d31354 100644
--- a/plugins/core.c
+++ b/plugins/core.c
@@ -17,6 +17,7 @@
#include "qapi/error.h"
#include "qemu/lockable.h"
#include "qemu/option.h"
+#include "qemu/plugin.h"
#include "qemu/rcu_queue.h"
#include "qemu/xxhash.h"
#include "qemu/rcu.h"
@@ -53,7 +54,8 @@ struct qemu_plugin_ctx *plugin_id_to_ctx_locked(qemu_plugin_id_t id)
static void plugin_cpu_update__async(CPUState *cpu, run_on_cpu_data data)
{
- bitmap_copy(cpu->plugin_mask, &data.host_ulong, QEMU_PLUGIN_EV_MAX);
+ bitmap_copy(cpu->plugin_state->event_mask,
+ &data.host_ulong, QEMU_PLUGIN_EV_MAX);
tcg_flush_jmp_cache(cpu);
}
@@ -208,6 +210,11 @@ plugin_register_cb_udata(qemu_plugin_id_t id, enum qemu_plugin_event ev,
do_plugin_register_cb(id, ev, func, udata);
}
+CPUPluginState *qemu_plugin_create_vcpu_state(void)
+{
+ return g_new0(CPUPluginState, 1);
+}
+
void qemu_plugin_vcpu_init_hook(CPUState *cpu)
{
bool success;
@@ -356,7 +363,7 @@ qemu_plugin_vcpu_syscall(CPUState *cpu, int64_t num, uint64_t a1, uint64_t a2,
struct qemu_plugin_cb *cb, *next;
enum qemu_plugin_event ev = QEMU_PLUGIN_EV_VCPU_SYSCALL;
- if (!test_bit(ev, cpu->plugin_mask)) {
+ if (!test_bit(ev, cpu->plugin_state->event_mask)) {
return;
}
@@ -378,7 +385,7 @@ void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_t num, int64_t ret)
struct qemu_plugin_cb *cb, *next;
enum qemu_plugin_event ev = QEMU_PLUGIN_EV_VCPU_SYSCALL_RET;
- if (!test_bit(ev, cpu->plugin_mask)) {
+ if (!test_bit(ev, cpu->plugin_state->event_mask)) {
return;
}