[PATCH v14 0/8] Add additional plugin API functions to read and write memory and registers

2025-06-25 Thread Rowan Hart
ch.so only runs with the patch test. v14 addresses a build issue Alex pointed out with the patch test, and removes a few vestigial lines according to Alex's suggestion. I split this out into another commit as it's not actually coupled to the patch test. Rowan Hart (8): gdbstub: Expos

[PATCH v14 3/8] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks

2025-06-24 Thread Rowan Hart
functions (in particular, the register read and write API) will call qemu_plugin_get_cb_flags() to check the level is at least the level they require. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- accel/tcg/plugin-gen.c | 30 ++ include/hw/core/cpu.h

Re: [PATCH v13 0/7] Add additional plugin API functions to read and write memory and registers

2025-06-24 Thread Rowan Hart
make[1]: *** No rule to make target 'patch-target', needed by 'run-plugin-patch-target-with-libpatch.so'. Stop. make: *** [/home/alex/lsrc/qemu.git/tests/Makefile.include:56: run-tcg-tests-x86_64-softmmu] Error 2 You need to ensure vpath is set, something like: Thanks for the note Alex.

[PATCH v14 1/8] gdbstub: Expose gdb_write_register function to consumers of gdbstub

2025-06-24 Thread Rowan Hart
This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Reviewed-by: Alex Bennée Reviewed-by: Julian Ganz Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- gdbstub/gdbstub.c

[PATCH v14 5/8] plugins: Add memory hardware address read/write API

2025-06-24 Thread Rowan Hart
specified address space, for example to facilitate architecture-specific plugins that want to operate on them, for example reading ARM secure memory. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 93 plugins/api.c

[PATCH v14 6/8] tests/tcg: Remove copy-pasted notes and from i386 and add x86_64 system tests to tests

2025-06-24 Thread Rowan Hart
The x86_64-softmmu Makefile seems to have been copy-pasted from the i386 Makefile at some point in the past. Cleaning up a vestigial unused variable and removing some outdated comments. Signed-off-by: Rowan Hart --- tests/tcg/x86_64/Makefile.softmmu-target | 12 +--- 1 file changed, 5

[PATCH v14 4/8] plugins: Add memory virtual address write API

2025-06-24 Thread Rowan Hart
ntext of the plugin. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 21 + plugins/api.c | 18 ++ 2 files changed, 39 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h

[PATCH v14 8/8] plugins: Update plugin version and add notes

2025-06-24 Thread Rowan Hart
This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/qemu/qemu-plugin.h b

[PATCH v14 7/8] plugins: Add patcher plugin and test

2025-06-24 Thread Rowan Hart
-off-by: Rowan Hart --- tests/tcg/Makefile.target | 7 +- tests/tcg/plugins/meson.build | 2 +- tests/tcg/plugins/patch.c | 241 ++ tests/tcg/x86_64/Makefile.softmmu-target | 7 + tests/tcg/x86_64/system/patch-target.c| 22

[PATCH v14 2/8] plugins: Add register write API

2025-06-24 Thread Rowan Hart
This patch adds a function to the plugins API to allow plugins to write register contents. It also moves the qemu_plugin_read_register function so all the register-related functions are grouped together in the file. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu

Re: [PATCH v12 0/7] Add additional plugin API functions to read and write memory and registers

2025-06-19 Thread Rowan Hart
I've updated this patch to address some notes about the build/test configuration for the patch plugin. Please check https://lore.kernel.org/qemu-devel/20250619161547.1401448-1-rowanbh...@gmail.com/T/#t instead. On 6/11/25 4:24 PM, Rowan Hart wrote: This patch series adds several ne

[PATCH v13 0/7] Add additional plugin API functions to read and write memory and registers

2025-06-19 Thread Rowan Hart
ch.so only runs with the patch test. Rowan Hart (1): plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks novafacing (6): gdbstub: Expose gdb_write_register function to consumers of gdbstub plugins: Add register write API plugins: Add memory virtual address write

