On 29/4/24 16:42, Richard Henderson wrote:
On 4/28/24 15:14, Philippe Mathieu-Daudé wrote:
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
  include/hw/core/cpu.h  | 22 ++++++++++------------
  include/qemu/plugin.h  |  2 +-
  accel/tcg/plugin-gen.c |  8 +++++---
  hw/core/cpu-common.c   |  2 +-
  plugins/core.c         |  8 ++++----
  5 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index beb37342e9..ef8b85b6fe 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -342,9 +342,18 @@ typedef union IcountDecr {
   * CPUNegativeOffsetState: Elements of CPUState most efficiently accessed    *                         from CPUArchState, via small negative offsets.
   * @can_do_io: True if memory-mapped IO is allowed.
+ * @plugin_mem_cbs: active plugin memory callbacks
+ * @plugin_state: per-CPU plugin state
   */
  typedef struct CPUNegativeOffsetState {
      CPUTLB tlb;
+#ifdef CONFIG_PLUGIN
+    /*
+     * The callback pointer are accessed via TCG (see gen_empty_mem_helper).
+     */
+    GArray *plugin_mem_cbs;
+    CPUPluginState *plugin_state;

While plugin_mem_cbs is accessed by tcg generated code, plugin_state is not.
I would move plugin_state to cpu->accel.

Good idea.


Reply via email to