From: Richard Henderson <richard.henderson@linaro.org>
To: Rebecca Cran <rebecca@nuviainc.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH 1/2] target/arm: add support for FEAT_DIT, Data Independent Timing
Date: Fri, 11 Dec 2020 08:08:37 -0600 [thread overview]
Message-ID: <6dd32a22-e3a6-db57-fc5b-9a3da4e1a709@linaro.org> (raw)
In-Reply-To: <20201211051359.3231-2-rebecca@nuviainc.com>
On 12/10/20 11:13 PM, Rebecca Cran wrote:
> Add support for FEAT_DIT. DIT (Data Independent Timing) is a required
> feature for ARMv8.4. Since virtual machine execution is largely
> nondeterministic, it's implemented as a NOP.
Alternately, or additionally, TCG is outside of the security domain (only
hardware accelerators like KVM are inside), and so we may implement this as a NOP.
>
> Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
> ---
> target/arm/cpu.h | 20 +++++++++++++-
> target/arm/helper.c | 28 +++++++++++++++++++-
> target/arm/internals.h | 6 +++++
> target/arm/translate-a64.c | 14 ++++++++++
> 4 files changed, 66 insertions(+), 2 deletions(-)
>
> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
> index 4c9cbfbd9975..862be662cef7 100644
> --- a/target/arm/cpu.h
> +++ b/target/arm/cpu.h
> @@ -269,6 +269,7 @@ typedef struct CPUARMState {
> uint32_t NF; /* N is bit 31. All other bits are undefined. */
> uint32_t ZF; /* Z set if zero. */
> uint32_t QF; /* 0 or 1 */
> + uint32_t DIT; /* 0 or 1 */
You don't need to add this. Leave the DIT bit in uncached_cpsr.
> +++ b/target/arm/translate-a64.c
> @@ -1696,6 +1696,20 @@ static void handle_msr_i(DisasContext *s, uint32_t insn,
> tcg_temp_free_i32(t1);
> break;
>
> + case 0x1a: /* DIT */
> + if (!dc_isar_feature(aa64_dit, s)) {
> + goto do_unallocated;
> + }
> + if (crm & 1) {
> + set_pstate_bits(PSTATE_DIT);
> + } else {
> + clear_pstate_bits(PSTATE_DIT);
> + }
> + t1 = tcg_const_i32(s->current_el);
> + gen_helper_rebuild_hflags_a64(cpu_env, t1);
> + tcg_temp_free_i32(t1);
> + break;
You don't need to rebuild hflags, because the implementation of DIT is a nop.
All you need is to record the pstate change. You may wish to add a comment
here about that, reminding the reader.
r~
next prev parent reply other threads:[~2020-12-11 15:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 5:13 [PATCH 0/2] target/arm: Add support for DIT (Data Independent Timing) Rebecca Cran
2020-12-11 5:13 ` [PATCH 1/2] target/arm: add support for FEAT_DIT, Data Independent Timing Rebecca Cran
2020-12-11 14:08 ` Richard Henderson [this message]
2020-12-11 19:33 ` Rebecca Cran
2020-12-11 19:51 ` Richard Henderson
2020-12-11 21:37 ` Peter Maydell
2020-12-14 18:11 ` Rebecca Cran
2020-12-14 18:48 ` Peter Maydell
2020-12-11 5:13 ` [PATCH 2/2] target/arm: Set ID_AA64PFR0.DIT and ID_PFR0.DIT to 1 for "max" AA64 CPU Rebecca Cran
2020-12-11 14:09 ` Richard Henderson
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=6dd32a22-e3a6-db57-fc5b-9a3da4e1a709@linaro.org \
--to=richard.henderson@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rebecca@nuviainc.com \
/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).