[PATCH v13 7/7] plugins: Update plugin version and add notes

2025-06-19 Thread Rowan Hart
From: novafacing This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include

[PATCH v13 3/7] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks

2025-06-19 Thread Rowan Hart
functions (in particular, the register read and write API) will call qemu_plugin_get_cb_flags() to check the level is at least the level they require. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- accel/tcg/plugin-gen.c | 30 ++ include/hw/core/cpu.h

[PATCH v13 5/7] plugins: Add memory hardware address read/write API

2025-06-19 Thread Rowan Hart
to permit a specified address space, for example to facilitate architecture-specific plugins that want to operate on them, for example reading ARM secure memory. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 93

[PATCH v13 1/7] gdbstub: Expose gdb_write_register function to consumers of gdbstub

2025-06-19 Thread Rowan Hart
From: novafacing This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Reviewed-by: Alex Bennée Reviewed-by: Julian Ganz Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart

[PATCH v13 6/7] plugins: Add patcher plugin and test

2025-06-19 Thread Rowan Hart
: Rowan Hart --- tests/tcg/Makefile.target | 7 +- tests/tcg/plugins/meson.build | 2 +- tests/tcg/plugins/patch.c | 241 ++ tests/tcg/x86_64/Makefile.softmmu-target | 7 + tests/tcg/x86_64/system/patch-target.c| 22 ++ tests

[PATCH v13 4/7] plugins: Add memory virtual address write API

2025-06-19 Thread Rowan Hart
x27;t currently in the context of the plugin. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 21 + plugins/api.c | 18 ++ 2 files changed, 39 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v13 2/7] plugins: Add register write API

2025-06-19 Thread Rowan Hart
From: novafacing This patch adds a function to the plugins API to allow plugins to write register contents. It also moves the qemu_plugin_read_register function so all the register-related functions are grouped together in the file. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart

Re: [PATCH v12 5/7] plugins: Add memory hardware address read/write API

2025-06-17 Thread Rowan Hart
My main concern about the long list of caveats for writing memory is the user will almost certainly cause weird things to happen which will then be hard to debug. I can see the patcher example however it would be useful to know what other practical uses this interface provides. Of course! My main

Re: [PATCH v12 0/7] Add additional plugin API functions to read and write memory and registers

2025-06-11 Thread Rowan Hart
I forgot to mention it in the cover letter but v12 also addresses Pierrick's comments to clean up the patch plug-in. Thanks for the feedback!

[PATCH v12 3/7] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks

2025-06-11 Thread Rowan Hart
functions (in particular, the register read and write API) will call qemu_plugin_get_cb_flags() to check the level is at least the level they require. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- accel/tcg/plugin-gen.c | 30 ++ include/hw/core/cpu.h

[PATCH v12 0/7] Add additional plugin API functions to read and write memory and registers

2025-06-11 Thread Rowan Hart
tested are also tested by the patcher plugin, making it redundant. We'll circle back on a hypercalls API in the future as a part of the plugin API, not as a plugin itself. Rowan Hart (1): plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks novafacing (6): gdbstub:

[PATCH v12 4/7] plugins: Add memory virtual address write API

2025-06-11 Thread Rowan Hart
x27;t currently in the context of the plugin. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 21 + plugins/api.c | 18 ++ 2 files changed, 39 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v12 2/7] plugins: Add register write API

2025-06-11 Thread Rowan Hart
From: novafacing This patch adds a function to the plugins API to allow plugins to write register contents. It also moves the qemu_plugin_read_register function so all the register-related functions are grouped together in the file. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart

[PATCH v12 6/7] plugins: Add patcher plugin and test

