mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
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>
This commit is contained in:
parent
c3d0b46645
commit
c006147122
6 changed files with 38 additions and 8 deletions
|
@ -31,7 +31,6 @@
|
|||
#include "qemu/rcu_queue.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "qemu/plugin-event.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
typedef int (*WriteCoreDumpFunction)(const void *buf, size_t size,
|
||||
|
@ -434,7 +433,8 @@ struct qemu_work_item;
|
|||
* @kvm_fd: vCPU file descriptor for KVM.
|
||||
* @work_mutex: Lock to prevent multiple access to @work_list.
|
||||
* @work_list: List of pending asynchronous work.
|
||||
* @plugin_mask: Plugin event bitmap. Modified only via async work.
|
||||
* @plugin_mem_cbs: active plugin memory callbacks
|
||||
* @plugin_state: per-CPU plugin state
|
||||
* @ignore_memory_transaction_failures: Cached copy of the MachineState
|
||||
* flag of the same name: allows the board to suppress calling of the
|
||||
* CPU do_transaction_failed hook function.
|
||||
|
@ -526,10 +526,13 @@ struct CPUState {
|
|||
/* Use by accel-block: CPU is executing an ioctl() */
|
||||
QemuLockCnt in_ioctl_lock;
|
||||
|
||||
DECLARE_BITMAP(plugin_mask, QEMU_PLUGIN_EV_MAX);
|
||||
|
||||
#ifdef CONFIG_PLUGIN
|
||||
/*
|
||||
* The callback pointer stays in the main CPUState as it is
|
||||
* accessed via TCG (see gen_empty_mem_helper).
|
||||
*/
|
||||
GArray *plugin_mem_cbs;
|
||||
CPUPluginState *plugin_state;
|
||||
#endif
|
||||
|
||||
/* TODO Move common fields from CPUArchState here. */
|
||||
|
|
|
@ -186,6 +186,19 @@ struct qemu_plugin_insn *qemu_plugin_tb_insn_get(struct qemu_plugin_tb *tb,
|
|||
return insn;
|
||||
}
|
||||
|
||||
/**
|
||||
* struct CPUPluginState - per-CPU state for plugins
|
||||
* @event_mask: plugin event bitmap. Modified only via async work.
|
||||
*/
|
||||
struct CPUPluginState {
|
||||
DECLARE_BITMAP(event_mask, QEMU_PLUGIN_EV_MAX);
|
||||
};
|
||||
|
||||
/**
|
||||
* qemu_plugin_create_vcpu_state: allocate plugin state
|
||||
*/
|
||||
CPUPluginState *qemu_plugin_create_vcpu_state(void);
|
||||
|
||||
void qemu_plugin_vcpu_init_hook(CPUState *cpu);
|
||||
void qemu_plugin_vcpu_exit_hook(CPUState *cpu);
|
||||
void qemu_plugin_tb_trans_cb(CPUState *cpu, struct qemu_plugin_tb *tb);
|
||||
|
|
|
@ -42,6 +42,7 @@ typedef struct CompatProperty CompatProperty;
|
|||
typedef struct ConfidentialGuestSupport ConfidentialGuestSupport;
|
||||
typedef struct CPUAddressSpace CPUAddressSpace;
|
||||
typedef struct CPUArchState CPUArchState;
|
||||
typedef struct CPUPluginState CPUPluginState;
|
||||
typedef struct CpuInfoFast CpuInfoFast;
|
||||
typedef struct CPUJumpCache CPUJumpCache;
|
||||
typedef struct CPUState CPUState;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue