From cfbc3c6083dbdd0fdd9cc98965182e79431d3c63 Mon Sep 17 00:00:00 2001 From: "Emilio G. Cota" Date: Mon, 26 Nov 2018 17:14:43 -0500 Subject: cpu: introduce cpu_in_exclusive_context() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Suggested-by: Alex Bennée Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota [AJB: moved inside start/end_exclusive fns + cleanup] Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- include/hw/core/cpu.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/hw/core/cpu.h') diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 031f587e51..07f2ab0590 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -372,6 +372,7 @@ struct CPUState { bool unplug; bool crash_occurred; bool exit_request; + bool in_exclusive_context; uint32_t cflags_next_tb; /* updates protected by BQL */ uint32_t interrupt_request; @@ -783,6 +784,18 @@ void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) */ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data); +/** + * cpu_in_exclusive_context() + * @cpu: The vCPU to check + * + * Returns true if @cpu is an exclusive context, for example running + * something which has previously been queued via async_safe_run_on_cpu(). + */ +static inline bool cpu_in_exclusive_context(const CPUState *cpu) +{ + return cpu->in_exclusive_context; +} + /** * qemu_get_cpu: * @index: The CPUState@cpu_index value of the CPU to obtain. -- cgit v1.2.3 From 54cb65d8588b67853a8898eb73e82d76c1a1e2e1 Mon Sep 17 00:00:00 2001 From: "Emilio G. Cota" Date: Wed, 30 Aug 2017 18:39:53 -0400 Subject: plugin: add core code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Emilio G. Cota [AJB: moved directory and merged various fixes] Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- include/hw/core/cpu.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/hw/core/cpu.h') diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 07f2ab0590..e1c383ba84 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -29,6 +29,7 @@ #include "qemu/rcu_queue.h" #include "qemu/queue.h" #include "qemu/thread.h" +#include "qemu/plugin.h" typedef int (*WriteCoreDumpFunction)(const void *buf, size_t size, void *opaque); @@ -344,6 +345,7 @@ struct qemu_work_item; * @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes * to @trace_dstate). * @trace_dstate: Dynamic tracing state of events for this vCPU (bitmask). + * @plugin_mask: Plugin event bitmap. Modified only via async work. * @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. @@ -428,6 +430,10 @@ struct CPUState { DECLARE_BITMAP(trace_dstate_delayed, CPU_TRACE_DSTATE_MAX_EVENTS); DECLARE_BITMAP(trace_dstate, CPU_TRACE_DSTATE_MAX_EVENTS); + DECLARE_BITMAP(plugin_mask, QEMU_PLUGIN_EV_MAX); + + GArray *plugin_mem_cbs; + /* TODO Move common fields from CPUArchState here. */ int cpu_index; int cluster_index; -- cgit v1.2.3