2025-06-11 Thread Rowan Hart
: Rowan Hart --- tests/tcg/Makefile.target | 1 + tests/tcg/plugins/meson.build | 2 +- tests/tcg/plugins/patch.c | 241 ++ tests/tcg/x86_64/Makefile.softmmu-target | 32 ++- tests/tcg/x86_64/system/patch-target.c| 27 +++ tests

[PATCH v12 1/7] gdbstub: Expose gdb_write_register function to consumers of gdbstub

2025-06-11 Thread Rowan Hart
From: novafacing This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Reviewed-by: Alex Bennée Reviewed-by: Julian Ganz Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart

[PATCH v12 7/7] plugins: Update plugin version and add notes

2025-06-11 Thread Rowan Hart
From: novafacing This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include

[PATCH v12 5/7] plugins: Add memory hardware address read/write API

2025-06-11 Thread Rowan Hart
to permit a specified address space, for example to facilitate architecture-specific plugins that want to operate on them, for example reading ARM secure memory. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 93

Re: [PATCH v11 7/8] plugins: Add hypercalls plugin and test

2025-06-11 Thread Rowan Hart
Signed-off-by: Rowan Hart ---   tests/tcg/Makefile.target |   1 +   tests/tcg/plugins/hypercalls.c    | 547 ++   tests/tcg/plugins/meson.build |   2 +-   tests/tcg/x86_64/Makefile.softmmu-target  |   6 +-   tests/tcg/x86_64

Re: [PATCH v10 0/8] Add additional plugin API functions to read and write memory and registers

2025-06-09 Thread Rowan Hart
PM, Rowan Hart wrote: This patch series adds several new API functions focused on enabling use cases around reading and writing guest memory from QEMU plugins. To support these new APIs, some utility functionality around retrieving information about address spaces is added as well. The new

Re: [PATCH v9 0/9] Add additional plugin API functions to read and write memory and registers

2025-06-09 Thread Rowan Hart
I've addressed comments by Alex and Julian WRT the new restrictions on flags for calling qemu_plugin_read/write_register by relaxing those restrictions using the same system for setting and getting the current flag state, and adding a set/clear before each callback invocation. Please check htt

[PATCH v11 0/8] Add additional plugin API functions to read and write memory and registers

2025-06-09 Thread Rowan Hart
ntation for exceptions (atexit and flush, which do not operate on a specific CPU and in which current_cpu is not set). v11 makes the cb flags functions inline and fixes a typo where cpu was asserted but current_cpu was actually accessed. Rowan Hart (1): plugins: Add enforcement of QEMU_P

[PATCH v11 5/8] plugins: Add memory hardware address read/write API

2025-06-09 Thread Rowan Hart
to permit a specified address space, for example to facilitate architecture-specific plugins that want to operate on them, for example reading ARM secure memory. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 93

[PATCH v11 7/8] plugins: Add hypercalls plugin and test

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds a plugin that implements a simple form of hypercalls from guest code to the plugin by using the register read API. It accepts only one hypercall, which writes a magic value to guest memory. Signed-off-by: Rowan Hart --- tests/tcg/Makefile.target

[PATCH v11 8/8] plugins: Update plugin version and add notes

2025-06-09 Thread Rowan Hart
From: novafacing This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v11 3/8] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks

2025-06-09 Thread Rowan Hart
functions (in particular, the register read and write API) will call qemu_plugin_get_cb_flags() to check the level is at least the level they require. Signed-off-by: Rowan Hart --- accel/tcg/plugin-gen.c | 30 ++ include/hw/core/cpu.h | 1 + include/qemu/plugin.h

[PATCH v11 6/8] plugins: Add patcher plugin and test

2025-06-09 Thread Rowan Hart
: Rowan Hart --- tests/tcg/Makefile.target | 1 + tests/tcg/plugins/meson.build | 2 +- tests/tcg/plugins/patch.c | 297 ++ tests/tcg/x86_64/Makefile.softmmu-target | 32 ++- tests/tcg/x86_64/system/patch-target.c| 27 ++ tests

