[PATCH] tcg-plugins: add a hook for interrupts, exceptions and traps

2023-10-21 Thread Julian Ganz
. Signed-off-by: Julian Ganz --- accel/tcg/cpu-exec.c | 3 +++ include/qemu/plugin-event.h | 1 + include/qemu/plugin.h| 4 include/qemu/qemu-plugin.h | 11 +++ plugins/core.c | 12 plugins/qemu-plugins.symbols | 1 + 6 files changed

Re: [PATCH] tcg-plugins: add a hook for interrupts, exceptions and traps

2023-10-23 Thread Julian Ganz
+0100 Alex Bennée wrote: > > Julian Ganz writes: > > > Some analysis greatly benefits, or depends on, information about > > interrupts. For example, we may need to handle the execution of a > > new translation block differently if it is not the result of normal >

[RFC PATCH v2 1/7] plugins: add API for registering trap related callbacks

2024-10-19 Thread Julian Ganz
different architectures the callbacks are `qemu_plugin_vcpu_simple_cb_t`. That is, they only receive the VCPU id and may need to call other API functions for retrieving additional information. Signed-off-by: Julian Ganz --- include/qemu/plugin-event.h | 3 +++ include/qemu/qemu-plugi

[RFC PATCH v2 4/7] target/arm: call plugin trap callbacks

2024-10-19 Thread Julian Ganz
the (V)IRQ, (VI/VF)NMI, (V)FIQ and VSERR exceptions as interrupts since they are, presumably, async in nature. Signed-off-by: Julian Ganz --- target/arm/helper.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/target/arm/helper.c b/target/arm/helper.c index 0a731a38e8

[RFC PATCH v2 0/7] tcg-plugins: add hooks for interrupts, exceptions and traps

2024-10-19 Thread Julian Ganz
into multiple callbacks - Added a target-agnostic definition of the relevant event(s) - Call hooks from architecture-code rather than accel/tcg/cpu-exec.c - Added a plugin showcasing API usage Julian Ganz (7): plugins: add API for registering trap related callbacks plugins: add hooks fo

[RFC PATCH v2 6/7] target/riscv: call plugin trap callbacks

2024-10-19 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for RISC-V targets. Signed-off-by: Julian Ganz

[RFC PATCH v2 5/7] target/avr: call plugin trap callbacks

2024-10-19 Thread Julian Ganz
only know interrupts. Signed-off-by: Julian Ganz --- target/avr/helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/avr/helper.c b/target/avr/helper.c index 345708a1b3..be94552674 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -28,6 +28,7 @@ #include "

[RFC PATCH v2 7/7] target/sparc: call plugin trap callbacks

2024-10-19 Thread Julian Ganz
interrupt other than EXTINT and IVEC as exceptions as they appear to be synchroneous events. Also note that SPARC targets do not have semihosting events. Signed-off-by: Julian Ganz --- target/sparc/int32_helper.c | 7 +++ target/sparc/int64_helper.c | 10 ++ 2 files changed, 17

[RFC PATCH v2 2/7] plugins: add hooks for new trap related callbacks

2024-10-19 Thread Julian Ganz
corresponding hooks called from target specific code inside qemu. Signed-off-by: Julian Ganz --- include/qemu/plugin.h | 12 plugins/core.c| 24 2 files changed, 36 insertions(+) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index

[RFC PATCH v2 3/7] contrib/plugins: add plugin showcasing new trap related API

2024-10-19 Thread Julian Ganz
00..2a38dbb8b3 --- /dev/null +++ b/contrib/plugins/traps.c @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2024, Julian Ganz + * + * Traps - count traps + * + * License: GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include + +#include + +QEMU_PLUGIN_EXPORT

Re: [RFC PATCH v2 3/7] contrib/plugins: add plugin showcasing new trap related API

2024-10-21 Thread Julian Ganz
October 21, 2024 at 8:07 PM, "Pierrick Bouvier" wrote: > On 10/19/24 09:39, Julian Ganz wrote: > > + max_vcpus = info->system.max_vcpus; > > + traps = calloc(max_vcpus, sizeof(TrapCounters)); > > > Instead of allocating data for max number of vcpu, you can u

Re: [RFC PATCH v2 4/7] target/arm: call plugin trap callbacks

2024-10-21 Thread Julian Ganz
Thanks for the quick reply! October 21, 2024 at 2:58 PM, Peter Maydell wrote: > This omits M-profile Arm CPUs (whose interrupt/exception > handling is rather more complicated, and lives in > m_helper.c.) Yes, I forgot about the M-profile. I'll include those changes wiith the next patch-series. >

