qemu-e2k/target
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
..
alpha
arm target/arm: fix smc incorrectly trapping to EL3 when secure is off 2018-11-19 15:29:08 +00:00
cris
hppa
i386 target/i386: Clear RF on SYSCALL instruction 2018-11-06 21:35:05 +01:00
lm32
m68k target/m68k: use EXCP_ILLEGAL instead of EXCP_UNSUPPORTED 2018-11-01 12:12:24 +01:00
microblaze
mips target/mips: Disable R5900 support 2018-11-17 19:29:34 +01:00
moxie
nios2
openrisc decodetree: Remove "insn" argument from trans_* expanders 2018-10-31 16:48:54 +00:00
ppc ppc/spapr_caps: Add SPAPR_CAP_NESTED_KVM_HV 2018-11-08 13:08:35 +11:00
riscv RISC-V: Respect fences for user-only emulators 2018-11-13 15:12:15 -08:00
s390x
sh4
sparc
tilegx
tricore
unicore32
xtensa