Move this x86-specific code out of the generic accel/tcg/.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/i386/tcg/helper-tcg.h | 1 +
accel/tcg/cpu-exec.c | 9 ---------
target/i386/tcg/sysemu/seg_helper.c | 10 ++++++++++
target/i386/tcg/tcg-cpu.c | 1 +
4 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/target/i386/tcg/helper-tcg.h b/target/i386/tcg/helper-tcg.h
index ce34b737bb..253b1f561e 100644
--- a/target/i386/tcg/helper-tcg.h
+++ b/target/i386/tcg/helper-tcg.h
@@ -39,6 +39,7 @@ QEMU_BUILD_BUG_ON(TCG_PHYS_ADDR_BITS > TARGET_PHYS_ADDR_SPACE_BITS);
*/
void x86_cpu_do_interrupt(CPUState *cpu);
#ifndef CONFIG_USER_ONLY
+bool x86_need_replay_interrupt(int interrupt_request);
bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req);
#endif
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 4ab7d6c896..5a978a9e72 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -768,21 +768,12 @@ static inline bool cpu_handle_exception(CPUClass *cc, CPUState *cpu, int *ret)
}
#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(CPUClass *cc, int interrupt_request)
{
-#if defined(TARGET_I386)
- return !(interrupt_request & CPU_INTERRUPT_POLL);
-#else
if (!cc->tcg_ops->need_replay_interrupt) {
return true;
}
return cc->tcg_ops->need_replay_interrupt(interrupt_request);
-#endif
}
#endif /* !CONFIG_USER_ONLY */
diff --git a/target/i386/tcg/sysemu/seg_helper.c b/target/i386/tcg/sysemu/seg_helper.c
index 1cb5a0db45..e6f42282bb 100644
--- a/target/i386/tcg/sysemu/seg_helper.c
+++ b/target/i386/tcg/sysemu/seg_helper.c
@@ -127,6 +127,16 @@ void x86_cpu_do_interrupt(CPUState *cs)
}
}
+bool x86_need_replay_interrupt(int interrupt_request)
+{
+ /*
+ * 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.
+ */
+ return !(interrupt_request & CPU_INTERRUPT_POLL);
+}
+
bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
{
X86CPU *cpu = X86_CPU(cs);
diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c
index e1405b7be9..255d56d4c3 100644
--- a/target/i386/tcg/tcg-cpu.c
+++ b/target/i386/tcg/tcg-cpu.c
@@ -123,6 +123,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,
+ .need_replay_interrupt = x86_need_replay_interrupt,
#endif /* !CONFIG_USER_ONLY */
};
--
2.41.0
Reviewed-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
On 24.01.2024 13:16, Philippe Mathieu-Daudé wrote:
> Move this x86-specific code out of the generic accel/tcg/.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/i386/tcg/helper-tcg.h | 1 +
> accel/tcg/cpu-exec.c | 9 ---------
> target/i386/tcg/sysemu/seg_helper.c | 10 ++++++++++
> target/i386/tcg/tcg-cpu.c | 1 +
> 4 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/target/i386/tcg/helper-tcg.h b/target/i386/tcg/helper-tcg.h
> index ce34b737bb..253b1f561e 100644
> --- a/target/i386/tcg/helper-tcg.h
> +++ b/target/i386/tcg/helper-tcg.h
> @@ -39,6 +39,7 @@ QEMU_BUILD_BUG_ON(TCG_PHYS_ADDR_BITS > TARGET_PHYS_ADDR_SPACE_BITS);
> */
> void x86_cpu_do_interrupt(CPUState *cpu);
> #ifndef CONFIG_USER_ONLY
> +bool x86_need_replay_interrupt(int interrupt_request);
> bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req);
> #endif
>
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 4ab7d6c896..5a978a9e72 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -768,21 +768,12 @@ static inline bool cpu_handle_exception(CPUClass *cc, CPUState *cpu, int *ret)
> }
>
> #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(CPUClass *cc, int interrupt_request)
> {
> -#if defined(TARGET_I386)
> - return !(interrupt_request & CPU_INTERRUPT_POLL);
> -#else
> if (!cc->tcg_ops->need_replay_interrupt) {
> return true;
> }
> return cc->tcg_ops->need_replay_interrupt(interrupt_request);
> -#endif
> }
> #endif /* !CONFIG_USER_ONLY */
>
> diff --git a/target/i386/tcg/sysemu/seg_helper.c b/target/i386/tcg/sysemu/seg_helper.c
> index 1cb5a0db45..e6f42282bb 100644
> --- a/target/i386/tcg/sysemu/seg_helper.c
> +++ b/target/i386/tcg/sysemu/seg_helper.c
> @@ -127,6 +127,16 @@ void x86_cpu_do_interrupt(CPUState *cs)
> }
> }
>
> +bool x86_need_replay_interrupt(int interrupt_request)
> +{
> + /*
> + * 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.
> + */
> + return !(interrupt_request & CPU_INTERRUPT_POLL);
> +}
> +
> bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
> {
> X86CPU *cpu = X86_CPU(cs);
> diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c
> index e1405b7be9..255d56d4c3 100644
> --- a/target/i386/tcg/tcg-cpu.c
> +++ b/target/i386/tcg/tcg-cpu.c
> @@ -123,6 +123,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,
> + .need_replay_interrupt = x86_need_replay_interrupt,
> #endif /* !CONFIG_USER_ONLY */
> };
>
On 1/24/24 20:16, Philippe Mathieu-Daudé wrote: > Move this x86-specific code out of the generic accel/tcg/. > > Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org> > --- > target/i386/tcg/helper-tcg.h | 1 + > accel/tcg/cpu-exec.c | 9 --------- > target/i386/tcg/sysemu/seg_helper.c | 10 ++++++++++ > target/i386/tcg/tcg-cpu.c | 1 + > 4 files changed, 12 insertions(+), 9 deletions(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
On 24/01/24, Philippe Mathieu-Daudé wrote:
> Move this x86-specific code out of the generic accel/tcg/.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/i386/tcg/helper-tcg.h | 1 +
> accel/tcg/cpu-exec.c | 9 ---------
> target/i386/tcg/sysemu/seg_helper.c | 10 ++++++++++
> target/i386/tcg/tcg-cpu.c | 1 +
> 4 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/target/i386/tcg/helper-tcg.h b/target/i386/tcg/helper-tcg.h
> index ce34b737bb..253b1f561e 100644
> --- a/target/i386/tcg/helper-tcg.h
> +++ b/target/i386/tcg/helper-tcg.h
> @@ -39,6 +39,7 @@ QEMU_BUILD_BUG_ON(TCG_PHYS_ADDR_BITS > TARGET_PHYS_ADDR_SPACE_BITS);
> */
> void x86_cpu_do_interrupt(CPUState *cpu);
> #ifndef CONFIG_USER_ONLY
> +bool x86_need_replay_interrupt(int interrupt_request);
> bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req);
> #endif
>
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 4ab7d6c896..5a978a9e72 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -768,21 +768,12 @@ static inline bool cpu_handle_exception(CPUClass *cc, CPUState *cpu, int *ret)
> }
>
> #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(CPUClass *cc, int interrupt_request)
> {
> -#if defined(TARGET_I386)
> - return !(interrupt_request & CPU_INTERRUPT_POLL);
> -#else
> if (!cc->tcg_ops->need_replay_interrupt) {
> return true;
> }
> return cc->tcg_ops->need_replay_interrupt(interrupt_request);
> -#endif
> }
> #endif /* !CONFIG_USER_ONLY */
>
> diff --git a/target/i386/tcg/sysemu/seg_helper.c b/target/i386/tcg/sysemu/seg_helper.c
> index 1cb5a0db45..e6f42282bb 100644
> --- a/target/i386/tcg/sysemu/seg_helper.c
> +++ b/target/i386/tcg/sysemu/seg_helper.c
> @@ -127,6 +127,16 @@ void x86_cpu_do_interrupt(CPUState *cs)
> }
> }
>
> +bool x86_need_replay_interrupt(int interrupt_request)
> +{
> + /*
> + * 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.
> + */
> + return !(interrupt_request & CPU_INTERRUPT_POLL);
> +}
> +
> bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
> {
> X86CPU *cpu = X86_CPU(cs);
> diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c
> index e1405b7be9..255d56d4c3 100644
> --- a/target/i386/tcg/tcg-cpu.c
> +++ b/target/i386/tcg/tcg-cpu.c
> @@ -123,6 +123,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,
> + .need_replay_interrupt = x86_need_replay_interrupt,
> #endif /* !CONFIG_USER_ONLY */
> };
>
> --
> 2.41.0
>
Ah this makes me happy!:)
Reviewed-by: Anton Johansson <anjo@rev.ng>
On 24/1/24 18:17, Anton Johansson wrote:
> On 24/01/24, Philippe Mathieu-Daudé wrote:
>> Move this x86-specific code out of the generic accel/tcg/.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> target/i386/tcg/helper-tcg.h | 1 +
>> accel/tcg/cpu-exec.c | 9 ---------
>> target/i386/tcg/sysemu/seg_helper.c | 10 ++++++++++
>> target/i386/tcg/tcg-cpu.c | 1 +
>> 4 files changed, 12 insertions(+), 9 deletions(-)
> Ah this makes me happy!:)
There are still few more, but this is a start...
$ git grep -wA3 TARGET_I386 accel/tcg
accel/tcg/cpu-exec.c:311:#if defined(TARGET_I386)
accel/tcg/cpu-exec.c-312- flags |= CPU_DUMP_CCOP;
accel/tcg/cpu-exec.c-313-#endif
--
accel/tcg/cpu-exec.c:727:#if defined(TARGET_I386)
accel/tcg/cpu-exec.c-728- cc->tcg_ops->fake_user_interrupt(cpu);
accel/tcg/cpu-exec.c:729:#endif /* TARGET_I386 */
--
accel/tcg/cpu-exec.c:826:#if defined(TARGET_I386)
accel/tcg/cpu-exec.c-827- else if (interrupt_request &
CPU_INTERRUPT_INIT) {
accel/tcg/cpu-exec.c-828- X86CPU *x86_cpu = X86_CPU(cpu);
accel/tcg/cpu-exec.c-829- CPUArchState *env = &x86_cpu->env;
...
accel/tcg/cpu-exec.c:844:#endif /* !TARGET_I386 */
--
> Reviewed-by: Anton Johansson <anjo@rev.ng>
Thanks!
© 2016 - 2026 Red Hat, Inc.