[PATCH v11 4/8] plugins: Add memory virtual address write API

2025-06-09 Thread Rowan Hart
x27;t currently in the context of the plugin. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 21 + plugins/api.c | 18 ++ 2 files changed, 39 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v11 2/8] plugins: Add register write API

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds a function to the plugins API to allow plugins to write register contents. It also moves the qemu_plugin_read_register function so all the register-related functions are grouped together in the file. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart

[PATCH v11 1/8] gdbstub: Expose gdb_write_register function to consumers of gdbstub

2025-06-09 Thread Rowan Hart
From: novafacing This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Reviewed-by: Alex Bennée Reviewed-by: Julian Ganz Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart

[PATCH v10 3/8] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks

2025-06-09 Thread Rowan Hart
functions (in particular, the register read and write API) will call qemu_plugin_get_cb_flags() to check the level is at least the level they require. Signed-off-by: Rowan Hart --- accel/tcg/plugin-gen.c | 30 + include/hw/core/cpu.h | 1 + include/qemu/plugin.h

[PATCH v10 2/8] plugins: Add register write API

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds a function to the plugins API to allow plugins to write register contents. It also moves the qemu_plugin_read_register function so all the register-related functions are grouped together in the file. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart

[PATCH v10 5/8] plugins: Add memory hardware address read/write API

2025-06-09 Thread Rowan Hart
to permit a specified address space, for example to facilitate architecture-specific plugins that want to operate on them, for example reading ARM secure memory. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 93

[PATCH v10 7/8] plugins: Add hypercalls plugin and test

2025-06-09 Thread Rowan Hart
From: novafacing This patch adds a plugin that implements a simple form of hypercalls from guest code to the plugin by using the register read API. It accepts only one hypercall, which writes a magic value to guest memory. Signed-off-by: Rowan Hart --- tests/tcg/Makefile.target

[PATCH v10 4/8] plugins: Add memory virtual address write API

2025-06-09 Thread Rowan Hart
x27;t currently in the context of the plugin. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 21 + plugins/api.c | 18 ++ 2 files changed, 39 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v10 6/8] plugins: Add patcher plugin and test

2025-06-09 Thread Rowan Hart
: Rowan Hart --- tests/tcg/Makefile.target | 1 + tests/tcg/plugins/meson.build | 2 +- tests/tcg/plugins/patch.c | 297 ++ tests/tcg/x86_64/Makefile.softmmu-target | 32 ++- tests/tcg/x86_64/system/patch-target.c| 27 ++ tests

[PATCH v10 0/8] Add additional plugin API functions to read and write memory and registers

2025-06-09 Thread Rowan Hart
ntation for exceptions (atexit and flush, which do not operate on a specific CPU and in which current_cpu is not set). Rowan Hart (1): plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks novafacing (7): gdbstub: Expose gdb_write_register function to consumers of g

[PATCH v10 1/8] gdbstub: Expose gdb_write_register function to consumers of gdbstub

2025-06-09 Thread Rowan Hart
From: novafacing This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Reviewed-by: Alex Bennée Reviewed-by: Julian Ganz Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart

[PATCH v10 8/8] plugins: Update plugin version and add notes

2025-06-09 Thread Rowan Hart
From: novafacing This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

Re: [PATCH v9 3/9] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks

2025-06-09 Thread Rowan Hart
> > However, it should be safe at least for a subset of those callbacks and I believe there are very valid use-cases for allowing such usage. For > example, we are currently working on a plugin API exposing traps. In > those callbacks, users may want to peek at some registers such as > "ecause" an

[PATCH v9 5/9] plugins: Add memory hardware address read/write API

2025-06-08 Thread Rowan Hart
to permit a specified address space, for example to facilitate architecture-specific plugins that want to operate on them, for example reading ARM secure memory. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 93

Re: [PATCH v8 0/9] Add additional plugin API functions to read and write memory and registers

