mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:56:38 +00:00
plugins: add userdata to qemu_plugin_register_flush_cb
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-4-pierrick.bouvier@oss.qualcomm.com Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
This commit is contained in:
@@ -973,6 +973,7 @@ void qemu_plugin_vcpu_for_each(qemu_plugin_id_t id,
|
||||
* qemu_plugin_register_flush_cb() - register code cache flush callback
|
||||
* @id: plugin ID
|
||||
* @cb: callback
|
||||
* @userdata: user data for callback
|
||||
*
|
||||
* The @cb function is called every time the code cache is flushed.
|
||||
* The callback can be used to free resources associated with existing
|
||||
@@ -981,7 +982,8 @@ void qemu_plugin_vcpu_for_each(qemu_plugin_id_t id,
|
||||
*/
|
||||
QEMU_PLUGIN_API
|
||||
void qemu_plugin_register_flush_cb(qemu_plugin_id_t id,
|
||||
qemu_plugin_simple_cb_t cb);
|
||||
qemu_plugin_udata_cb_t cb,
|
||||
void *userdata);
|
||||
|
||||
/**
|
||||
* qemu_plugin_register_atexit_cb() - register exit callback
|
||||
|
||||
@@ -131,29 +131,6 @@ static void plugin_vcpu_cb__discon(CPUState *cpu,
|
||||
qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS);
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable CFI checks.
|
||||
* The callback function has been loaded from an external library so we do not
|
||||
* have type information
|
||||
*/
|
||||
QEMU_DISABLE_CFI
|
||||
static void plugin_cb__simple(enum qemu_plugin_event ev)
|
||||
{
|
||||
struct qemu_plugin_cb *cb, *next;
|
||||
|
||||
switch (ev) {
|
||||
case QEMU_PLUGIN_EV_FLUSH:
|
||||
QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) {
|
||||
qemu_plugin_simple_cb_t func = cb->f.simple;
|
||||
|
||||
func(cb->ctx->id);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable CFI checks.
|
||||
* The callback function has been loaded from an external library so we do not
|
||||
@@ -166,6 +143,7 @@ static void plugin_cb__udata(enum qemu_plugin_event ev)
|
||||
|
||||
switch (ev) {
|
||||
case QEMU_PLUGIN_EV_ATEXIT:
|
||||
case QEMU_PLUGIN_EV_FLUSH:
|
||||
QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) {
|
||||
qemu_plugin_udata_cb_t func = cb->f.udata;
|
||||
|
||||
@@ -690,9 +668,10 @@ void qemu_plugin_register_vcpu_discon_cb(qemu_plugin_id_t id,
|
||||
}
|
||||
|
||||
void qemu_plugin_register_flush_cb(qemu_plugin_id_t id,
|
||||
qemu_plugin_simple_cb_t cb)
|
||||
qemu_plugin_udata_cb_t cb,
|
||||
void *userdata)
|
||||
{
|
||||
plugin_register_cb(id, QEMU_PLUGIN_EV_FLUSH, cb);
|
||||
plugin_register_cb_udata(id, QEMU_PLUGIN_EV_FLUSH, cb, userdata);
|
||||
}
|
||||
|
||||
static bool free_dyn_cb_arr(void *p, uint32_t h, void *userp)
|
||||
@@ -706,7 +685,7 @@ void qemu_plugin_flush_cb(void)
|
||||
qht_iter_remove(&plugin.dyn_cb_arr_ht, free_dyn_cb_arr, NULL);
|
||||
qht_reset(&plugin.dyn_cb_arr_ht);
|
||||
|
||||
plugin_cb__simple(QEMU_PLUGIN_EV_FLUSH);
|
||||
plugin_cb__udata(QEMU_PLUGIN_EV_FLUSH);
|
||||
}
|
||||
|
||||
void exec_inline_op(enum plugin_dyn_cb_type type,
|
||||
|
||||
Reference in New Issue
Block a user