All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, patches@linaro.org,
	Michael Davidsaver <mdavidsaver@gmail.com>,
	Liviu Ionescu <ilg@livius.net>
Subject: Re: [Qemu-devel] [PATCH 8/9] armv7m: Simpler and faster exception start
Date: Wed, 15 Feb 2017 14:18:05 +0000	[thread overview]
Message-ID: <87efyzv8pu.fsf@linaro.org> (raw)
In-Reply-To: <1486065742-28639-9-git-send-email-peter.maydell@linaro.org>


Peter Maydell <peter.maydell@linaro.org> writes:

> From: Michael Davidsaver <mdavidsaver@gmail.com>
>
> All the places in armv7m_cpu_do_interrupt() which pend an
> exception in the NVIC are doing so for synchronous
> exceptions. We know that we will always take some
> exception in this case, so we can just acknowledge it
> immediately, rather than returning and then immediately
> being called again because the NVIC has raised its outbound
> IRQ line.
>
> Signed-off-by: Michael Davidsaver <mdavidsaver@gmail.com>
> [PMM: tweaked commit message; added DEBUG to the set of
> exceptions we handle immediately, since it is synchronous
> when it results from the BKPT instruction]
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

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

> ---
>  target/arm/helper.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/target/arm/helper.c b/target/arm/helper.c
> index 78bf9ab..8bdd99c 100644
> --- a/target/arm/helper.c
> +++ b/target/arm/helper.c
> @@ -6071,22 +6071,22 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
>      case EXCP_UDEF:
>          armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
>          env->v7m.cfsr |= R_V7M_CFSR_UNDEFINSTR_MASK;
> -        return;
> +        break;
>      case EXCP_NOCP:
>          armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
>          env->v7m.cfsr |= R_V7M_CFSR_NOCP_MASK;
> -        return;
> +        break;
>      case EXCP_SWI:
>          /* The PC already points to the next instruction.  */
>          armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SVC);
> -        return;
> +        break;
>      case EXCP_PREFETCH_ABORT:
>      case EXCP_DATA_ABORT:
>          /* TODO: if we implemented the MPU registers, this is where we
>           * should set the MMFAR, etc from exception.fsr and exception.vaddress.
>           */
>          armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_MEM);
> -        return;
> +        break;
>      case EXCP_BKPT:
>          if (semihosting_enabled()) {
>              int nr;
> @@ -6101,9 +6101,8 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
>              }
>          }
>          armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_DEBUG);
> -        return;
> +        break;
>      case EXCP_IRQ:
> -        armv7m_nvic_acknowledge_irq(env->nvic);
>          break;
>      case EXCP_EXCEPTION_EXIT:
>          do_v7m_exception_exit(env);
> @@ -6113,6 +6112,10 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
>          return; /* Never happens.  Keep compiler happy.  */
>      }
>
> +    armv7m_nvic_acknowledge_irq(env->nvic);
> +
> +    qemu_log_mask(CPU_LOG_INT, "... as %d\n", env->v7m.exception);
> +
>      /* Align stack pointer if the guest wants that */
>      if ((env->regs[13] & 4) && (env->v7m.ccr & R_V7M_CCR_STKALIGN_MASK)) {
>          env->regs[13] -= 4;


--
Alex Bennée

  reply	other threads:[~2017-02-15 14:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-02 20:02 [Qemu-devel] [PATCH 0/9] Rewrite NVIC to not depend on the GIC Peter Maydell
2017-02-02 20:02 ` [Qemu-devel] [PATCH 1/9] armv7m: Rename nvic_state to NVICState Peter Maydell
2017-02-10 14:23   ` Philippe Mathieu-Daudé
2017-02-14 17:00   ` Alex Bennée
2017-02-02 20:02 ` [Qemu-devel] [PATCH 2/9] armv7m: Implement reading and writing of PRIGROUP Peter Maydell
2017-02-10 14:27   ` Philippe Mathieu-Daudé
2017-02-14 17:08   ` Alex Bennée
2017-02-02 20:02 ` [Qemu-devel] [PATCH 3/9] armv7m: Rewrite NVIC to not use any GIC code Peter Maydell
2017-02-15 12:46   ` Alex Bennée
2017-02-15 13:34     ` Peter Maydell
2017-02-15 14:14       ` Alex Bennée
2017-02-15 14:27         ` Peter Maydell
2017-02-15 14:51           ` Alex Bennée
2017-02-16 14:11       ` Peter Maydell
2017-02-18 17:45         ` Michael Davidsaver
2017-02-18 18:38           ` Peter Maydell
2017-02-19 18:10             ` Michael Davidsaver
2017-02-16 16:12       ` Peter Maydell
2017-02-02 20:02 ` [Qemu-devel] [PATCH 4/9] armv7m: Fix condition check for taking exceptions Peter Maydell
2017-02-15 12:48   ` Alex Bennée
2017-02-02 20:02 ` [Qemu-devel] [PATCH 5/9] arm: gic: Remove references to NVIC Peter Maydell
2017-02-15 12:49   ` Alex Bennée
2017-04-17  3:11   ` Philippe Mathieu-Daudé
2017-02-02 20:02 ` [Qemu-devel] [PATCH 6/9] armv7m: Escalate exceptions to HardFault if necessary Peter Maydell
2017-02-15 14:15   ` Alex Bennée
2017-02-02 20:02 ` [Qemu-devel] [PATCH 7/9] armv7m: Remove unused armv7m_nvic_acknowledge_irq() return value Peter Maydell
2017-02-15 14:16   ` Alex Bennée
2017-02-02 20:02 ` [Qemu-devel] [PATCH 8/9] armv7m: Simpler and faster exception start Peter Maydell
2017-02-15 14:18   ` Alex Bennée [this message]
2017-02-02 20:02 ` [Qemu-devel] [PATCH 9/9] armv7m: VECTCLRACTIVE and VECTRESET are UNPREDICTABLE Peter Maydell
2017-02-10 14:31   ` Philippe Mathieu-Daudé
2017-02-15 14:19   ` Alex Bennée
2017-02-10 14:05 ` [Qemu-devel] [Qemu-arm] [PATCH 0/9] Rewrite NVIC to not depend on the GIC 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=87efyzv8pu.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=ilg@livius.net \
    --cc=mdavidsaver@gmail.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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.