qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Rebecca Cran <rebecca@nuviainc.com>,
	qemu-arm@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 1/3] target/arm: Add support for FEAT_SSBS, Speculative Store Bypass Safe
Date: Mon, 15 Feb 2021 16:19:19 -0800	[thread overview]
Message-ID: <e4233ca8-72a2-5213-1832-b326db071b49@linaro.org> (raw)
In-Reply-To: <20210215215819.1142-2-rebecca@nuviainc.com>

On 2/15/21 1:58 PM, Rebecca Cran wrote:
> @@ -960,6 +960,12 @@ static void cpsr_write_from_spsr_elx(CPUARMState *env,
>          val |= CPSR_DIT;
>      }
>  
> +    /* Move SSBS to the correct location for CPSR */
> +    if (val & PSTATE_SSBS) {
> +        val &= ~PSTATE_SSBS;
> +        val |= CPSR_SSBS;
> +    }

Incorrect.  SPSR_ELx leaves this at the same position as CPSR: bit 23.

>          }
> +
> +        if (cpu_isar_feature(aa32_ssbs, env_archcpu(env))) {
> +            if (env->cp15.sctlr_el[new_el] & SCTLR_DSSBS_32) {
> +                env->uncached_cpsr |= CPSR_SSBS;
> +            } else {
> +                env->uncached_cpsr &= ~CPSR_SSBS;
> +            }
> +        }

Hoist this so that it can be shared with the HYP branch (hsctlr is mapped to
sctlr_el[2] and HYP maps to el=2).

> @@ -9809,6 +9846,13 @@ static uint32_t cpsr_read_for_spsr_elx(CPUARMState *env)
>          ret &= ~CPSR_DIT;
>          ret |= PSTATE_DIT;
>      }
> +
> +    /* Move SSBS to the correct location for SPSR_ELx */
> +    if (ret & CPSR_SSBS) {
> +        ret &= ~CPSR_SSBS;
> +        ret |= PSTATE_SSBS;
> +    }

Incorrect, like in cpsr_write_from_spsr_elx.

> diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
> index 1c4b8d02f3b8..2372d55ea18b 100644
> --- a/target/arm/translate-a64.c
> +++ b/target/arm/translate-a64.c
> @@ -1712,6 +1712,18 @@ static void handle_msr_i(DisasContext *s, uint32_t insn,
>          /* There's no need to rebuild hflags because DIT is a nop */
>          break;
>  
> +    case 0x19: /* SSBS */
> +        if (!dc_isar_feature(aa64_ssbs, s)) {
> +            goto do_unallocated;
> +        }
> +        if (crm & 1) {
> +            set_pstate_bits(PSTATE_SSBS);
> +        } else {
> +            clear_pstate_bits(PSTATE_SSBS);
> +        }
> +        /* Don't need to rebuild hflags since SSBS is a nop */
> +        break;

Put this above DIT (0x1a) to keep the numbers in order.


r~


  reply	other threads:[~2021-02-16  0:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 21:58 [PATCH 0/3] target/arm: Add support for FEAT_SSBS Rebecca Cran
2021-02-15 21:58 ` [PATCH 1/3] target/arm: Add support for FEAT_SSBS, Speculative Store Bypass Safe Rebecca Cran
2021-02-16  0:19   ` Richard Henderson [this message]
2021-02-16  2:15     ` Rebecca Cran
2021-02-15 21:58 ` [PATCH 2/3] target/arm: Enable FEAT_SSBS for "max" AARCH64 CPU Rebecca Cran
2021-02-16  0:20   ` Richard Henderson
2021-02-15 21:58 ` [PATCH 3/3] target/arm: Set ID_PFR2.SSBS to 1 for "max" 32-bit CPU Rebecca Cran
2021-02-16  0:20   ` 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=e4233ca8-72a2-5213-1832-b326db071b49@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.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).