2025-06-08 Thread Rowan Hart
I added another update I missed to v9, so please disregard this version and check https://lore.kernel.org/qemu-devel/20250608230819.3382527-1-rowanbh...@gmail.com/T/#t instead. -Rowan

[PATCH v9 7/9] plugins: Add hypercalls plugin and test

2025-06-08 Thread Rowan Hart
From: novafacing This patch adds a plugin that implements a simple form of hypercalls from guest code to the plugin by using the register read API. It accepts only one hypercall, which writes a magic value to guest memory. Signed-off-by: Rowan Hart --- tests/tcg/Makefile.target

[PATCH v9 8/9] plugins: Remove use of qemu_plugin_read_register where it is not permitted

2025-06-08 Thread Rowan Hart
flags are enforced and qemu_plugin_read_register can no longer be called from a vcpu_init callback because it does not request the QEMU_PLUGIN_CB_ flag (nor does it have a mechanism to do so). Signed-off-by: Rowan Hart --- tests/tcg/plugins/insn.c | 22 +- 1 file changed, 1

[PATCH v9 9/9] plugins: Update plugin version and add notes

2025-06-08 Thread Rowan Hart
From: novafacing This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v9 6/9] plugins: Add patcher plugin and test

2025-06-08 Thread Rowan Hart
: Rowan Hart --- tests/tcg/Makefile.target | 1 + tests/tcg/plugins/meson.build | 2 +- tests/tcg/plugins/patch.c | 297 ++ tests/tcg/x86_64/Makefile.softmmu-target | 32 ++- tests/tcg/x86_64/system/patch-target.c| 27 ++ tests

[PATCH v9 3/9] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks

2025-06-08 Thread Rowan Hart
functions (in particular, the register read and write API) will call qemu_plugin_get_cb_flags() to check the level is at least the level they require. Signed-off-by: Rowan Hart --- accel/tcg/plugin-gen.c | 30 ++ include/hw/core/cpu.h | 1 + include/qemu/plugin.h

[PATCH v9 0/9] Add additional plugin API functions to read and write memory and registers

2025-06-08 Thread Rowan Hart
ixes qemu_plugin_read_register to return -1 on parameter or flag state error instead of 0. Rowan Hart (2): plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks plugins: Remove use of qemu_plugin_read_register where it is not permitted novafacing (7): gdbs

[PATCH v9 4/9] plugins: Add memory virtual address write API

2025-06-08 Thread Rowan Hart
x27;t currently in the context of the plugin. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 21 + plugins/api.c | 18 ++ 2 files changed, 39 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v9 1/9] gdbstub: Expose gdb_write_register function to consumers of gdbstub

2025-06-08 Thread Rowan Hart
From: novafacing This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Reviewed-by: Alex Bennée Reviewed-by: Julian Ganz Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart

[PATCH v9 2/9] plugins: Add register write API

2025-06-08 Thread Rowan Hart
From: novafacing This patch adds a function to the plugins API to allow plugins to write register contents. It also moves the qemu_plugin_read_register function so all the register-related functions are grouped together in the file. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart

[PATCH v8 8/9] plugins: Remove use of qemu_plugin_read_register where it is not permitted

2025-06-08 Thread Rowan Hart
flags are enforced and qemu_plugin_read_register can no longer be called from a vcpu_init callback because it does not request the QEMU_PLUGIN_CB_ flag (nor does it have a mechanism to do so). Signed-off-by: Rowan Hart --- tests/tcg/plugins/insn.c | 22 +- 1 file changed, 1

[PATCH v8 6/9] plugins: Add patcher plugin and test

2025-06-08 Thread Rowan Hart
: Rowan Hart --- tests/tcg/Makefile.target | 1 + tests/tcg/plugins/meson.build | 2 +- tests/tcg/plugins/patch.c | 297 ++ tests/tcg/x86_64/Makefile.softmmu-target | 32 ++- tests/tcg/x86_64/system/patch-target.c| 27 ++ tests