Re: [RFC PATCH v2 0/7] tcg-plugins: add hooks for interrupts, exceptions and traps

2024-10-21 Thread Julian Ganz
Hi, Pierrick, October 21, 2024 at 8:00 PM, "Pierrick Bouvier" wrote: > I agree it would be useful. Beyond the scope of this series, it would be > nice if we could add a control flow related API instead of asking to > plugins to do it themselves. > > If we would provide something like this, is t

Re: [RFC PATCH v2 0/7] tcg-plugins: add hooks for interrupts, exceptions and traps

2024-10-22 Thread Julian Ganz
Hi, Alex, October 22, 2024 at 10:58 AM, "Alex Bennée" wrote: > How easy would it be to expose a Rust API? I'm curious because now we > are looking to integrate Rust into QEMU we could consider transitioning > to a Rust API for plugins. It has been done before: > > https://github.com/novafacing/q

Re: [RFC PATCH v2 0/7] tcg-plugins: add hooks for interrupts, exceptions and traps

2024-10-22 Thread Julian Ganz
Hi, Pierrick, October 21, 2024 at 11:59 PM, "Pierrick Bouvier" wrote: > On 10/21/24 14:02, Julian Ganz wrote: > > The motivation for this API is a plugin that simulates a RISC-V tracing > > unit (and produces a trace). For that we actually also needed to > > t

Re: [RFC PATCH v2 0/7] tcg-plugins: add hooks for interrupts, exceptions and traps

2024-10-23 Thread Julian Ganz
Hi, Pierrick, October 23, 2024 at 5:16 PM, "Pierrick Bouvier" wrote: > > Hi Julian, > > On 10/23/24 05:56, Julian Ganz wrote: > > > October 22, 2024 at 11:15 PM, "Pierrick Bouvier" wrote: > > > > > > > > On 10/22/24 01:21, J

Re: [RFC PATCH v2 0/7] tcg-plugins: add hooks for interrupts, exceptions and traps

2024-10-23 Thread Julian Ganz
Hi, Pierrick, resent as I was too stupid to hit reply instead of reply-all. October 22, 2024 at 11:15 PM, "Pierrick Bouvier" wrote: > > On 10/22/24 01:21, Julian Ganz wrote: > > > > > Hi, Pierrick, > > October 21, 2024 at 11:59 PM, "Pierrick Bouvie

Re: [RFC PATCH v2 0/7] tcg-plugins: add hooks for interrupts, exceptions and traps

2024-10-23 Thread Julian Ganz
Hi, Pierrick, October 23, 2024 at 6:39 PM, "Pierrick Bouvier" wrote: > > So we could have something like: > > /* plugin side */ > void on_cf_event(qemu_plugin_cf_event_type, uint64_t from, uint64_t to) { > ... > } We also need the VCPU id, but yes. > /* API side */ > void qemu_plugin_register

[RFC PATCH v3 06/11] target/arm: call plugin trap callbacks

2024-12-02 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for ARM (and Aarch64) targets. We decided to treat th

[RFC PATCH v3 02/11] plugins: add API for registering discontinuity callbacks

2024-12-02 Thread Julian Ganz
The plugin API allows registration of callbacks for a variety of VCPU related events, such as VCPU reset, idle and resume. In addition to those events, we recently defined discontinuity events, which include traps. This change introduces a function to register callbacks for these events. We define

[RFC PATCH v3 07/11] target/avr: call plugin trap callbacks

2024-12-02 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places the hook for AVR targets. That architecture appears to only

[RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc

2024-12-02 Thread Julian Ganz
/discons.c new file mode 100644 index 00..54e52f563a --- /dev/null +++ b/tests/tcg/plugins/discons.c @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2024, Julian Ganz + * + * License: GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ +#include + +#include

[RFC PATCH v3 10/11] target/sparc: call plugin trap callbacks

2024-12-02 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for SPARC (32bit and 64bit) targets. We treat any int

[RFC PATCH v3 08/11] target/mips: call plugin trap callbacks

2024-12-02 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for MIPS targets. --- target/mips/tcg/sysemu/tlb_hel

[RFC PATCH v3 05/11] target/alpha: call plugin trap callbacks

2024-12-02 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for Alpha targets. --- target/alpha/helper.c | 12 ++

[RFC PATCH v3 01/11] plugins: add types for callbacks related to certain discontinuities

2024-12-02 Thread Julian Ganz
The plugin API allows registration of callbacks for a variety of VCPU related events, such as VCPU reset, idle and resume. However, traps of any kind, i.e. interrupts or exceptions, were previously not covered. These kinds of events are arguably quite significant and usually go hand in hand with a

[RFC PATCH v3 00/11] tcg-plugins: add hooks for discontinuities

2024-12-02 Thread Julian Ganz
Since v1: - Split the one callback into multiple callbacks - Added a target-agnostic definition of the relevant event(s) - Call hooks from architecture-code rather than accel/tcg/cpu-exec.c - Added a plugin showcasing API usage Julian Ganz (11): plugins: add types for callbacks relat

[RFC PATCH v3 03/11] plugins: add hooks for new discontinuity related callbacks

2024-12-02 Thread Julian Ganz
The plugin API allows registration of callbacks for a variety of VCPU related events, such as VCPU reset, idle and resume. In addition, we recently introduced API for registering callbacks for discontinuity events, specifically for interrupts, exceptions and host calls. This change introduces the

[RFC PATCH v3 09/11] target/riscv: call plugin trap callbacks

2024-12-02 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for RISC-V targets. --- target/riscv/cpu_helper.c |

[RFC PATCH v3 04/11] contrib/plugins: add plugin showcasing new dicontinuity related API

2024-12-02 Thread Julian Ganz
#x27;lockstep' diff --git a/contrib/plugins/traps.c b/contrib/plugins/traps.c new file mode 100644 index 00..ecd4beac5f --- /dev/null +++ b/contrib/plugins/traps.c @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2024, Julian Ganz + * + * Traps - count traps + * + * License: GNU GPL, version 2 or later

Re: [RFC PATCH v3 00/11] tcg-plugins: add hooks for discontinuities

2024-12-03 Thread Julian Ganz
Hi, I just realized that I forgot to run the checkpatch script on the patches again before sending and did not include the Sign-Off. Sorry about that. Regards, Julian Ganz

Re: [RFC PATCH v3 01/11] plugins: add types for callbacks related to certain discontinuities

2024-12-03 Thread Julian Ganz
Hi, December 2, 2024 at 8:26 PM, "Julian Ganz" wrote: > diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h > index 0fba36ae02..9c67374b7e 100644 > --- a/include/qemu/qemu-plugin.h > +++ b/include/qemu/qemu-plugin.h > @@ -154,

Re: [RFC PATCH v3 01/11] plugins: add types for callbacks related to certain discontinuities

2024-12-05 Thread Julian Ganz
Hi Pierrick, December 4, 2024 at 11:41 PM, "Pierrick Bouvier" wrote: > On 12/3/24 00:45, Julian Ganz wrote: > > > > > Hi, > > December 2, 2024 at 8:26 PM, "Julian Ganz" wrote: > > > > > > > > diff --git a/include/qem

Re: [RFC PATCH v3 01/11] plugins: add types for callbacks related to certain discontinuities

2024-12-05 Thread Julian Ganz
Hi Pierrick, December 4, 2024 at 11:45 PM, "Pierrick Bouvier" wrote: > On 12/2/24 11:26, Julian Ganz wrote: > > include/qemu/plugin.h | 1 + > > include/qemu/qemu-plugin.h | 43 ++ > > 2 files changed, 44 insertions(+) > >

Re: [RFC PATCH v3 04/11] contrib/plugins: add plugin showcasing new dicontinuity related API

2024-12-05 Thread Julian Ganz
Hi Pierrick, December 5, 2024 at 12:14 AM, "Pierrick Bouvier" wrote: > On 12/2/24 11:26, Julian Ganz wrote: > > +typedef struct { > > + uint64_t interrupts; > > + uint64_t exceptions; > > + uint64_t hostcalls; > > + bool active; > > &g

Re: [RFC PATCH v3 01/11] plugins: add types for callbacks related to certain discontinuities

2024-12-05 Thread Julian Ganz
Hi Pierrick, December 5, 2024 at 10:50 PM, "Julian Ganz" wrote: > December 5, 2024 at 6:56 PM, "Pierrick Bouvier" wrote: > > Let's try to move forward, and solve the problems we have with from_pc. The > > testing part can be solved already (as explain

Re: [RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc

2024-12-06 Thread Julian Ganz
Hi Pierrick, December 5, 2024 at 11:28 PM, "Pierrick Bouvier" wrote: > On 12/5/24 13:22, Julian Ganz wrote: > > December 5, 2024 at 6:30 PM, "Pierrick Bouvier" wrote: > > > We can store the next_expected pc for each instruction (from > > > curre

Re: [RFC PATCH v3 01/11] plugins: add types for callbacks related to certain discontinuities

2024-12-06 Thread Julian Ganz
Hi Pierrick, December 6, 2024 at 12:03 AM, "Pierrick Bouvier" wrote: > On 12/5/24 13:50, Julian Ganz wrote: > > If you cannot rely on an input being a sensible value, doesn't that > > render the input useless? > > > I agree. If for a specific event it&#x

Re: [RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc

2024-12-20 Thread Julian Ganz
Hi Pierrick, December 5, 2024 at 12:33 AM, "Pierrick Bouvier" wrote: > On 12/2/24 11:41, Julian Ganz wrote: > > +static void insn_exec(unsigned int vcpu_index, void *userdata) > > +{ > > + struct cpu_state *state = qemu_plugin_scoreboard_find(states, >

Re: [RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc

2024-12-05 Thread Julian Ganz
Hi Pierrick, December 5, 2024 at 12:33 AM, "Pierrick Bouvier" wrote: > On 12/2/24 11:41, Julian Ganz wrote: > > > +/* > > + * Copyright (C) 2024, Julian Ganz > > + * > > + * License: GNU GPL, version 2 or later. > > + * S

Re: [RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc

2024-12-05 Thread Julian Ganz
Hi Pierrick, December 5, 2024 at 6:30 PM, "Pierrick Bouvier" wrote: > On 12/5/24 05:10, Julian Ganz wrote: > > December 5, 2024 at 12:33 AM, "Pierrick Bouvier" wrote: > > > Trap target PC mismatch > > > Expected: 23faf3a80 > > > Encount

Re: [RFC PATCH v3 01/11] plugins: add types for callbacks related to certain discontinuities

2024-12-05 Thread Julian Ganz
Hi Pierrick, December 5, 2024 at 6:56 PM, "Pierrick Bouvier" wrote: > On 12/5/24 04:40, Julian Ganz wrote: > > > > > Hi Pierrick, > > December 4, 2024 at 11:41 PM, "Pierrick Bouvier" wrote: > > > Does it mean that information return

Re: [RFC PATCH v3 01/11] plugins: add types for callbacks related to certain discontinuities

2024-12-05 Thread Julian Ganz
Hi Pierrick, December 5, 2024 at 6:35 PM, "Pierrick Bouvier" wrote: > On 12/5/24 04:44, Julian Ganz wrote: > > > > > Hi Pierrick, > > December 4, 2024 at 11:45 PM, "Pierrick Bouvier" wrote: > > > > > > > > On 12/

Re: [RFC PATCH v3 01/11] plugins: add types for callbacks related to certain discontinuities

2024-12-07 Thread Julian Ganz
Hi Pierrick, December 6, 2024 at 7:59 PM, "Pierrick Bouvier" wrote: > On 12/6/24 00:58, Julian Ganz wrote: > > December 6, 2024 at 12:03 AM, "Pierrick Bouvier" wrote: > > > It's an interesting conversation. For the scope of this series, I agree

Re: [RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc

2024-12-07 Thread Julian Ganz
Hi Richard, December 6, 2024 at 8:42 PM, "Richard Henderson" wrote: > On 12/6/24 13:02, Pierrick Bouvier wrote: > > On 12/6/24 00:42, Julian Ganz wrote: > > > IIUC qemu will schedule interrupts "opportunistically" between tb > > > executio

Re: [RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc

2024-12-07 Thread Julian Ganz
Hi Richard, December 6, 2024 at 11:56 PM, "Richard Henderson" wrote: > On 12/6/24 14:40, Pierrick Bouvier wrote: > > > > > Do we have an architecture agnostic pc representation, or do we have to add > > this for every > target in {arch}_cpu_exec_interrupt? > > > We have CPUClass.get_pc, which

Re: [PATCH 22/22] accel/tcg: also suppress asynchronous IRQs for cpu_io_recompile

2025-01-11 Thread Julian Ganz
n the block, we should also suppress IRQs. > > Signed-off-by: Alex Bennée > Cc: Richard Henderson > Cc: Julian Ganz > --- > accel/tcg/translate-all.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/accel/tcg/translate-all.c b/accel/tcg/tran

Re: [RFC PATCH v3 02/11] plugins: add API for registering discontinuity callbacks

2025-01-10 Thread Julian Ganz
Hi Alex, January 9, 2025 at 2:57 PM, "Alex Bennée" wrote: > Julian Ganz writes: > > diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h > > index 9c67374b7e..f998a465e5 100644 > > --- a/include/qemu/qemu-plugin.h > > +++ b/include/qemu

Re: [RFC PATCH v3 04/11] contrib/plugins: add plugin showcasing new dicontinuity related API

2025-01-10 Thread Julian Ganz
Hi Alex, January 9, 2025 at 3:04 PM, "Alex Bennée" wrote: > Julian Ganz writes: > > We recently introduced new plugin API for registration of discontinuity > > related callbacks. This change introduces a minimal plugin showcasing > > the new API. It simply coun

Re: [RFC PATCH v3 11/11] tests: add plugin asserting correctness of discon event's to_pc

2025-01-10 Thread Julian Ganz
Hi Alex, Sorry for tha late reply. January 9, 2025 at 5:33 PM, "Alex Bennée" wrote: > "Julian Ganz" writes: > > (Add Richard to CC) > > > > > Hi Pierrick, > > > > December 5, 2024 at 12:33 AM, "Pierrick Bouvier" wrote: >

Re: [RFC PATCH v3 01/11] plugins: add types for callbacks related to certain discontinuities

2025-01-10 Thread Julian Ganz
Hi Alex, January 9, 2025 at 2:52 PM, "Alex Bennée" wrote: > Pierrick Bouvier writes: > > On 12/2/24 11:26, Julian Ganz wrote: > > > diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h > > > index 0fba36ae02..9c67374b7e 100644 &g

Re: [PATCH v4 18/23] target/s390x: call plugin trap callbacks

2025-05-12 Thread Julian Ganz
Hi list, I messed up the last messages From-address when drafting the mail by hand. Sorry for the noise. > Hi David, > > It appears you only replied to the qemu-devel list? I just saw this when > informing a co-worker about this series. > >> On 11.05.25 15:14, Julian Ganz wr

[PATCH v4 20/23] target/xtensa: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for xtensa targets. Signed-off-by: Julian Ganz

[PATCH v4 06/23] target/arm: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
the (V)IRQ, (VI/VF)NMI, (V)FIQ and VSERR exceptions as interrupts since they are, presumably, async in nature. Signed-off-by: Julian Ganz --- target/arm/helper.c | 24 target/arm/tcg/m_helper.c | 18 ++ 2 files changed, 42 insertions(+) diff --git a

[PATCH v4 01/23] plugins: add types for callbacks related to certain discontinuities

2025-05-11 Thread Julian Ganz
ed to such events. Since possible modes and the enumeration of interupts and exceptions vary greatly between different architectures, the callback type only receives the VCPU id, the type of event as well as the old and new PC. Signed-off-by: Julian Ganz --- include/qemu/plugin.h | 1 + in

[PATCH v4 21/23] tests: add plugin asserting correctness of discon event's to_pc

2025-05-11 Thread Julian Ganz
address bits via the `compare-addr-bits` option. Signed-off-by: Julian Ganz --- tests/tcg/plugins/discons.c | 219 ++ tests/tcg/plugins/meson.build | 2 +- 2 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/plugins/discons.c diff

[PATCH v4 10/23] target/loongarch: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
special "exception" for interrupts and no host calls. Signed-off-by: Julian Ganz --- target/loongarch/cpu.c | 4 1 file changed, 4 insertions(+) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index f7535d1be7..d1ed56d15e 100644 --- a/target/loongarch/cpu.c +++ b/target

[PATCH v4 16/23] target/riscv: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for RISC-V targets. Signed-off-by: Julian Ganz

[PATCH v4 11/23] target/m68k: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for Motorola 68000 targets. Signed-off-by: Julian

[PATCH v4 07/23] target/avr: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
only know interrupts. Signed-off-by: Julian Ganz --- target/avr/helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/avr/helper.c b/target/avr/helper.c index b9cd6d5ef2..f28cc08637 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -28,6 +28,7 @@ #include "

[PATCH v4 03/23] plugins: add hooks for new discontinuity related callbacks

2025-05-11 Thread Julian Ganz
corresponding hooks called from target specific code inside qemu. Signed-off-by: Julian Ganz --- include/qemu/plugin.h | 12 ++ plugins/core.c| 53 +++ 2 files changed, 65 insertions(+) diff --git a/include/qemu/plugin.h b/include/qemu

[PATCH v4 17/23] target/rx: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for Renesas Xtreme targets. Signed-off-by: Julian

[PATCH v4 19/23] target/sparc: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
interrupt other than EXTINT and IVEC as exceptions as they appear to be synchroneous events. Signed-off-by: Julian Ganz --- target/sparc/int32_helper.c | 7 +++ target/sparc/int64_helper.c | 10 ++ 2 files changed, 17 insertions(+) diff --git a/target/sparc/int32_helper.c b/target

[PATCH v4 00/23] tcg-plugins: add hooks for discontinuities

2025-05-11 Thread Julian Ganz
ltiple callbacks - Added a target-agnostic definition of the relevant event(s) - Call hooks from architecture-code rather than accel/tcg/cpu-exec.c - Added a plugin showcasing API usage Julian Ganz (23): plugins: add types for callbacks related to certain discontinuities plugins: add AP

[PATCH v4 12/23] target/microblaze: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
special "exception" for interrupts and no host calls. Signed-off-by: Julian Ganz --- target/microblaze/helper.c | 8 1 file changed, 8 insertions(+) diff --git a/target/microblaze/helper.c b/target/microblaze/helper.c index 9203192483..27283c5dc4 100644 --- a/target/microblaz

[PATCH v4 15/23] target/ppc: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for Power PC targets. Signed-off-by: Julian Ganz

[PATCH v4 04/23] contrib/plugins: add plugin showcasing new dicontinuity related API

2025-05-11 Thread Julian Ganz
#x27;windows' # lockstep uses socket.h contrib_plugins += 'lockstep' diff --git a/contrib/plugins/traps.c b/contrib/plugins/traps.c new file mode 100644 index 00..5fa5a853ee --- /dev/null +++ b/contrib/plugins/traps.c @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2025, Julian Ganz

[PATCH v4 02/23] plugins: add API for registering discontinuity callbacks

2025-05-11 Thread Julian Ganz
define one distinct plugin event type for each type of discontinuity, granting fine control to plugins in term of which events they receive. Signed-off-by: Julian Ganz --- include/qemu/plugin-event.h | 3 +++ include/qemu/qemu-plugin.h | 16 plugins/core.c | 15

[PATCH v4 14/23] target/openrisc: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
resets, timer and device interrupts as exceptions. Signed-off-by: Julian Ganz --- target/openrisc/interrupt.c | 13 + 1 file changed, 13 insertions(+) diff --git a/target/openrisc/interrupt.c b/target/openrisc/interrupt.c index 486823094c..08f0ed9b89 100644 --- a/target/openrisc

[PATCH v4 09/23] target/i386: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places the hook for x86 targets. Signed-off-by: Julian Ganz

[PATCH v4 18/23] target/s390x: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
ogram interrupts" and service calls as exceptions. We treat external and io "exceptions" as well as resets as interrupts. Signed-off-by: Julian Ganz --- target/s390x/tcg/excp_helper.c | 8 1 file changed, 8 insertions(+) diff --git a/target/s390x/tcg/excp_helper.c b/target/s39

[PATCH v4 08/23] target/hppa: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
We identified a number of exceptions as interrupts, and we assume any unknown exception is also an interrupt. HPPA appears to not have any form of host-call. This change places the hook for PA-RISC targets. Signed-off-by: Julian Ganz --- target/hppa/int_helper.c | 44

[PATCH v4 05/23] target/alpha: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for Alpha targets. Signed-off-by: Julian Ganz

[PATCH v4 22/23] tests: add test for double-traps on rv64

2025-05-11 Thread Julian Ganz
We do have a number of test-caes for various architectures exercising their interrupt/exception logic. However, for the recently introduced trap API we also want to exercise the logic for double traps on at leat one architecture. Signed-off-by: Julian Ganz --- tests/tcg/riscv64/Makefile.softmmu

[PATCH v4 13/23] target/mips: call plugin trap callbacks

2025-05-11 Thread Julian Ganz
EXT_INTERRUPT to be asynchronous interrupts rather than exceptions. Signed-off-by: Julian Ganz --- target/mips/tcg/system/tlb_helper.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/target/mips/tcg/system/tlb_helper.c b/target/mips/tcg/system/tlb_helper.c index eccaf3624c

[PATCH v4 23/23] tests: add test with interrupted memory accesses on rv64

2025-05-11 Thread Julian Ganz
interactions on faster machines. Signed-off-by: Julian Ganz --- tests/tcg/riscv64/Makefile.softmmu-target | 6 ++ tests/tcg/riscv64/interruptedmemory.S | 67 +++ 2 files changed, 73 insertions(+) create mode 100644 tests/tcg/riscv64/interruptedmemory.S diff --git a

Re: [PATCH v3 2/8] Add register write API

2025-05-22 Thread Julian Ganz
Hi Rowan, May 22, 2025 at 5:02 PM, Rowan Hart wrote: > > Again, what was the reason for moving `qemu_plugin_read_register`? > > I moved it so it's grouped with get_registers above instead of being > separated below the memory functions. I can move it back, just seemed nicer > that way. The mov

Re: [PATCH v3 2/8] Add register write API

2025-05-22 Thread Julian Ganz
e_t len) > return true; > } > > -int qemu_plugin_read_register(struct qemu_plugin_register *reg, GByteArray > *buf) > -{ > -g_assert(current_cpu); > - > -return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1); > -} > - Again, what was the reason for moving `qemu_plugin_read_register`? Reviewed-By: Julian Ganz Regards, Julian

Re: [PATCH v3 5/8] Add memory hardware address read/write API

2025-05-22 Thread Julian Ganz
Hi Rowan, > diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h > index eff8430b4a..d4f229abd9 100644 > --- a/include/qemu/qemu-plugin.h > +++ b/include/qemu/qemu-plugin.h > @@ -1014,6 +1014,102 @@ QEMU_PLUGIN_API > bool qemu_plugin_write_memory_vaddr(uint64_t addr, >

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

2025-05-22 Thread Julian Ganz
In this case maybe one motivating the change in one or two sentences. It's obvious enough from context here, but you want at least some context when stumbling accross a commit in isolation (e.g. after consulting git blame). Reviewed-By: Julian Ganz Regards, Julian

Re: [PATCH v4 04/23] contrib/plugins: add plugin showcasing new dicontinuity related API

2025-05-13 Thread Julian Ganz
Hi Pierrick, May 13, 2025 at 12:45 AM, Pierrick Bouvier wrote: > On 5/11/25 6:13 AM, Julian Ganz wrote: > > > > > We recently introduced new plugin API for registration of discontinuity > > related callbacks. This change introduces a minimal plugin showcasing > >

Re: [PATCH v4 21/23] tests: add plugin asserting correctness of discon event's to_pc

2025-05-13 Thread Julian Ganz
Hi Pierrick, May 13, 2025 at 2:25 AM, Pierrick Bouvier wrote: > On 5/11/25 6:14 AM, Julian Ganz wrote: > > +static void vcpu_discon(qemu_plugin_id_t id, unsigned int vcpu_index, > > + enum qemu_plugin_discon_type type, uint64_t from_pc, > > + uint64_t to_pc) > >

Re: [PATCH v4 21/23] tests: add plugin asserting correctness of discon event's to_pc

2025-05-13 Thread Julian Ganz
Hi Pierrick, May 13, 2025 at 9:45 AM, Julian Ganz wrote: > May 13, 2025 at 2:25 AM, Pierrick Bouvier wrote: > > [...] > > + if (trace_all_insns) { > > + g_autoptr(GString) report = g_string_new(NULL); > > + g_string_append_printf(report, "Exec insn at %"PRI

Re: [PATCH v5 23/25] tests: add plugin asserting correctness of discon event's to_pc

2025-05-20 Thread Julian Ganz
Hi Pierrick, May 20, 2025 at 10:01 PM, Pierrick Bouvier wrote: > Regarding the issue with the same tb being mapped at different virtual > addresses, I'm ok with the current solution of comparing only page bits. > > That said, a better solution could be to compare physical addresses when a > dis

[PATCH v5 02/25] plugins: add API for registering discontinuity callbacks

2025-05-19 Thread Julian Ganz
define one distinct plugin event type for each type of discontinuity, granting fine control to plugins in term of which events they receive. Reviewed-by: Pierrick Bouvier Signed-off-by: Julian Ganz --- include/qemu/plugin-event.h | 3 +++ include/qemu/qemu-plugin.h | 16 plugins

[PATCH v5 01/25] plugins: add types for callbacks related to certain discontinuities

2025-05-19 Thread Julian Ganz
ed to such events. Since possible modes and the enumeration of interupts and exceptions vary greatly between different architectures, the callback type only receives the VCPU id, the type of event as well as the old and new PC. Reviewed-by: Pierrick Bouvier Signed-off-by: Julian Ganz --- in

[PATCH v5 21/25] target/tricore: call plugin trap callbacks

2025-05-19 Thread Julian Ganz
implemented for this target and it has no host calls. Signed-off-by: Julian Ganz --- target/tricore/op_helper.c | 5 + 1 file changed, 5 insertions(+) diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c index 9910c13f4b..9bd6ce55d1 100644 --- a/target/tricore/op_helper.c

[PATCH v5 22/25] target/xtensa: call plugin trap callbacks

2025-05-19 Thread Julian Ganz
Signed-off-by: Julian Ganz --- target/xtensa/exc_helper.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/target/xtensa/exc_helper.c b/target/xtensa/exc_helper.c index b611c9bf97..fdc522698d 100644 --- a/target/xtensa/exc_helper.c +++ b/target/xtensa/exc_helper.c @@ -32,6 +32,7 @@ #include

[PATCH v5 13/25] target/mips: call plugin trap callbacks

2025-05-19 Thread Julian Ganz
EXT_INTERRUPT to be asynchronous interrupts rather than exceptions. Signed-off-by: Julian Ganz --- target/mips/tcg/system/tlb_helper.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/target/mips/tcg/system/tlb_helper.c b/target/mips/tcg/system/tlb_helper.c index eccaf3624c

[PATCH v5 20/25] target/sparc: call plugin trap callbacks

2025-05-19 Thread Julian Ganz
interrupt other than EXTINT and IVEC as exceptions as they appear to be synchroneous events. Signed-off-by: Julian Ganz --- target/sparc/int32_helper.c | 7 +++ target/sparc/int64_helper.c | 10 ++ 2 files changed, 17 insertions(+) diff --git a/target/sparc/int32_helper.c b/target

[PATCH v5 07/25] target/avr: call plugin trap callbacks

2025-05-19 Thread Julian Ganz
only know interrupts. Signed-off-by: Julian Ganz --- target/avr/helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/avr/helper.c b/target/avr/helper.c index b9cd6d5ef2..f28cc08637 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -28,6 +28,7 @@ #include "

[PATCH v5 17/25] target/rx: call plugin trap callbacks

2025-05-19 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for Renesas Xtreme targets. Signed-off-by: Julian

[PATCH v5 15/25] target/ppc: call plugin trap callbacks

2025-05-19 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for Power PC targets. Signed-off-by: Julian Ganz

[PATCH v5 09/25] target/i386: call plugin trap callbacks

2025-05-19 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places the hook for x86 targets. Signed-off-by: Julian Ganz

[PATCH v5 16/25] target/riscv: call plugin trap callbacks

2025-05-19 Thread Julian Ganz
Barboza Reviewed-by: Alistair Francis Signed-off-by: Julian Ganz --- target/riscv/cpu_helper.c | 9 + 1 file changed, 9 insertions(+) diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index d5039f69a9..dce7e34cba 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv

[PATCH v5 10/25] target/loongarch: call plugin trap callbacks

2025-05-19 Thread Julian Ganz
special "exception" for interrupts and no host calls. Signed-off-by: Julian Ganz --- target/loongarch/cpu.c | 4 1 file changed, 4 insertions(+) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index f7535d1be7..d1ed56d15e 100644 --- a/target/loongarch/cpu.c +++ b/target

[PATCH v5 11/25] target/m68k: call plugin trap callbacks

2025-05-19 Thread Julian Ganz
We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for Motorola 68000 targets. Signed-off-by: Julian

[PATCH v5 06/25] target/arm: call plugin trap callbacks

2025-05-19 Thread Julian Ganz
the (V)IRQ, (VI/VF)NMI, (V)FIQ and VSERR exceptions as interrupts since they are, presumably, async in nature. Signed-off-by: Julian Ganz --- target/arm/helper.c | 24 target/arm/tcg/m_helper.c | 18 ++ 2 files changed, 42 insertions(+) diff --git a

[PATCH v5 00/25] tcg-plugins: add hooks for discontinuities

2025-05-19 Thread Julian Ganz
target-agnostic definition of the relevant event(s) - Call hooks from architecture-code rather than accel/tcg/cpu-exec.c - Added a plugin showcasing API usage Julian Ganz (25): plugins: add types for callbacks related to certain discontinuities plugins: add API for registering discontinuity c

[PATCH v5 14/25] target/openrisc: call plugin trap callbacks

2025-05-19 Thread Julian Ganz
resets, timer and device interrupts as exceptions. Signed-off-by: Julian Ganz --- target/openrisc/interrupt.c | 13 + 1 file changed, 13 insertions(+) diff --git a/target/openrisc/interrupt.c b/target/openrisc/interrupt.c index 486823094c..08f0ed9b89 100644 --- a/target/openrisc

  1   2   3   >