All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Hanson <thomas.hanson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	Grant Likely <grant.likely@hpe.com>
Subject: Re: [Qemu-devel] [PATCH 0/3] tareget-arm: Handle tagged addresses when loading PC
Date: Fri, 30 Sep 2016 15:48:55 -0600	[thread overview]
Message-ID: <57EEDDC7.7060407@linaro.org> (raw)
In-Reply-To: <CAFEAcA-+UOe-W77ryjhc1qRCJY_orp4LZWjEm89Akq_FFg0cBA@mail.gmail.com>

On 09/29/2016 07:37 PM, Peter Maydell wrote:
> On 16 September 2016 at 10:34, Thomas Hanson <thomas.hanson@linaro.org> wrote:
>>      If tagged addresses are enabled, then addresses being loaded into the
>>      PC must be cleaned up by overwriting the tag bits with either all 0's
>>      or all 1's as specified in the ARM ARM spec.  The decision process is
>>      dependent on whether the code will be running in EL0/1 or in EL2/3 and
>>      is controlled by a combination of Top Byte Ignored (TBI) bits in the
>>      TCR and the value of bit 55 in the address being loaded.
>>
>>      TBI values are extracted from the appropriate TCR and made available
>>      to TCG code generation routines by inserting them into the TB flags
>>      field and then transferring them to DisasContext structure in
>>      gen_intermediate_code_a64().
>>
>>      New function gen_a64_set_pc_reg() encapsulates the logic required to
>>      determine whether clean up of the tag byte is required and then
>>      generating the code to correctly load the PC.
>>
>>      In addition to those instruction which can directly load a tagged
>>      address into the PC, there are others which increment or add a value to
>>      the PC.  If 56 bit addressing is used, these instructions can cause an
>>      arithmetic roll-over into the tag bits.  The ARM ARM specification for
>>      handling tagged addresses requires that these cases also be addressed
>>      by cleaning up the tag field.  This work has been deferred because
>>      there is currently no CPU model available for testing with 56 bit
>>      addresses.
> These changes are OK (other than the comments I've made on the
> patches), but do not cover all the cases where values can be
> loaded into the PC and may need to be cleansed of their tags.
>
> In particular:
>   * on exception entry to AArch64 we may need to clean a tag out of
>     the vector table base address register VBAR_ELx
>     (in QEMU this would be in arm_cpu_do_interrupt_aarch64())
>   * on exception return to AArch64 we may need to clean a tag out of
>     the return address we got from ELR_ELx
>     (in QEMU, in the exception_return helper)
>
> Note that D4.1.1 of the ARM ARM describes a potential relaxation
> of the requirement that tag bits not be propagated into the PC
> in the case of an illegal exception return; I recommend not
> taking advantage of that relaxation unless it really does fall
> out of the implementation much more trivially that way.
>
> Watch out that you use the TBI bits for the destination EL in
> each case, not the EL you start in...
>
> thanks
> -- PMM
Peter,

As I read arm_cpu_do_interrupt_aarch64() it sets the return address in 
env->elr_el[new_el] to env->pc (for AArch64).

Since the PC is alway clean, how can a tagged address get saved off? Am 
I missing something?

-Tom

  reply	other threads:[~2016-09-30 21:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-16 17:34 [Qemu-devel] [PATCH 0/3] tareget-arm: Handle tagged addresses when loading PC Thomas Hanson
2016-09-16 17:34 ` [Qemu-devel] [PATCH 1/3] target-arm: Infrastucture changes to enable handling of tagged address loading into PC Thomas Hanson
2016-09-30  0:58   ` Peter Maydell
2016-09-16 17:34 ` [Qemu-devel] [PATCH 2/3] target-arm: Code changes to implement overwrite of tag field on PC load Thomas Hanson
2016-09-30  1:24   ` Peter Maydell
2016-10-05 21:53     ` Tom Hanson
2016-10-05 22:01       ` Peter Maydell
2016-10-11 15:51         ` Thomas Hanson
2016-10-11 16:02           ` Richard Henderson
2016-10-11 16:12           ` Peter Maydell
2016-10-12 19:52             ` Tom Hanson
2016-09-16 17:34 ` [Qemu-devel] [PATCH 3/3] target-arm: Comments to mark location of pending work for 56 bit addresses Thomas Hanson
2016-09-30  1:27   ` Peter Maydell
2016-09-30 22:46     ` Tom Hanson
2016-09-30 23:24       ` Peter Maydell
2016-10-03 17:01         ` Tom Hanson
2016-10-03 18:26         ` Tom Hanson
2016-09-30  1:37 ` [Qemu-devel] [PATCH 0/3] tareget-arm: Handle tagged addresses when loading PC Peter Maydell
2016-09-30 21:48   ` Tom Hanson [this message]
2016-09-30 22:06     ` 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=57EEDDC7.7060407@linaro.org \
    --to=thomas.hanson@linaro.org \
    --cc=grant.likely@hpe.com \
    --cc=peter.maydell@linaro.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.