[PATCH v8 9/9] plugins: Update plugin version and add notes

2025-06-08 Thread Rowan Hart
From: novafacing This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v8 2/9] plugins: Add register write API

2025-06-08 Thread Rowan Hart
From: novafacing This patch adds a function to the plugins API to allow plugins to write register contents. It also moves the qemu_plugin_read_register function so all the register-related functions are grouped together in the file. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart

[PATCH v8 0/9] Add additional plugin API functions to read and write memory and registers

2025-06-08 Thread Rowan Hart
a formatting pass, I left some whitespace that needed removal, some license text was wrong, and so forth. v8 reverts a mistake I made extending the size of arrays of TCGHelperInfo structs, as I misunderstood their sizes. It preserves adding an explicit zero as the last entry for clarity, however.

[PATCH v8 3/9] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks

2025-06-08 Thread Rowan Hart
functions (in particular, the register read and write API) will call qemu_plugin_get_cb_flags() to check the level is at least the level they require. Signed-off-by: Rowan Hart --- accel/tcg/plugin-gen.c | 30 ++ include/hw/core/cpu.h | 1 + include/qemu/plugin.h

[PATCH v8 7/9] plugins: Add hypercalls plugin and test

2025-06-08 Thread Rowan Hart
From: novafacing This patch adds a plugin that implements a simple form of hypercalls from guest code to the plugin by using the register read API. It accepts only one hypercall, which writes a magic value to guest memory. Signed-off-by: Rowan Hart --- tests/tcg/Makefile.target

[PATCH v8 4/9] plugins: Add memory virtual address write API

2025-06-08 Thread Rowan Hart
x27;t currently in the context of the plugin. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 21 + plugins/api.c | 18 ++ 2 files changed, 39 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v8 1/9] gdbstub: Expose gdb_write_register function to consumers of gdbstub

2025-06-08 Thread Rowan Hart
From: novafacing This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Reviewed-by: Alex Bennée Reviewed-by: Julian Ganz Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart

[PATCH v8 5/9] plugins: Add memory hardware address read/write API

2025-06-08 Thread Rowan Hart
to permit a specified address space, for example to facilitate architecture-specific plugins that want to operate on them, for example reading ARM secure memory. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 93

Re: [PATCH v7 3/9] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks

2025-06-02 Thread Rowan Hart
@@ -437,6 +437,10 @@ int qemu_plugin_read_register(struct qemu_plugin_register *reg, GByteArray *buf)   {   g_assert(current_cpu);   +    if (qemu_plugin_get_cb_flags() == QEMU_PLUGIN_CB_NO_REGS) { +    return -1; +    } +   return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT

[PATCH v7 5/9] plugins: Add memory hardware address read/write API

2025-06-02 Thread Rowan Hart
to permit a specified address space, for example to facilitate architecture-specific plugins that want to operate on them, for example reading ARM secure memory. Signed-off-by: novafacing Signed-off-by: Rowan Hart Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu

[PATCH v7 0/9] Add additional plugin API functions to read and write memory and registers

2025-06-02 Thread Rowan Hart
a formatting pass, I left some whitespace that needed removal, some license text was wrong, and so forth. Rowan Hart (2): plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks plugins: Remove use of qemu_plugin_read_register where it is not permitted nov

[PATCH v7 4/9] plugins: Add memory virtual address write API

2025-06-02 Thread Rowan Hart
x27;t currently in the context of the plugin. Signed-off-by: novafacing Signed-off-by: Rowan Hart Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 21 + plugins/api.c | 18 ++ 2 files changed, 39 insertions(+)

[PATCH v7 1/9] gdbstub: Expose gdb_write_register function to consumers of gdbstub

2025-06-02 Thread Rowan Hart
From: novafacing This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Signed-off-by: novafacing Signed-off-by: Rowan Hart Reviewed-by: Alex Benée Reviewed-by: Julian Ganz Reviewed

[PATCH v7 8/9] plugins: Remove use of qemu_plugin_read_register where it is not permitted

2025-06-02 Thread Rowan Hart
flags are enforced and qemu_plugin_read_register can no longer be called from a vcpu_init callback because it does not request the QEMU_PLUGIN_CB_ flag (nor does it have a mechanism to do so). Signed-off-by: Rowan Hart --- tests/tcg/plugins/insn.c | 22 +- 1 file changed, 1

[PATCH v7 7/9] plugins: Add hypercalls plugin and test

2025-06-02 Thread Rowan Hart
From: novafacing This patch adds a plugin that implements a simple form of hypercalls from guest code to the plugin by using the register read API. It accepts only one hypercall, which writes a magic value to guest memory. Signed-off-by: novafacing Signed-off-by: Rowan Hart --- tests/tcg

[PATCH v7 9/9] plugins: Update plugin version and add notes

2025-06-02 Thread Rowan Hart
From: novafacing This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v7 3/9] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks

