All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Aggeler Fabian <aggelerf@student.ethz.ch>
Cc: "peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	"peter.crosthwaite@xilinx.com" <peter.crosthwaite@xilinx.com>,
	"rob.herring@linaro.org" <rob.herring@linaro.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"agraf@suse.de" <agraf@suse.de>,
	"john.williams@xilinx.com" <john.williams@xilinx.com>,
	"alex.bennee@linaro.org" <alex.bennee@linaro.org>,
	"christoffer.dall@linaro.org" <christoffer.dall@linaro.org>,
	"rth@twiddle.net" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v3 22/22] RFC: target-arm: Use a 1:1 mapping between EL and MMU index
Date: Tue, 20 May 2014 23:28:46 +1000	[thread overview]
Message-ID: <20140520132846.GJ18802@zapo.iiNet> (raw)
In-Reply-To: <EACD0E99-523F-429F-8A5A-CC747D60C3F1@ethz.ch>

On Tue, May 20, 2014 at 09:47:47AM +0000, Aggeler  Fabian wrote:
> I guess this makes sense. Shouldn’t we implement two more MMUs to separate S-EL0/EL0 and S-EL1/EL1
> at least for ARMv8 with EL3 running in Aarch64 state?

Maybe with future patches. My understanding is that on aarch64 the world
switch between S/NS requires EL3 firmware to reprogram the TTBR regs.
Currently in QEMU, the re-programming of TTBR will flush the TLBs. We would
need to do something about that before adding MMU tables for aarch64 Secure
EL0/1 does any good. I think it's better to keep it simple for now and leave
this as a possible future optimization.

Another possible future optimization is to add some kind of dynamic allocation
of a limited set of MMU tables for different ASIDs and VMIDs. For emulated
virtualization, it might help quite a bit.


> For ARMv7 and ARMv8 with EL3 in Aarch32 S-PL1 
> is mapped to PL3, so we only need one additional MMU for S-PL0. If you agree I could add this change in 
> the Security Extension patches after this patch makes it into the tree.

Yes, I avoided this patch in my v1 because I thought we would need a non
linear mapping for aarch32 S/NS anyway. But I agree that a combination is
good. Keeping a 1:1 mapping between EL -> MMU idx and have additional MMU
tables for specific features like S/NS.

Thanks,
Edgar

> 
> Best,
> Fabian
> 
> On 19 May 2014, at 11:23, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:
> 
> > From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
> > 
> > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
> > ---
> > target-arm/cpu.h       | 26 ++++----------------------
> > target-arm/translate.h |  2 +-
> > 2 files changed, 5 insertions(+), 23 deletions(-)
> > 
> > diff --git a/target-arm/cpu.h b/target-arm/cpu.h
> > index 566f9ed..3b7ef32 100644
> > --- a/target-arm/cpu.h
> > +++ b/target-arm/cpu.h
> > @@ -1084,32 +1084,14 @@ static inline CPUARMState *cpu_init(const char *cpu_model)
> > #define cpu_list arm_cpu_list
> > 
> > /* MMU modes definitions */
> > -#define MMU_MODE0_SUFFIX _kernel
> > -#define MMU_MODE1_SUFFIX _user
> > -#define MMU_USER_IDX 1
> > -
> > -static inline int arm_el_to_mmu_idx(int current_el)
> > -{
> > -#ifdef CONFIG_USER_ONLY
> > -    return MMU_USER_IDX;
> > -#else
> > -    switch (current_el) {
> > -    case 0:
> > -        return MMU_USER_IDX;
> > -    case 1:
> > -        return 0;
> > -    default:
> > -        /* Unsupported EL.  */
> > -        assert(0);
> > -        return 0;
> > -    }
> > -#endif
> > -}
> > +#define MMU_MODE0_SUFFIX _user
> > +#define MMU_MODE1_SUFFIX _kernel
> > +#define MMU_USER_IDX 0
> > 
> > static inline int cpu_mmu_index (CPUARMState *env)
> > {
> >     int cur_el = arm_current_pl(env);
> > -    return arm_el_to_mmu_idx(cur_el);
> > +    return cur_el;
> > }
> > 
> > #include "exec/cpu-all.h"
> > diff --git a/target-arm/translate.h b/target-arm/translate.h
> > index db6f0af..31a0104 100644
> > --- a/target-arm/translate.h
> > +++ b/target-arm/translate.h
> > @@ -54,7 +54,7 @@ static inline int arm_dc_feature(DisasContext *dc, int feature)
> > 
> > static inline int get_mem_index(DisasContext *s)
> > {
> > -    return arm_el_to_mmu_idx(s->current_pl);
> > +    return s->current_pl;
> > }
> > 
> > /* target-specific extra values for is_jmp */
> > -- 
> > 1.8.3.2
> > 
> 

  reply	other threads:[~2014-05-20 13:29 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
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 [this message]
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=20140520132846.GJ18802@zapo.iiNet \
    --to=edgar.iglesias@gmail.com \
    --cc=aggelerf@student.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 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.