qemu/target/arm
Luc Michel 7760da729a target/arm: fix smc incorrectly trapping to EL3 when secure is off
This commit fixes a case where the CPU would try to go to EL3 when
executing an smc instruction, even though ARM_FEATURE_EL3 is false. This
case is raised when the PSCI conduit is set to smc, but the smc
instruction does not lead to a valid PSCI call.

QEMU crashes with an assertion failure latter on because of incoherent
mmu_idx.

This commit refactors the pre_smc helper by enumerating all the possible
way of handling an scm instruction, and covering the previously missing
case leading to the crash.

The following minimal test would crash before this commit:

.global _start
    .text
_start:
    ldr x0, =0xdeadbeef  ; invalid PSCI call
    smc #0

run with the following command line:

aarch64-linux-gnu-gcc -nostdinc -nostdlib -Wl,-Ttext=40000000 \
                      -o test test.s

qemu-system-aarch64 -M virt,virtualization=on,secure=off \
                    -cpu cortex-a57 -kernel test

Signed-off-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20181117160213.18995-1-luc.michel@greensocs.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-11-19 15:29:08 +00:00
..
arch_dump.c target/arm: Add aa{32, 64}_vfp_{dreg, qreg} helpers 2018-01-25 11:45:29 +00:00
arm_ldst.h target: Do not include "exec/exec-all.h" if it is not necessary 2018-06-01 14:15:10 +02:00
arm-powerctl.c target-arm: powerctl: Enable HVC when starting CPUs to EL2 2018-10-16 17:14:55 +01:00
arm-powerctl.h target-arm/powerctl: defer cpu reset work to CPU context 2017-02-24 10:32:46 +00:00
arm-semi.c target/arm: Remove a handful of stray tabs 2018-08-24 13:17:48 +01:00
cpu64.c target/arm: Convert v8.2-fp16 from feature bit to aa64pfr0 test 2018-10-24 07:51:31 +01:00
cpu-qom.h target/arm: Add "-cpu max" support 2018-03-09 17:09:44 +00:00
cpu.c target/arm/cpu: Give Cortex-A15 and -A7 the EL2 feature 2018-11-13 10:47:59 +00:00
cpu.h target/arm: Track the state of our irq lines from the GIC explicitly 2018-11-13 10:47:59 +00:00
crypto_helper.c target: Do not include "exec/exec-all.h" if it is not necessary 2018-06-01 14:15:10 +02:00
gdbstub64.c
gdbstub.c arm: fix malloc type mismatch 2018-05-31 14:50:52 +01:00
helper-a64.c target/arm: Check HAVE_CMPXCHG128 at translate time 2018-10-18 19:46:53 -07:00
helper-a64.h target/arm: Implement FCMP for fp16 2018-05-15 14:58:43 +01:00
helper-sve.h target/arm: Rewrite vector gather first-fault loads 2018-10-08 14:55:03 +01:00
helper.c target/arm: Hyp mode R14 is shared with User and System 2018-11-13 10:47:59 +00:00
helper.h target/arm: Add v8M stack checks on ADD/SUB/MOV of SP 2018-10-08 14:55:04 +01:00
idau.h target/arm: Define an IDAU interface 2018-03-02 11:03:45 +00:00
internals.h target/arm: Hyp mode R14 is shared with User and System 2018-11-13 10:47:59 +00:00
iwmmxt_helper.c target/arm: Untabify iwmmxt_helper.c 2018-08-24 13:17:48 +01:00
kvm32.c target/arm: Fill in ARMISARegisters for kvm32 2018-11-19 15:29:08 +00:00
kvm64.c target/arm: Fill in ARMISARegisters for kvm64 2018-11-19 15:29:07 +00:00
kvm_arm.h target/arm: Install ARMISARegisters from kvm host 2018-11-19 15:29:07 +00:00
kvm-consts.h arm: add trailing ; after MISMATCH_CHECK 2017-02-01 03:37:18 +02:00
kvm-stub.c
kvm.c target/arm: Install ARMISARegisters from kvm host 2018-11-19 15:29:07 +00:00
machine.c target/arm: Track the state of our irq lines from the GIC explicitly 2018-11-13 10:47:59 +00:00
Makefile.objs target/arm: Implement SVE predicate test 2018-05-18 17:48:08 +01:00
monitor.c qapi: Empty out qapi-schema.json 2018-03-02 13:45:50 -06:00
neon_helper.c target: Do not include "exec/exec-all.h" if it is not necessary 2018-06-01 14:15:10 +02:00
op_addsub.h
op_helper.c target/arm: fix smc incorrectly trapping to EL3 when secure is off 2018-11-19 15:29:08 +00:00
psci.c target: Do not include "exec/exec-all.h" if it is not necessary 2018-06-01 14:15:10 +02:00
sve_helper.c target/arm: Pass TCGMemOpIdx to sve memory helpers 2018-10-08 14:55:03 +01:00
sve.decode target/arm: Implement SVE dot product (indexed) 2018-06-29 15:11:15 +01:00
trace-events target/arm/kvm: Translate the MSI doorbell in kvm_arch_fixup_msi_route 2018-05-04 18:52:58 +01:00
translate-a64.c target/arm: Remove can't-happen if() from handle_vec_simd_shli() 2018-11-06 11:32:13 +00:00
translate-a64.h target/arm: Extend vec_reg_offset to larger sizes 2018-06-15 15:23:34 +01:00
translate-sve.c decodetree: Remove "insn" argument from trans_* expanders 2018-10-31 16:48:54 +00:00
translate.c target/arm: Reorg NEON VLD/VST single element to one lane 2018-10-24 07:51:37 +01:00
translate.h target/arm: Use gvec for NEON_3R_VTST_VCEQ, NEON_3R_VCGT, NEON_3R_VCGE 2018-10-24 07:51:37 +01:00
vec_helper.c target/arm: Implement SVE dot product (indexed) 2018-06-29 15:11:15 +01:00