2025-06-02 Thread Rowan Hart
functions (in particular, the register read and write API) will call qemu_plugin_get_cb_flags() to check the level is at least the level they require. Signed-off-by: Rowan Hart --- accel/tcg/plugin-gen.c | 30 ++ include/hw/core/cpu.h | 1 + include/qemu/plugin.h

[PATCH v7 6/9] plugins: Add patcher plugin and test

2025-06-02 Thread Rowan Hart
: novafacing Signed-off-by: Rowan Hart --- tests/tcg/Makefile.target | 1 + tests/tcg/plugins/meson.build | 2 +- tests/tcg/plugins/patch.c | 297 ++ tests/tcg/x86_64/Makefile.softmmu-target | 32 ++- tests/tcg/x86_64/system/patch

[PATCH v7 2/9] plugins: Add register write API

2025-06-02 Thread Rowan Hart
From: novafacing This patch adds a function to the plugins API to allow plugins to write register contents. It also moves the qemu_plugin_read_register function so all the register-related functions are grouped together in the file. Signed-off-by: novafacing Signed-off-by: Rowan Hart Reviewed

[PATCH v6 5/9] plugins: Add memory hardware address read/write API

2025-06-01 Thread Rowan Hart
to permit a specified address space, for example to facilitate architecture-specific plugins that want to operate on them, for example reading ARM secure memory. Signed-off-by: novafacing Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 93 plugins

[PATCH v5 1/9] gdbstub: Expose gdb_write_register function to consumers of gdbstub

2025-06-01 Thread Rowan Hart
From: novafacing This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Signed-off-by: novafacing Signed-off-by: Rowan Hart --- gdbstub/gdbstub.c | 2 +- include/exec/gdbstub.h

[PATCH v6 6/9] plugins: Add patcher plugin and test

2025-06-01 Thread Rowan Hart
: novafacing Signed-off-by: Rowan Hart --- tests/tcg/Makefile.target | 1 + tests/tcg/plugins/meson.build | 2 +- tests/tcg/plugins/patch.c | 297 ++ tests/tcg/x86_64/Makefile.softmmu-target | 32 ++- tests/tcg/x86_64/system/patch

[PATCH v6 1/9] gdbstub: Expose gdb_write_register function to consumers of gdbstub

2025-06-01 Thread Rowan Hart
From: novafacing This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Signed-off-by: novafacing Signed-off-by: Rowan Hart --- gdbstub/gdbstub.c | 2 +- include/exec/gdbstub.h

[PATCH v6 9/9] plugins: Update plugin version and add notes

2025-06-01 Thread Rowan Hart
From: novafacing This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v6 7/9] plugins: Add hypercalls plugin and test

