qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Richard Henderson <rth@twiddle.net>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org,
	aliguori@amazon.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH 06/23] qom: Add cpu_exec_interrupt hook
Date: Tue, 16 Sep 2014 19:09:43 +0100	[thread overview]
Message-ID: <87egvbfnei.fsf@linaro.org> (raw)
In-Reply-To: <1410626734-3804-7-git-send-email-rth@twiddle.net>


Richard Henderson writes:

> Continuing the removal of ifdefs from cpu_exec.
>
> Cc: Andreas Färber <afaerber@suse.de>
> Signed-off-by: Richard Henderson <rth@twiddle.net>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  cpu-exec.c        | 14 +++++++++-----
>  include/qom/cpu.h |  2 ++
>  qom/cpu.c         |  6 ++++++
>  3 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/cpu-exec.c b/cpu-exec.c
> index d930e7a..fe313b4 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -676,8 +676,15 @@ int cpu_exec(CPUArchState *env)
>                          next_tb = 0;
>                      }
>  #endif
> -                   /* Don't use the cached interrupt_request value,
> -                      do_interrupt may have updated the EXITTB flag. */
> +                    /* The target hook has 3 exit conditions:
> +                       False when the interrupt isn't processed,
> +                       True when it is, and we should restart on a new TB,
> +                       and via longjmp via cpu_loop_exit.  */
> +                    if (cc->cpu_exec_interrupt(cpu, interrupt_request)) {
> +                        next_tb = 0;
> +                    }
> +                    /* Don't use the cached interrupt_request value,
> +                       do_interrupt may have updated the EXITTB flag. */
>                      if (cpu->interrupt_request & CPU_INTERRUPT_EXITTB) {
>                          cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB;
>                          /* ensure that no TB jump will be modified as
> @@ -783,10 +790,7 @@ int cpu_exec(CPUArchState *env)
>               * local variables as longjmp is marked 'noreturn'. */
>              cpu = current_cpu;
>              env = cpu->env_ptr;
> -#if !(defined(CONFIG_USER_ONLY) && \
> -      (defined(TARGET_M68K) || defined(TARGET_PPC) || defined(TARGET_S390X)))
>              cc = CPU_GET_CLASS(cpu);
> -#endif
>  #ifdef TARGET_I386
>              x86_cpu = X86_CPU(cpu);
>  #endif
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 0340cf4..f576b47 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -101,6 +101,7 @@ struct TranslationBlock;
>   * @gdb_core_xml_file: File name for core registers GDB XML description.
>   * @cpu_exec_enter: Callback for cpu_exec preparation.
>   * @cpu_exec_exit: Callback for cpu_exec cleanup.
> + * @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec.
>   *
>   * Represents a CPU family or model.
>   */
> @@ -154,6 +155,7 @@ typedef struct CPUClass {
>  
>      void (*cpu_exec_enter)(CPUState *cpu);
>      void (*cpu_exec_exit)(CPUState *cpu);
> +    bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
>  } CPUClass;
>  
>  #ifdef HOST_WORDS_BIGENDIAN
> diff --git a/qom/cpu.c b/qom/cpu.c
> index 6a9d02e..0ec3337 100644
> --- a/qom/cpu.c
> +++ b/qom/cpu.c
> @@ -206,6 +206,11 @@ static void cpu_common_noop(CPUState *cpu)
>  {
>  }
>  
> +static bool cpu_common_exec_interrupt(CPUState *cpu, int int_req)
> +{
> +    return false;
> +}
> +
>  void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
>                      int flags)
>  {
> @@ -347,6 +352,7 @@ static void cpu_class_init(ObjectClass *klass, void *data)
>      k->debug_excp_handler = cpu_common_noop;
>      k->cpu_exec_enter = cpu_common_noop;
>      k->cpu_exec_exit = cpu_common_noop;
> +    k->cpu_exec_interrupt = cpu_common_exec_interrupt;
>      dc->realize = cpu_common_realizefn;
>      /*
>       * Reason: CPUs still need special care by board code: wiring up


-- 
Alex Bennée

  parent reply	other threads:[~2014-09-16 18:10 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-13 16:45 [Qemu-devel] [PATCH 00/23] qom hooks to clean up cpu_exec Richard Henderson
2014-09-13 16:45 ` [Qemu-devel] [PATCH 01/23] qom: Add cpu_exec_enter and cpu_exec_exit hooks Richard Henderson
2014-09-14 19:35   ` Alex Bennée
2014-09-17 11:54   ` Andreas Färber
2014-09-17 15:22     ` Richard Henderson
2014-09-25 18:03       ` Peter Maydell
2014-09-13 16:45 ` [Qemu-devel] [PATCH 02/23] cpu-exec: Remove do-nothing ifdef chains Richard Henderson
2014-09-14 19:36   ` Alex Bennée
2014-09-13 16:45 ` [Qemu-devel] [PATCH 03/23] target-i386: Use cpu_exec_enter/exit qom hooks Richard Henderson
2014-09-14 19:38   ` Alex Bennée
2014-09-13 16:45 ` [Qemu-devel] [PATCH 04/23] target-m68k: " Richard Henderson
2014-09-14 19:40   ` Alex Bennée
2014-09-13 16:45 ` [Qemu-devel] [PATCH 05/23] target-ppc: Use cpu_exec_enter qom hook Richard Henderson
2014-09-14 19:43   ` Alex Bennée
2014-09-15  1:16     ` Peter Maydell
2014-09-13 16:45 ` [Qemu-devel] [PATCH 06/23] qom: Add cpu_exec_interrupt hook Richard Henderson
2014-09-16  4:14   ` Max Filippov
2014-09-16 18:09   ` Alex Bennée [this message]
2014-09-13 16:45 ` [Qemu-devel] [PATCH 07/23] target-xtensa: Use cpu_exec_interrupt qom hook Richard Henderson
2014-09-16  4:13   ` Max Filippov
2014-09-16 18:18   ` Alex Bennée
2014-09-16 19:11     ` Richard Henderson
2014-09-13 16:45 ` [Qemu-devel] [PATCH 08/23] target-s390x: " Richard Henderson
2014-09-16 18:41   ` Alex Bennée
2014-09-13 16:45 ` [Qemu-devel] [PATCH 09/23] target-m68k: " Richard Henderson
2014-09-16 18:41   ` Alex Bennée
2014-09-13 16:45 ` [Qemu-devel] [PATCH 10/23] target-cris: " Richard Henderson
2014-09-16 10:35   ` Edgar E. Iglesias
2014-09-13 16:45 ` [Qemu-devel] [PATCH 11/23] target-alpha: " Richard Henderson
2014-09-13 16:45 ` [Qemu-devel] [PATCH 12/23] target-sh4: " Richard Henderson
2014-09-13 16:45 ` [Qemu-devel] [PATCH 13/23] target-unicore32: " Richard Henderson
2014-09-13 16:45 ` [Qemu-devel] [PATCH 14/23] target-arm: " Richard Henderson
2014-09-13 16:45 ` [Qemu-devel] [PATCH 15/23] target-sparc: " Richard Henderson
2014-09-13 16:45 ` [Qemu-devel] [PATCH 16/23] target-openrisc: " Richard Henderson
2014-09-16  3:59   ` Jia Liu
2014-09-13 16:45 ` [Qemu-devel] [PATCH 17/23] target-tricore: Remove the dummy interrupt boilerplate Richard Henderson
2014-09-21  7:36   ` Bastian Koppelmann
2014-09-13 16:45 ` [Qemu-devel] [PATCH 18/23] target-mips: Use cpu_exec_interrupt qom hook Richard Henderson
2014-09-15 11:09   ` Leon Alrae
2014-09-13 16:45 ` [Qemu-devel] [PATCH 19/23] target-microblaze: " Richard Henderson
2014-09-13 16:45 ` [Qemu-devel] [PATCH 20/23] target-lm32: " Richard Henderson
2014-09-14 18:35   ` Michael Walle
2014-09-13 16:45 ` [Qemu-devel] [PATCH 21/23] target-ppc: " Richard Henderson
2014-09-13 16:45 ` [Qemu-devel] [PATCH 22/23] target-i386: " Richard Henderson
2014-09-13 16:45 ` [Qemu-devel] [PATCH 23/23] cpu-exec: Do CPU_INTERRUPT_HALT unconditionally Richard Henderson
2014-09-26 10:45 ` [Qemu-devel] [PATCH 00/23] qom hooks to clean up cpu_exec Peter Maydell

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=87egvbfnei.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=afaerber@suse.de \
    --cc=aliguori@amazon.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).