From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-ppc@nongnu.org, qemu-s390x@nongnu.org,
Richard Henderson <richard.henderson@linaro.org>,
Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>,
qemu-riscv@nongnu.org, qemu-arm@nongnu.org
Subject: Re: [PATCH v3 04/11] accel/tcg: Document cpu_exec_interrupt() callback contract
Date: Fri, 2 Oct 2026 16:37:47 +0200 [thread overview]
Message-ID: <19c91bbd-894b-4d23-86eb-00d68482aa8c@oss.qualcomm.com> (raw)
In-Reply-To: <CAFEAcA-9R6ov530pA5FV6=ECr9qj5HP7yz=O4YtyCDJDP3qc6Q@mail.gmail.com>
On 2026-09-08 18:25, Peter Maydell wrote:
> On Wed, 2 Sept 2026 at 16:21, Philippe Mathieu-Daudé
> <philmd@oss.qualcomm.com> wrote:
>>
>> Expand docstring to clarify that @interrupt_request is a bitmask,
>> the handler is called with BQL held, and document the return value
>> semantics. Fix typo in arm_cpu_exec_interrupt() documentation
>> (s/inrerrupt/interrupt).
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
>> ---
>> include/accel/tcg/cpu-ops.h | 15 ++++++++++++++-
>> target/arm/internals.h | 2 +-
>> 2 files changed, 15 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h
>> index ded7cc700df..87850402203 100644
>> --- a/include/accel/tcg/cpu-ops.h
>> +++ b/include/accel/tcg/cpu-ops.h
>> @@ -171,8 +171,21 @@ struct TCGCPUOps {
>> #else
>> /** @do_interrupt: Callback for interrupt handling. */
>> void (*do_interrupt)(CPUState *cpu);
>> - /** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */
>> +
>> + /**
>> + * @cpu_exec_interrupt: Callback for processing target-specific interrupts
>> + * @cpu: cpu context
>> + * @interrupt_request: Bitmask of pending interrupts
>> + *
>> + * Called from cpu_handle_interrupt() with the BQL held. Process the
>> + * pending interrupt according to the target specific @interrupt_request
>> + * masking rules.
>
> I think we could clarify this a little to explain what to do with
> multiple pending interrupts. How about:
>
> Identify which, if any, of the possibly multiple pending interrupts
> specified by @interrupt_request should be taken, using the target
> architecture's rules for interrupt prioritization and masking.
> If an interrupt can validly be taken, take it (by updating the
> emulated CPU state for an interrupt entry).
Does that update sound good to you?
* Called from cpu_handle_interrupt() with the BQL held. Identify which,
* if any, of the possibly multiple pending interrupts specified by
* @interrupt_request should be taken, using the target architecture's
* prioritization and masking rules. If an interrupt can be taken, update
* the emulated CPU state for interrupt entry.
With the update desc I wonder if we should rename the
helper as cpu_take_interrupt()...
> (I'm trying to get across that the function sets things up
> for execution of the interrupt handler as the next thing, it
> doesn't cause the whole interrupt handler to run. But maybe
> that's obvious enough we don't need to say so.)
>
>> + *
>> + * Returns: %true if an interrupt was processed and the next TB should
>> + * be restarted, %false to continue normal execution.
>> + */
>> bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
>> +
>> /** @cpu_exec_reset: Callback for reset in cpu_exec. */
>> void (*cpu_exec_reset)(CPUState *cpu);
>> /**
>> diff --git a/target/arm/internals.h b/target/arm/internals.h
>> index 1775835ad50..551a6b4a872 100644
>> --- a/target/arm/internals.h
>> +++ b/target/arm/internals.h
>> @@ -1248,7 +1248,7 @@ static inline const char *aarch32_mode_name(uint32_t psr)
>> }
>>
>> /**
>> - * arm_cpu_exec_interrupt(): Implementation of the cpu_exec_inrerrupt hook.
>> + * arm_cpu_exec_interrupt(): Implementation of the cpu_exec_interrupt hook.
>> */
>> bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request);
>>
>
> -- PMM
next prev parent reply other threads:[~2026-10-02 14:38 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 15:20 [PATCH v3 00/11] accel/tcg: Push BQL down into per-target do_interrupt handlers Philippe Mathieu-Daudé
2026-09-02 15:20 ` [PATCH v3 01/11] target/arm: Call arm*_cpu_do_interrupt directly instead of via TCGCPUOps Philippe Mathieu-Daudé
2026-09-02 19:52 ` Pierrick Bouvier
2026-09-08 16:09 ` Peter Maydell
2026-10-01 12:03 ` Philippe Mathieu-Daudé
2026-09-13 2:42 ` Richard Henderson
2026-09-02 15:20 ` [PATCH v3 03/11] target/i386: Rename fake_do_interrupt to fake_user_exception Philippe Mathieu-Daudé
2026-09-13 2:44 ` Richard Henderson
2026-09-02 15:20 ` [PATCH v3 04/11] accel/tcg: Document cpu_exec_interrupt() callback contract Philippe Mathieu-Daudé
2026-09-08 16:25 ` Peter Maydell
2026-10-02 14:37 ` Philippe Mathieu-Daudé [this message]
2026-10-02 14:46 ` Peter Maydell
2026-10-02 15:07 ` Philippe Mathieu-Daudé
2026-09-02 15:20 ` [PATCH v3 05/11] accel/tcg: Document do_interrupt() " Philippe Mathieu-Daudé
2026-09-02 19:54 ` Pierrick Bouvier
2026-09-02 20:48 ` Philippe Mathieu-Daudé
2026-09-13 3:30 ` Richard Henderson
2026-09-02 15:20 ` [PATCH v3 06/11] accel/tcg: Rename do_interrupt() to do_interrupt_locked() Philippe Mathieu-Daudé
2026-09-13 3:31 ` Richard Henderson
2026-09-02 15:20 ` [PATCH v3 07/11] accel/tcg: Add do_interrupt() wrapper for targets to manage BQL Philippe Mathieu-Daudé
2026-09-13 3:50 ` Richard Henderson
2026-09-02 15:20 ` [PATCH v3 08/11] target/hexagon: Move to do_interrupt() (BQL acquired internally) Philippe Mathieu-Daudé
2026-09-03 0:15 ` Brian Cain
2026-09-13 3:55 ` Richard Henderson
2026-10-01 13:40 ` Philippe Mathieu-Daudé
2026-09-02 15:20 ` [RFC PATCH v3 09/11] targets: Move interrupt handlers to do_interrupt() Philippe Mathieu-Daudé
2026-09-13 4:00 ` Richard Henderson
2026-10-02 14:50 ` Philippe Mathieu-Daudé
2026-09-02 15:20 ` [RFC PATCH v3 10/11] targets: Move BQL locking into do_interrupt() handlers Philippe Mathieu-Daudé
2026-09-02 15:20 ` [PATCH v3 11/11] accel/tcg: Remove do_interrupt_locked() callback Philippe Mathieu-Daudé
2026-09-13 4:00 ` Richard Henderson
2026-09-02 15:33 ` [PATCH v3 00/11] accel/tcg: Push BQL down into per-target do_interrupt handlers Philippe Mathieu-Daudé
[not found] ` <20260902152044.31291-3-philmd@oss.qualcomm.com>
2026-09-02 19:52 ` [PATCH v3 02/11] target/s390x: Restrict interrupt handlers to system mode Pierrick Bouvier
2026-09-13 2:43 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19c91bbd-894b-4d23-86eb-00d68482aa8c@oss.qualcomm.com \
--to=philmd@oss.qualcomm.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.