qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Rob Herring" <rob.herring@linaro.org>,
	"Peter Crosthwaite" <peter.crosthwaite@xilinx.com>,
	"Fabian Aggeler" <aggelerf@ethz.ch>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Alexander Graf" <agraf@suse.de>,
	"John Williams" <john.williams@xilinx.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Christoffer Dall" <christoffer.dall@linaro.org>,
	"Richard Henderson" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v3 16/22] target-arm: A64: Generalize ERET to various ELs
Date: Thu, 22 May 2014 00:48:42 +0000	[thread overview]
Message-ID: <20140522004842.GE30982@hostname> (raw)
In-Reply-To: <CAFEAcA_OE8ewKAM9CFyzH_+c1rYLJU0gTuv9+Gd87V=03pkMBw@mail.gmail.com>

On Wed, May 21, 2014 at 08:20:20PM +0100, Peter Maydell wrote:
> On 19 May 2014 10:22, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:
> > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> >
> > Adds support for ERET to Aarch64 EL2 and 3.
> 
> "AArch64". Also "to" here is ambiguous. The ARM ARM tries to

Changed to AArch64.

> keep the terminology straight to avoid confusion: exceptions
> are "taken from ELx" and "taken to ELx"; we "return from ELx"
> and "return to ELx". This looks like it's talking about "return to
> EL2/EL3" but probably doesn't really mean that.
> 
> If this patch is adding support for ERET from EL2/EL3

My first tests when starting booting in EL3 where to take exceptions
and return back to EL3 and EL2, the commit log msg didn't
evolve since but I guess I mean from and to EL2/3. Changed it to:

Adds support for ERET to and from AArch64 EL2 and 3.

If you have better suggestions I'm happy to change it to whatever.

> it needs to also fix the bit in the "returning to an exception
> level which is 32 bit" which says "new_el = 0" since that's
> not guaranteed to be true any more. (Also I think the register
> mapping for AArch32 EL2/EL1 needs handling correctly.)

I've tried to stay away from touching too much of the AArch32
code as I haven't had a setup to test 64/32 transitions
beyond a64/el1 and a32/el0.

I do have a follow-up patch (not very tested) for ERET to aarch32.
If you feel strongly about it I can squash the little I've got
for aarch32 allthough I'd rather do it incrementally and 
leave it for follow-ups.

Cheers,
Edgar



> 
> > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> > ---
> >  target-arm/op_helper.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
> > index d89755a..c632dd6 100644
> > --- a/target-arm/op_helper.c
> > +++ b/target-arm/op_helper.c
> > @@ -386,13 +386,13 @@ void HELPER(msr_i_pstate)(CPUARMState *env, uint32_t op, uint32_t imm)
> >
> >  void HELPER(exception_return)(CPUARMState *env)
> >  {
> > -    unsigned int spsr_idx = is_a64(env) ? aarch64_banked_spsr_index(1) : 0;
> > +    int cur_el = arm_current_pl(env);
> > +    unsigned int spsr_idx = is_a64(env) ? aarch64_banked_spsr_index(cur_el) : 0;
> >      uint32_t spsr = env->banked_spsr[spsr_idx];
> >      int new_el, i;
> > -    int cur_el = arm_current_pl(env);
> >
> >      if (env->pstate & PSTATE_SP) {
> > -        env->sp_el[1] = env->xregs[31];
> > +        env->sp_el[cur_el] = env->xregs[31];
> >      } else {
> >          env->sp_el[0] = env->xregs[31];
> >      }
> > @@ -429,7 +429,7 @@ void HELPER(exception_return)(CPUARMState *env)
> >          env->aarch64 = 1;
> >          pstate_write(env, spsr);
> >          env->xregs[31] = env->sp_el[new_el];
> > -        env->pc = env->elr_el[1];
> > +        env->pc = env->elr_el[cur_el];
> >      }
> >
> >      return;
> > @@ -443,7 +443,7 @@ illegal_return:
> >       * no change to exception level, execution state or stack pointer
> >       */
> >      env->pstate |= PSTATE_IL;
> > -    env->pc = env->elr_el[1];
> > +    env->pc = env->elr_el[cur_el];
> >      spsr &= PSTATE_NZCV | PSTATE_DAIF;
> >      spsr |= pstate_read(env) & ~(PSTATE_NZCV | PSTATE_DAIF);
> >      pstate_write(env, spsr);
> > --
> > 1.8.3.2
> >
> 
> thanks
> -- PMM

  reply	other threads:[~2014-05-22  0:48 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19  9:22 [Qemu-devel] [PATCH v3 00/22] target-arm: Preparations for A64 EL2 and 3 Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 01/22] target-arm: Make elr_el1 an array Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 02/22] target-arm: Make esr_el1 " Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 03/22] target-arm: c12_vbar -> vbar_el[] Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 04/22] target-arm: Add arm_el_to_mmu_idx() Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 05/22] target-arm: Move get_mem_index to translate.h Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 06/22] target-arm: A64: Add SP entries for EL2 and 3 Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 07/22] target-arm: A64: Add ELR " Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 08/22] target-arm: Add SPSR entries for EL2/HYP and EL3/MON Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 09/22] target-arm: A64: Introduce aarch64_banked_spsr_index() Edgar E. Iglesias
