qemu/target/arm
John Högberg 9719f125b8 target/arm: Handle IC IVAU to improve compatibility with JITs
Unlike architectures with precise self-modifying code semantics
(e.g. x86) ARM processors do not maintain coherency for instruction
execution and memory, requiring an instruction synchronization
barrier on every core that will execute the new code, and on many
models also the explicit use of cache management instructions.

While this is required to make JITs work on actual hardware, QEMU
has gotten away with not handling this since it does not emulate
caches, and unconditionally invalidates code whenever the softmmu
or the user-mode page protection logic detects that code has been
modified.

Unfortunately the latter does not work in the face of dual-mapped
code (a common W^X workaround), where one page is executable and
the other is writable: user-mode has no way to connect one with the
other as that is only known to the kernel and the emulated
application.

This commit works around the issue by telling software that
instruction cache invalidation is required by clearing the
CPR_EL0.DIC flag (regardless of whether the emulated processor
needs it), and then invalidating code in IC IVAU instructions.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1034

Co-authored-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: John Högberg <john.hogberg@ericsson.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 168778890374.24232.3402138851538068785-1@git.sr.ht
[PMM: removed unnecessary AArch64 feature check; moved
 "clear CTR_EL1.DIC" code up a bit so it's not in the middle
 of the vfp/neon related tests]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-07-06 12:58:42 +01:00
..
hvf accel: Rename HVF 'struct hvf_vcpu_state' -> AccelCPUState 2023-06-28 14:14:22 +02:00
tcg target/arm: Fix SME full tile indexing 2023-07-06 12:56:21 +01:00
arch_dump.c
arm-powerctl.c target/arm: Wrap arm_rebuild_hflags calls with tcg_enabled 2023-02-27 13:27:04 +00:00
arm-powerctl.h
arm-qmp-cmds.c target/arm: Restrict 'qapi-commands-machine.h' to system emulation 2023-03-02 07:51:06 +01:00
common-semi-target.h
cortex-regs.c target/arm: Saturate L2CTLR_EL1 core count field rather than overflowing 2023-05-18 11:39:33 +01:00
cpregs.h accel/tcg: Introduce translator_io_start 2023-06-05 12:04:29 -07:00
cpu64.c target/arm: Move 64-bit TCG CPUs into tcg/ 2023-05-02 10:21:32 +01:00
cpu-param.h target/arm: Remove NB_MMU_MODES define 2023-03-13 06:44:37 -07:00
cpu-qom.h target/arm: Convert to 3-phase reset 2022-12-16 15:58:15 +00:00
cpu.c target/arm: Handle IC IVAU to improve compatibility with JITs 2023-07-06 12:58:42 +01:00
cpu.h target/arm: Restrict KVM-specific fields from ArchCPU 2023-06-28 14:27:59 +02:00
debug_helper.c target/arm: trap DCC access in user mode emulation 2023-06-06 10:19:40 +01:00
gdbstub64.c target/arm: Correct AArch64.S2MinTxSZ 32-bit EL1 input size check 2023-05-12 16:01:25 +01:00
gdbstub.c target/arm: Report pauth information to gdb as 'pauth_v2' 2023-04-20 10:21:16 +01:00
helper.c target/arm: Handle IC IVAU to improve compatibility with JITs 2023-07-06 12:58:42 +01:00
helper.h target/arm: Move helper-{a64,mve,sme,sve}.h to tcg/ 2023-05-12 15:43:37 +01:00
hvf_arm.h hvf: add guest debugging handlers for Apple Silicon hosts 2023-06-06 10:19:30 +01:00
hyp_gdbstub.c arm: move KVM breakpoints helpers 2023-06-06 10:19:29 +01:00
idau.h
internals.h target/arm: Implement GPC exceptions 2023-06-23 11:15:48 +01:00
Kconfig target/arm: Explain why we need to select ARM_V7M 2023-05-30 15:50:17 +01:00
kvm64.c arm: move KVM breakpoints helpers 2023-06-06 10:19:29 +01:00
kvm_arm.h hw/intc/arm_gic: Un-inline GIC*/ITS class_name() helpers 2023-06-28 14:27:59 +02:00
kvm-consts.h target/arm: Remove KVM AArch32 CPU definitions 2023-04-20 10:21:15 +01:00
kvm-stub.c
kvm.c exec/memory: Add symbol for the min value of memory listener priority 2023-06-28 14:27:59 +02:00
machine.c target/arm: Wrap arm_rebuild_hflags calls with tcg_enabled 2023-02-27 13:27:04 +00:00
meson.build meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
op_addsub.h
ptw.c plugins: force slow path when plugins instrument memory ops 2023-07-03 12:51:58 +01:00
syndrome.h target/arm: Add GPC syndrome 2023-06-23 11:15:47 +01:00
tcg-stubs.c target/arm: Move hflags code into the tcg directory 2023-02-27 13:27:04 +00:00
trace-events
trace.h
vfp_helper.c target/arm: Use float64_to_int32_modulo for FJCVTZS 2023-07-01 08:26:54 +02:00