qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 02/36] target-arm: Fix handling of SCR.SMD
Date: Thu, 18 Feb 2016 14:34:34 +0000	[thread overview]
Message-ID: <1455806108-6961-3-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1455806108-6961-1-git-send-email-peter.maydell@linaro.org>

We weren't quite implementing the handling of SCR.SMD correctly.
The condition governing whether the SMD bit should apply only
for NS state is "is EL3 is AArch32", not "is the current EL AArch32".
Fix the condition, and clarify the comment both to reflect this and
to expand slightly on what's going on for the v7-no-Virtualization case.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Sergey Fedorov <serge.fdrv@gmail.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 target-arm/op_helper.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
index bd48549..4c0980e 100644
--- a/target-arm/op_helper.c
+++ b/target-arm/op_helper.c
@@ -614,12 +614,14 @@ void HELPER(pre_smc)(CPUARMState *env, uint32_t syndrome)
     int cur_el = arm_current_el(env);
     bool secure = arm_is_secure(env);
     bool smd = env->cp15.scr_el3 & SCR_SMD;
-    /* On ARMv8 AArch32, SMD only applies to NS state.
-     * On ARMv7 SMD only applies to NS state and only if EL2 is available.
-     * For ARMv7 non EL2, we force SMD to zero so we don't need to re-check
-     * the EL2 condition here.
+    /* On ARMv8 with EL3 AArch64, SMD applies to both S and NS state.
+     * On ARMv8 with EL3 AArch32, or ARMv7 with the Virtualization
+     *  extensions, SMD only applies to NS state.
+     * On ARMv7 without the Virtualization extensions, the SMD bit
+     * doesn't exist, but we forbid the guest to set it to 1 in scr_write(),
+     * so we need not special case this here.
      */
-    bool undef = is_a64(env) ? smd : (!secure && smd);
+    bool undef = arm_feature(env, ARM_FEATURE_AARCH64) ? smd : smd && !secure;
 
     if (arm_is_psci_call(cpu, EXCP_SMC)) {
         /* If PSCI is enabled and this looks like a valid PSCI call then
-- 
1.9.1

  parent reply	other threads:[~2016-02-18 14:35 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18 14:34 [Qemu-devel] [PULL 00/36] target-arm queue Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 01/36] target-arm: correct CNTFRQ access rights Peter Maydell
2016-02-18 14:34 ` Peter Maydell [this message]
2016-02-18 14:34 ` [Qemu-devel] [PULL 03/36] target-arm: Implement MDCR_EL3.TDOSA and MDCR_EL2.TDOSA traps Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 04/36] target-arm: Implement MDCR_EL2.TDRA traps Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 05/36] target-arm: Implement MDCR_EL3.TDA and MDCR_EL2.TDA traps Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 06/36] target-arm: Report correct syndrome for FPEXC32_EL2 traps Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 07/36] target-arm: Clean up trap/undef handling of SRS Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 08/36] target-arm: Move get/set_r13_banked() to op_helper.c Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 09/36] target-arm: Move bank_number() into internals.h Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 10/36] target-arm: Combine user-only and softmmu get/set_r13_banked() Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 11/36] target-arm: UNDEF in the UNPREDICTABLE SRS-from-System case Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 12/36] target-arm: Add the pmceid0 and pmceid1 registers Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 13/36] target-arm: Add the pmovsclr_el0 and pmintenclr_el1 registers Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 14/36] target-arm: Add PMUSERENR_EL0 register Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 15/36] ARM: PL061: Clear PL061 device state after reset Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 16/36] ARM: PL061: Cleaning field of PL061 device state Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 17/36] hw/sd/sdhci.c: Remove x-drive property Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 18/36] hw/sd/sd.c: QOMify Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 19/36] hw/sd/sd.c: Convert sd_reset() function into Device reset method Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 20/36] hw/sd: Add QOM bus which SD cards plug in to Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 21/36] hw/sd/sdhci.c: Update to use SDBus APIs Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 22/36] sdhci_sysbus: Create SD card device in users, not the device itself Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 23/36] hw/sd/pxa2xx_mmci: convert to SysBusDevice object Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 24/36] hw/sd/pxa2xx_mmci: Update to use new SDBus APIs Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 25/36] hw/sd/pxa2xx_mmci: Convert to VMStateDescription Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 26/36] hw/sd/pxa2xx_mmci: Add reset function Peter Maydell
2016-02-18 14:34 ` [Qemu-devel] [PULL 27/36] hw/sd: implement CMD23 (SET_BLOCK_COUNT) for MMC compatibility Peter Maydell
2016-02-18 14:35 ` [Qemu-devel] [PULL 28/36] hw/sd: model a power-up delay, as a workaround for an EDK2 bug Peter Maydell
2016-02-18 14:35 ` [Qemu-devel] [PULL 29/36] hw/sd: use guest error logging rather than fprintf to stderr Peter Maydell
2016-02-18 14:35 ` [Qemu-devel] [PULL 30/36] hw/timer: QOM'ify arm_timer (pass 1) Peter Maydell
2016-02-18 14:35 ` [Qemu-devel] [PULL 31/36] hw/timer: QOM'ify arm_timer (pass 2) Peter Maydell
2016-02-18 14:35 ` [Qemu-devel] [PULL 32/36] hw/timer: QOM'ify exynos4210_mct Peter Maydell
2016-02-18 14:35 ` [Qemu-devel] [PULL 33/36] hw/timer: QOM'ify exynos4210_pwm Peter Maydell
2016-02-18 14:35 ` [Qemu-devel] [PULL 34/36] hw/timer: QOM'ify exynos4210_rtc Peter Maydell
2016-02-18 14:35 ` [Qemu-devel] [PULL 35/36] hw/timer: QOM'ify pl031 Peter Maydell
2016-02-18 14:35 ` [Qemu-devel] [PULL 36/36] hw/timer: QOM'ify pxa2xx_timer Peter Maydell
2016-02-18 15:19 ` [Qemu-devel] [PULL 00/36] target-arm queue 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=1455806108-6961-3-git-send-email-peter.maydell@linaro.org \
    --to=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 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).