2014-05-21 19:01   ` Peter Maydell
2014-05-21 23:50     ` Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 10/22] target-arm: Add a feature flag for EL2 Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 11/22] target-arm: Add a feature flag for EL3 Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 12/22] target-arm: Register EL2 versions of ELR and SPSR Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 13/22] target-arm: Register EL3 " Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 14/22] target-arm: A64: Forbid ERET to increase the EL Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 15/22] target-arm: A64: Forbid ERET to unimplemented ELs Edgar E. Iglesias
2014-05-21 19:06   ` Peter Maydell
2014-05-21 23:56     ` Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 16/22] target-arm: A64: Generalize ERET to various ELs Edgar E. Iglesias
2014-05-21 19:10   ` Peter Maydell
2014-05-22  0:56     ` Edgar E. Iglesias
2014-05-21 19:20   ` Peter Maydell
2014-05-22  0:48     ` Edgar E. Iglesias [this message]
2014-05-22  7:22       ` Peter Maydell
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 17/22] target-arm: A64: Generalize update_spsel for the " Edgar E. Iglesias
2014-05-19  9:22 ` [Qemu-devel] [PATCH v3 18/22] target-arm: Make vbar_write writeback to any CPREG Edgar E. Iglesias
2014-05-19  9:23 ` [Qemu-devel] [PATCH v3 19/22] target-arm: A64: Register VBAR_EL2 Edgar E. Iglesias
2014-05-20  9:02   ` Peter Crosthwaite
2014-05-21  1:01     ` Edgar E. Iglesias
2014-05-21 19:22   ` Peter Maydell
2014-05-22  1:11     ` Edgar E. Iglesias
2014-05-19  9:23 ` [Qemu-devel] [PATCH v3 20/22] target-arm: A64: Register VBAR_EL3 Edgar E. Iglesias
2014-05-19  9:23 ` [Qemu-devel] [PATCH v3 21/22] RFC: target-arm: A32: Use get_mem_index for load/stores Edgar E. Iglesias
2014-05-21 19:27   ` Peter Maydell
2014-05-22  1:12     ` Edgar E. Iglesias
2014-05-19  9:23 ` [Qemu-devel] [PATCH v3 22/22] RFC: target-arm: Use a 1:1 mapping between EL and MMU index Edgar E. Iglesias
2014-05-20  9:07   ` Peter Crosthwaite
2014-05-20  9:47   ` Aggeler  Fabian
2014-05-20 13:28     ` Edgar E. Iglesias
2014-05-20 13:47       ` Peter Maydell
2014-05-20 13:51         ` Alexander Graf
2014-05-20 13:55         ` Edgar E. Iglesias
2014-05-20  9:11 ` [Qemu-devel] [PATCH v3 00/22] target-arm: Preparations for A64 EL2 and 3 Peter Crosthwaite
2014-05-21 19:30 ` Peter Maydell
2014-05-22  1:14   ` Edgar E. Iglesias

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=20140522004842.GE30982@hostname \
    --to=edgar.iglesias@gmail.com \
    --cc=aggelerf@ethz.ch \
    --cc=agraf@suse.de \
    --cc=alex.bennee@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=john.williams@xilinx.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rob.herring@linaro.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).