2025-06-01 Thread Rowan Hart
From: novafacing This patch adds a plugin that implements a simple form of hypercalls from guest code to the plugin by using the register read API. It accepts only one hypercall, which writes a magic value to guest memory. Signed-off-by: novafacing Signed-off-by: Rowan Hart --- tests/tcg

[PATCH v6 2/9] plugins: Add register write API

2025-06-01 Thread Rowan Hart
From: novafacing This patch adds a function to the plugins API to allow plugins to write register contents. It also moves the qemu_plugin_read_register function so all the register-related functions are grouped together in the file. Signed-off-by: novafacing Signed-off-by: Rowan Hart

[PATCH v6 4/9] plugins: Add memory virtual address write API

2025-06-01 Thread Rowan Hart
x27;t currently in the context of the plugin. Signed-off-by: novafacing Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 21 + plugins/api.c | 18 ++ 2 files changed, 39 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v6 3/9] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks

2025-06-01 Thread Rowan Hart
functions (in particular, the register read and write API) will call qemu_plugin_get_cb_flags() to check the level is at least the level they require. Signed-off-by: Rowan Hart --- accel/tcg/plugin-gen.c | 30 ++ include/hw/core/cpu.h | 1 + include/qemu/plugin.h

[PATCH v6 0/9] Add additional plugin API functions to read and write memory and registers

2025-06-01 Thread Rowan Hart
a formatting pass, I left some whitespace that needed removal, some license text was wrong, and so forth. Rowan Hart (2): plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks plugins: Remove use of qemu_plugin_read_register where it is not permitted nov

[PATCH v5 4/9] plugins: Add memory virtual address write API

2025-06-01 Thread Rowan Hart
x27;t currently in the context of the plugin. Signed-off-by: novafacing Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 21 + plugins/api.c | 18 ++ 2 files changed, 39 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v5 5/9] plugins: Add memory hardware address read/write API

2025-06-01 Thread Rowan Hart
to permit a specified address space, for example to facilitate architecture-specific plugins that want to operate on them, for example reading ARM secure memory. Signed-off-by: novafacing Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 93 plugins

[PATCH v5 7/9] plugins: Add hypercalls plugin and test

2025-06-01 Thread Rowan Hart
From: novafacing This patch adds a plugin that implements a simple form of hypercalls from guest code to the plugin by using the register read API. It accepts only one hypercall, which writes a magic value to guest memory. Signed-off-by: novafacing Signed-off-by: Rowan Hart --- tests/tcg

[PATCH v6 8/9] plugins: Remove use of qemu_plugin_read_register where it is not permitted

2025-06-01 Thread Rowan Hart
flags are enforced and qemu_plugin_read_register can no longer be called from a vcpu_init callback because it does not request the QEMU_PLUGIN_CB_ flag (nor does it have a mechanism to do so). Signed-off-by: Rowan Hart --- tests/tcg/plugins/insn.c | 22 +- 1 file changed, 1

[PATCH v5 9/9] plugins: Update plugin version and add notes

2025-06-01 Thread Rowan Hart
From: novafacing This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Signed-off-by: Rowan Hart --- include/qemu/qemu-plugin.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu

[PATCH v5 0/9] Add additional plugin API functions to read and write memory and registers

2025-06-01 Thread Rowan Hart
rsions of these functions in the future if we change our minds! For v4, I've just updated the enforcement of the QEMU_PLUGIN_CB_ flags to just use immediate stores, which simplifies the implementation quite a lot and should be more efficient too. Thanks Pierrick for the suggestion!

[PATCH v5 6/9] plugins: Add patcher plugin and test

2025-06-01 Thread Rowan Hart
: novafacing Signed-off-by: Rowan Hart --- tests/tcg/Makefile.target | 1 + tests/tcg/plugins/meson.build | 2 +- tests/tcg/plugins/patch.c | 302 ++ tests/tcg/x86_64/Makefile.softmmu-target | 32 ++- tests/tcg/x86_64/system/patch

  1   2   >