All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Alessandro Di Federico" <ale@rev.ng>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: [PATCH 09/10] accel/tcg: re-inline the filtering of virtual IRQs but data driven
Date: Mon, 20 Mar 2023 10:10:34 +0000	[thread overview]
Message-ID: <20230320101035.2214196-10-alex.bennee@linaro.org> (raw)
In-Reply-To: <20230320101035.2214196-1-alex.bennee@linaro.org>

Although only I386 currently uses it it is not inconceivable that
other arches might find this facility useful.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 include/hw/core/tcg-cpu-ops.h |  5 +++++
 accel/tcg/cpu-exec.c          | 29 +++++++++--------------------
 target/i386/tcg/tcg-cpu.c     |  1 +
 3 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h
index 66c0cecdde..8e8df8c330 100644
--- a/include/hw/core/tcg-cpu-ops.h
+++ b/include/hw/core/tcg-cpu-ops.h
@@ -121,6 +121,11 @@ struct TCGCPUOps {
      */
     bool (*io_recompile_replay_branch)(CPUState *cpu,
                                        const TranslationBlock *tb);
+    /**
+     * @virtual_interrupts: IRQs that can be ignored for replay purposes
+     */
+    int virtual_interrupts;
+
 #else
     /**
      * record_sigsegv:
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 8fa19b7222..56be7956e7 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -737,22 +737,6 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
     return false;
 }
 
-#ifndef CONFIG_USER_ONLY
-/*
- * CPU_INTERRUPT_POLL is a virtual event which gets converted into a
- * "real" interrupt event later. It does not need to be recorded for
- * replay purposes.
- */
-static inline bool need_replay_interrupt(int interrupt_request)
-{
-#if defined(TARGET_I386)
-    return !(interrupt_request & CPU_INTERRUPT_POLL);
-#else
-    return true;
-#endif
-}
-#endif /* !CONFIG_USER_ONLY */
-
 static inline bool cpu_handle_interrupt(CPUState *cpu,
                                         TranslationBlock **last_tb)
 {
@@ -808,11 +792,16 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
              * interrupt isn't processed, True when it is, and we should
              * restart on a new TB, and via longjmp via cpu_loop_exit.
              */
-            CPUClass *cc = CPU_GET_CLASS(cpu);
+            struct TCGCPUOps const *tcg_ops = cpu->cc->tcg_ops;
 
-            if (cc->tcg_ops->cpu_exec_interrupt &&
-                cc->tcg_ops->cpu_exec_interrupt(cpu, interrupt_request)) {
-                if (need_replay_interrupt(interrupt_request)) {
+            if (tcg_ops->cpu_exec_interrupt &&
+                tcg_ops->cpu_exec_interrupt(cpu, interrupt_request)) {
+                /*
+                 * Virtual events gets converted into a "real"
+                 * interrupt event later. They do not need to be
+                 * recorded for replay purposes.
+                 */
+                if (!(interrupt_request & tcg_ops->virtual_interrupts)) {
                     replay_interrupt();
                 }
                 /*
diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c
index b942c306d6..750ae0f945 100644
--- a/target/i386/tcg/tcg-cpu.c
+++ b/target/i386/tcg/tcg-cpu.c
@@ -104,6 +104,7 @@ static const struct TCGCPUOps x86_tcg_ops = {
     .do_unaligned_access = x86_cpu_do_unaligned_access,
     .debug_excp_handler = breakpoint_handler,
     .debug_check_breakpoint = x86_debug_check_breakpoint,
+    .virtual_interrupts = CPU_INTERRUPT_POLL,
 #endif /* !CONFIG_USER_ONLY */
 };
 
-- 
2.39.2



  parent reply	other threads:[~2023-03-20 10:12 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 10:10 [PATCH 00/10] accel/tcg: refactor the cpu-exec loop Alex Bennée
2023-03-20 10:10 ` [PATCH 01/10] metadata: add .git-blame-ignore-revs Alex Bennée
2023-03-21 14:17   ` Philippe Mathieu-Daudé
2023-03-20 10:10 ` [PATCH 02/10] accel/tcg: move cpu_reloading_memory_map into cpu-exec-softmmu Alex Bennée
2023-03-20 12:56   ` Claudio Fontana
2023-03-20 13:32     ` Alex Bennée
2023-03-20 14:01       ` Claudio Fontana
2023-03-20 14:33         ` Alex Bennée
2023-03-20 16:14           ` Richard Henderson
2023-03-21 16:07   ` Alessandro Di Federico via
2023-03-20 10:10 ` [PATCH 03/10] accel/tcg: move i386 halt handling to sysemu_ops Alex Bennée
2023-03-20 14:52   ` Philippe Mathieu-Daudé
2023-03-20 17:18     ` Alex Bennée
2023-03-20 15:23   ` Claudio Fontana
2023-03-20 15:34     ` Philippe Mathieu-Daudé
2023-03-21  8:47       ` Claudio Fontana
2023-03-20 17:20     ` Alex Bennée
2023-03-20 10:10 ` [PATCH 04/10] accel/tcg: don't bother with ifdef for CPU_DUMP_CCOP Alex Bennée
2023-03-20 16:16   ` Richard Henderson
2023-03-20 16:17   ` Richard Henderson
2023-03-20 10:10 ` [PATCH 05/10] accel/tcg: remove the fake_user_interrupt guards Alex Bennée
2023-03-20 16:18   ` Richard Henderson
2023-03-20 10:10 ` [PATCH 06/10] includes: move irq definitions out of cpu-all.h Alex Bennée
2023-03-20 16:20   ` Richard Henderson
2023-03-21 16:06   ` Alessandro Di Federico via
2023-03-22  5:25     ` Richard Henderson
2023-03-22 21:15       ` Alessandro Di Federico
2023-03-20 10:10 ` [PATCH 07/10] accel/tcg: use QEMU_IOTHREAD_LOCK_GUARD to cover the exit Alex Bennée
2023-03-20 14:55   ` Philippe Mathieu-Daudé
2023-03-20 16:21   ` Richard Henderson
2023-03-20 10:10 ` [PATCH 08/10] accel/tcg: push i386 specific hacks into handle_cpu_interrupt callback Alex Bennée
2023-03-20 16:27   ` Richard Henderson
2023-03-20 17:14     ` Alex Bennée
2023-03-21  6:04       ` Richard Henderson
2023-03-20 10:10 ` Alex Bennée [this message]
2023-03-20 14:58   ` [PATCH 09/10] accel/tcg: re-inline the filtering of virtual IRQs but data driven Philippe Mathieu-Daudé
2023-03-20 16:30   ` Richard Henderson
2023-03-20 10:10 ` [PATCH 10/10] accel/tcg: remove unused includes Alex Bennée
2023-03-20 16:30   ` Richard Henderson
2023-03-21 16:07   ` Alessandro Di Federico via

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=20230320101035.2214196-10-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=ale@rev.ng \
    --cc=eduardo@habkost.net \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@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.