xemu/accel/tcg
Daniel Henrique Barboza 1770b2f2d3 accel/tcg: Add 'size' param to probe_access_flags()
probe_access_flags() as it is today uses probe_access_full(), which in
turn uses probe_access_internal() with size = 0. probe_access_internal()
then uses the size to call the tlb_fill() callback for the given CPU.
This size param ('fault_size' as probe_access_internal() calls it) is
ignored by most existing .tlb_fill callback implementations, e.g.
arm_cpu_tlb_fill(), ppc_cpu_tlb_fill(), x86_cpu_tlb_fill() and
mips_cpu_tlb_fill() to name a few.

But RISC-V riscv_cpu_tlb_fill() actually uses it. The 'size' parameter
is used to check for PMP (Physical Memory Protection) access. This is
necessary because PMP does not make any guarantees about all the bytes
of the same page having the same permissions, i.e. the same page can
have different PMP properties, so we're forced to make sub-page range
checks. To allow RISC-V emulation to do a probe_acess_flags() that
covers PMP, we need to either add a 'size' param to the existing
probe_acess_flags() or create a new interface (e.g.
probe_access_range_flags).

There are quite a few probe_* APIs already, so let's add a 'size' param
to probe_access_flags() and re-use this API. This is done by open coding
what probe_access_full() does inside probe_acess_flags() and passing the
'size' param to probe_acess_internal(). Existing probe_access_flags()
callers use size = 0 to not change their current API usage. 'size' is
asserted to enforce single page access like probe_access() already does.

No behavioral changes intended.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Message-Id: <20230223234427.521114-2-dbarboza@ventanamicro.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2023-02-28 10:32:31 -10:00
..
atomic_common.c.inc tcg: Add tcg_gen_{non}atomic_cmpxchg_i128 2023-02-04 06:19:42 -10:00
atomic_template.h Replace config-time define HOST_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
cpu-exec-common.c accel/tcg: Remove will_exit argument from cpu_restore_state 2022-11-01 08:31:41 +11:00
cpu-exec.c replay: Extract core API to 'exec/replay-core.h' 2023-02-27 22:29:01 +01:00
cputlb.c accel/tcg: Add 'size' param to probe_access_flags() 2023-02-28 10:32:31 -10:00
debuginfo.c accel/tcg: Add debuginfo support 2023-01-16 10:14:12 -10:00
debuginfo.h coroutine: Split qemu/coroutine-core.h off qemu/coroutine.h 2023-01-20 07:21:46 +01:00
internal.h accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation 2023-02-27 22:29:01 +01:00
ldst_common.c.inc exec/memop: Adding signedness to quad definitions 2022-01-08 15:46:10 +10:00
meson.build accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation 2023-02-27 22:29:01 +01:00
monitor.c accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation 2023-02-27 22:29:01 +01:00
perf.c tcg: add perfmap and jitdump 2023-01-16 10:14:12 -10:00
perf.h tcg: add perfmap and jitdump 2023-01-16 10:14:12 -10:00
plugin-gen.c plugins: fix optimization in plugin_gen_disable_mem_helpers 2023-02-02 11:48:20 +00:00
plugin-helpers.h tcg: exclude non-memory effecting helpers from instrumentation 2023-02-02 11:48:20 +00:00
tb-context.h tcg: Move tb_phys_invalidate_count to tb_ctx 2021-07-09 09:38:33 -07:00
tb-hash.h include/hw/core: Create struct CPUJumpCache 2022-10-04 12:13:12 -07:00
tb-jmp-cache.h cpu: free cpu->tb_jmp_cache with RCU 2023-02-02 11:48:20 +00:00
tb-maint.c accel/tcg: Fix tb_invalidate_phys_page_unwind 2023-01-05 11:41:29 -08:00
tcg-accel-ops-icount.c icount: Take iothread lock when running QEMU timers 2022-08-09 10:55:14 +01:00
tcg-accel-ops-icount.h Clean up header guards that don't match their file name 2022-05-11 16:49:06 +02:00
tcg-accel-ops-mttcg.c Revert "accel/tcg: Init TCG cflags in vCPU thread handler" 2022-10-25 22:01:14 +10:00
tcg-accel-ops-mttcg.h Clean up header guards that don't match their file name 2022-05-11 16:49:06 +02:00
tcg-accel-ops-rr.c Revert incorrect cflags initialization. 2022-10-26 10:53:41 -04:00
tcg-accel-ops-rr.h Clean up header guards that don't match their file name 2022-05-11 16:49:06 +02:00
tcg-accel-ops.c hw/cpu: Extend CPUState::cluster_index documentation 2023-02-27 22:29:01 +01:00
tcg-accel-ops.h Clean up header guards that don't match their file name 2022-05-11 16:49:06 +02:00
tcg-all.c replay: Extract core API to 'exec/replay-core.h' 2023-02-27 22:29:01 +01:00
tcg-runtime-gvec.c accel/tcg: Use add/sub overflow routines in tcg-runtime-gvec.c 2021-05-16 07:13:51 -05:00
tcg-runtime.c accel/tcg: Move helper_lookup_tb_ptr to cpu-exec.c 2021-07-09 20:23:06 -07:00
tcg-runtime.h tcg: Add tcg_gen_{non}atomic_cmpxchg_i128 2023-02-04 06:19:42 -10:00
trace-events accel/tcg: Remove trace events from trace-root.h 2022-12-20 17:11:12 -08:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
translate-all.c exec: Remove unused 'qemu/timer.h' timer 2023-02-27 22:29:01 +01:00
translator.c replay: Extract core API to 'exec/replay-core.h' 2023-02-27 22:29:01 +01:00
user-exec-stub.c replay: Extract core API to 'exec/replay-core.h' 2023-02-27 22:29:01 +01:00
user-exec.c accel/tcg: Add 'size' param to probe_access_flags() 2023-02-28 10:32:31 -10:00