accel/tcg: Extract cpu-loop API out of 'exec/cpu-common.h'
Subsystems (2)
v2 cover accel/tcg: Extract cpu-loop API out of 'exec/cpu-common.h'
Missing review: 8 & 9
Since v1:
- Do not un-inline cpu_loop_exit_requested()
We still try to clarify our different APIs, in particular TCG emulation vs hardware accelerators. Extract the TCG vcpu loop methods out of the generic "exec/cpu-common.h" and move them under the 'accel/tcg/' namespace.
Philippe Mathieu-Daudé (11):
target/arm: Restrict TCG specific headers
hw/s390x/ipl: Remove TCG dependency in handle_diag_308() accel/tcg: Remove cpu_loop_exit() stub
accel/tcg: Move cpu_exec() out of 'exec/cpu-common.h' accel/tcg: Move cpu_exec_step_atomic() out of 'exec/cpu-common.h' accel/tcg: Move cpu_unwind_state_data() out of 'exec/cpu-common.h' accel/tcg: Move cpu_restore_state() out of 'exec/cpu-common.h' accel/tcg: Have cpu_loop_exit_requested() take const @cpu argument accel/tcg: Move cpu_loop_exit_requested() out of 'exec/cpu-common.h' accel/tcg: Move cpu_loop_exit_*() out of 'exec/cpu-common.h' accel/tcg: Restrict headers being TCG specific
bsd-user/freebsd/os-proc.h | 1 + include/accel/tcg/cpu-loop.h | 73 ++++++++++++++++++++++++++++ include/accel/tcg/cpu-mmu-index.h | 4 ++ include/accel/tcg/cpu-ops.h | 4 ++ include/accel/tcg/getpc.h | 4 ++ include/accel/tcg/helper-retaddr.h | 4 ++ include/accel/tcg/probe.h | 4 ++ include/accel/tcg/tb-cpu-state.h | 4 ++ include/exec/cpu-common.h | 56 --------------------- include/hw/core/cpu.h | 20 ++++++++ include/user/cpu_loop.h | 2 +- target/arm/internals.h | 4 +- target/s390x/s390x-internal.h | 3 +- accel/stubs/tcg-stub.c | 20 -------- accel/tcg/cpu-exec-common.c | 1 + accel/tcg/cpu-exec.c | 1 + accel/tcg/cputlb.c | 1 + accel/tcg/tb-maint.c | 1 + accel/tcg/tcg-accel-ops-mttcg.c | 1 + accel/tcg/tcg-accel-ops-rr.c | 1 + accel/tcg/tcg-accel-ops.c | 1 + accel/tcg/tcg-runtime.c | 1 + accel/tcg/translate-all.c | 1 + accel/tcg/user-exec.c | 1 + accel/tcg/watchpoint.c | 1 + bsd-user/main.c | 1 + hw/misc/mips_itu.c | 1 + hw/s390x/ipl.c | 5 -- plugins/api.c | 1 + semihosting/console.c | 1 + target/alpha/helper.c | 1 + target/alpha/mem_helper.c | 1 + target/arm/cpu-irq.c | 3 +- target/arm/tcg/helper-a64.c | 2 + target/arm/tcg/op_helper.c | 1 + target/arm/tcg/tlb_helper.c | 1 + target/avr/helper.c | 1 + target/hexagon/op_helper.c | 1 + target/hppa/cpu.c | 1 + target/hppa/mem_helper.c | 1 + target/hppa/op_helper.c | 1 + target/i386/helper.c | 1 + target/i386/tcg/excp_helper.c | 1 + target/i386/tcg/misc_helper.c | 1 + target/i386/tcg/system/bpt_helper.c | 1 + target/i386/tcg/system/misc_helper.c | 1 + target/i386/tcg/system/svm_helper.c | 1 + target/i386/tcg/user/excp_helper.c | 1 + target/i386/tcg/user/seg_helper.c | 1 + target/loongarch/tcg/tcg_cpu.c | 1 + target/loongarch/tcg/tlb_helper.c | 1 + target/m68k/helper.c | 1 + target/m68k/op_helper.c | 1 + target/microblaze/helper.c | 1 + target/microblaze/op_helper.c | 1 + target/mips/tcg/exception.c | 1 + target/mips/tcg/system/tlb_helper.c | 1 + target/or1k/exception_helper.c | 1 + target/or1k/fpu_helper.c | 1 + target/or1k/mmu.c | 1 + target/or1k/sys_helper.c | 1 + target/ppc/tcg-excp_helper.c | 1 + target/ppc/user_only_helper.c | 1 + target/riscv/cpu_helper.c | 1 + target/riscv/csr.c | 1 + target/riscv/op_helper.c | 1 + target/rx/op_helper.c | 1 + target/s390x/diag.c | 32 ++++++------ target/s390x/mmu_helper.c | 3 ++ target/s390x/tcg/cc_helper.c | 1 + target/s390x/tcg/debug.c | 1 + target/s390x/tcg/excp_helper.c | 1 + target/s390x/tcg/mem_helper.c | 2 + target/s390x/tcg/misc_helper.c | 6 ++- target/sh4/helper.c | 1 + target/sh4/op_helper.c | 1 + target/sparc/helper.c | 1 + target/sparc/mmu_helper.c | 1 + target/tricore/helper.c | 1 + target/tricore/op_helper.c | 1 + target/xtensa/exc_helper.c | 1 + target/xtensa/helper.c | 1 + accel/stubs/meson.build | 1 - 83 files changed, 215 insertions(+), 103 deletions(-) create mode 100644 include/accel/tcg/cpu-loop.h delete mode 100644 accel/stubs/tcg-stub.c
Signature · 1 line
2.53.0
PATCH v2 1/11 target/arm: Restrict TCG specific headers
Avoid including TCG-specific headers in non-TCG builds.
--- target/arm/internals.h | 4 +++- target/arm/cpu-irq.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-)
target/arm/internals.h +3 -1
@@ -29,9 +29,11 @@#include "exec/vaddr.h" #include "exec/breakpoint.h" #include "exec/memop.h" +#ifdef CONFIG_TCG #include "accel/tcg/tb-cpu-state.h" -#include "hw/core/registerfields.h" #include "tcg/tcg-gvec-desc.h" +#endif +#include "hw/core/registerfields.h" #include "system/memory.h" #include "syndrome.h" #include "cpu-features.h"
target/arm/cpu-irq.c +2 -1
@@ -8,10 +8,11 @@#include "qemu/osdep.h" #include "cpu.h" -#include "accel/tcg/cpu-ops.h" #include "internals.h" #ifdef CONFIG_TCG +#include "accel/tcg/cpu-ops.h" + static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx, unsigned int target_el, unsigned int cur_el, bool secure,
Signature · 1 line
2.53.0
PATCH v2 2/11 hw/s390x/ipl: Remove TCG dependency in handle_diag_308()
In reply to Philippe Mathieu-DaudéRather than calling a TCG specific method in s390_ipl_reset_request(), have handle_diag_308() return whether a vCPU reset is pending, and use that in the TCG DIAG helper to return to the main loop.
--- target/s390x/s390x-internal.h | 3 ++- hw/s390x/ipl.c | 5 ----- target/s390x/diag.c | 32 ++++++++++++++++---------------- target/s390x/tcg/misc_helper.c | 5 ++++- 4 files changed, 22 insertions(+), 23 deletions(-)
target/s390x/s390x-internal.h +2 -1
@@ -385,7 +385,8 @@ int mmu_translate_real(CPUS390XState *env, hwaddr raddr, int rw,/* misc_helper.c */ int handle_diag_288 (CPUS390XState *env,uint64_t r1,uint64_t r3); -void handle_diag_308 (CPUS390XState *env,uint64_t r1,uint64_t r3, +/* Return whether a CPU reset is pending */ +bool handle_diag_308 (CPUS390XState *env,uint64_t r1,uint64_t r3,uintptr_t ra);
hw/s390x/ipl.c +0 -5
@@ -18,7 +18,6 @@#include "system/physmem.h" #include "system/reset.h" #include "system/runstate.h" -#include "system/tcg.h" #include "elf.h" #include "hw/core/loader.h" #include "hw/core/qdev-properties.h"
@@ -690,10 +689,6 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_reset reset_type) }else {qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } -/* as this is triggered by a CPU, make sure to exit the loop */ -if (tcg_enabled ()) { -cpu_loop_exit (cs); - } }void s390_ipl_get_reset_request (CPUState **cs,enum s390_reset *reset_type)
target/s390x/diag.c +16 -16
@@ -95,7 +95,7 @@ static void s390_ipl_write(CPUS390XState *env, uint64_t addr, } } -void handle_diag_308 (CPUS390XState *env,uint64_t r1,uint64_t r3,uintptr_t ra) +bool handle_diag_308 (CPUS390XState *env,uint64_t r1,uint64_t r3,uintptr_t ra) {bool valid;CPUState *cs =env_cpu (env);
@@ -105,34 +105,34 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra)if (env->psw.mask &PSW_MASK_PSTATE ) {s390_program_interrupt (env,PGM_PRIVILEGED , ra); -return ; +return false; }if (subcode & ~0x0ffffULL ) {s390_program_interrupt (env,PGM_SPECIFICATION , ra); -return ; +return false; }if (subcode >=DIAG308_PV_SET && !s390_has_feat (S390_FEAT_UNPACK )) {s390_program_interrupt (env,PGM_SPECIFICATION , ra); -return ; +return false; }switch (subcode) {case DIAG308_RESET_MOD_CLR :s390_ipl_reset_request (cs,S390_RESET_MODIFIED_CLEAR ); -break ; +return true;case DIAG308_RESET_LOAD_NORM :s390_ipl_reset_request (cs,S390_RESET_LOAD_NORMAL ); -break ; +return true;case DIAG308_LOAD_CLEAR :/* Well we still lack the clearing bit... */ s390_ipl_reset_request (cs,S390_RESET_REIPL ); -break ; +return true;case DIAG308_SET :case DIAG308_PV_SET :if (diag308_parm_check (env, r1, addr, ra, false)) { -return ; +return false; } iplb =g_new0 (IplParameterBlock,1 );s390_ipl_read (env, addr, iplb,sizeof (iplb->len));
@@ -159,11 +159,11 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra) env->regs[r1 +1 ] =DIAG_308_RC_OK ; out:g_free (iplb); -return ; +return false;case DIAG308_STORE :case DIAG308_PV_STORE :if (diag308_parm_check (env, r1, addr, ra, true)) { -return ; +return false; }if (subcode ==DIAG308_PV_STORE ) { iplb =s390_ipl_get_iplb_pv ();
@@ -172,30 +172,30 @@ out: }if (!iplb) { env->regs[r1 +1 ] =DIAG_308_RC_NO_CONF ; -return ; +return false; }s390_ipl_write (env, addr, iplb,be32_to_cpu (iplb->len)); env->regs[r1 +1 ] =DIAG_308_RC_OK ; -return ; +return false;case DIAG308_PV_START : iplb =s390_ipl_get_iplb_pv ();if (!iplb) { env->regs[r1 +1 ] =DIAG_308_RC_NO_PV_CONF ; -return ; +return false; }if (kvm_enabled () &&kvm_s390_get_hpage_1m ()) {error_report ("Protected VMs can currently not be backed with " "huge pages" ); env->regs[r1 +1 ] =DIAG_308_RC_INVAL_FOR_PV ; -return ; +return false; }s390_ipl_reset_request (cs,S390_RESET_PV ); -break ; +return true;default :s390_program_interrupt (env,PGM_SPECIFICATION , ra); -break ; +return false; } }
target/s390x/tcg/misc_helper.c +4 -1
@@ -135,7 +135,10 @@ void HELPER(diag)(CPUS390XState *env, uint32_t r1, uint32_t r3, uint32_t num)case 0x308 :/* ipl */ bql_lock (); -handle_diag_308 (env, r1, r3,GETPC ()); +if (handle_diag_308 (env, r1, r3,GETPC ())) { +/* As reset is triggered by the CPU, make sure to exit the loop */ +cpu_loop_exit (CPU (env_archcpu (env))); + }bql_unlock (); r =0 ;break ;
Signature · 1 line
2.53.0
PATCH v2 3/11 accel/tcg: Remove cpu_loop_exit() stub
In reply to Philippe Mathieu-DaudéLast commit removed the last non-TCG use of cpu_loop_exit(). This method is now only called within TCG files, so we can remove its stub for non-TCG accelerators.
--- accel/stubs/tcg-stub.c | 20 -------------------- accel/stubs/meson.build | 1 - 2 files changed, 21 deletions(-) delete mode 100644 accel/stubs/tcg-stub.c
accel/stubs/tcg-stub.c deleted +0 -20
@@ -1,20 +0,0 @@ -/* -* QEMU TCG accelerator stub -* -* Copyright Red Hat, Inc. 2013 -* -* Author: Paolo Bonzini <[email protected]> -* -* This work is licensed under the terms of the GNU GPL, version 2 or later. -* See the COPYING file in the top-level directory. -* -*/ - -#include "qemu/osdep.h" -#include "system/tcg.h" -#include "exec/cpu-common.h" - -G_NORETURN void cpu_loop_exit(CPUState *cpu) -{ -g_assert_not_reached (); -}
accel/stubs/meson.build +0 -1
@@ -4,7 +4,6 @@ stub_ss.add(files( 'nitro-stub.c', 'mshv-stub.c', 'nvmm-stub.c', - 'tcg-stub.c', 'whpx-stub.c', 'xen-stub.c', ))
Signature · 1 line
2.53.0
PATCH v2 4/11 accel/tcg: Move cpu_exec() out of 'exec/cpu-common.h'
In reply to Philippe Mathieu-DaudéIn order to keep TCG-specific functions under a TCG API namespace, add the "accel/tcg/cpu-loop.h" header and move cpu_exec() declaration to it. Add a bit of documentation.
Include "accel/tcg/cpu-loop.h" where appropriate.
--- bsd-user/freebsd/os-proc.h | 1 + include/accel/tcg/cpu-loop.h | 16 ++++++++++++++++ include/exec/cpu-common.h | 3 --- include/user/cpu_loop.h | 2 +- accel/tcg/cpu-exec.c | 1 + accel/tcg/tcg-accel-ops.c | 1 + bsd-user/main.c | 1 + 7 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 include/accel/tcg/cpu-loop.h
bsd-user/freebsd/os-proc.h +1 -0
@@ -14,6 +14,7 @@#include <sys/procdesc.h> #include <sys/wait.h> +#include "accel/tcg/cpu-loop.h" #include "target_arch_cpu.h" pid_t safe_wait4 (pid_t wpid,int *status,int options,struct rusage *rusage);
include/accel/tcg/cpu-loop.h new file +16 -0
@@ -0,0 +1,16 @@ +#ifndef ACCEL_TCG_CPU_LOOP_COMMON_H +#define ACCEL_TCG_CPU_LOOP_COMMON_H + +#ifndef CONFIG_TCG +#error Can only include this header with TCG +#endif + +/** +* cpu_exec: +* @cpu: the cpu context +* +* Returns one of the EXCP_* definitions (see "exec/cpu-common.h"). +*/ +int cpu_exec (CPUState *cpu); + +#endif
include/exec/cpu-common.h +0 -3
@@ -114,9 +114,6 @@ G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc);#endif /* CONFIG_TCG */ G_NORETURN void cpu_loop_exit(CPUState *cpu); -/* accel/tcg/cpu-exec.c */ -int cpu_exec (CPUState *cpu); -/** * env_archcpu(env) * @env: The architecture environment
include/user/cpu_loop.h +1 -1
@@ -22,7 +22,7 @@#include "exec/vaddr.h" #include "exec/mmu-access-type.h" - +#include "accel/tcg/cpu-loop.h" /** * adjust_signal_pc:
accel/tcg/cpu-exec.c +1 -0
@@ -22,6 +22,7 @@#include "qapi/error.h" #include "qapi/type-helpers.h" #include "hw/core/cpu.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/cpu-ops.h" #include "accel/tcg/helper-retaddr.h" #include "trace.h"
accel/tcg/tcg-accel-ops.c +1 -0
@@ -28,6 +28,7 @@#include "qemu/osdep.h" #include "accel/accel-ops.h" #include "accel/accel-cpu-ops.h" +#include "accel/tcg/cpu-loop.h" #include "system/tcg.h" #include "system/replay.h" #include "exec/icount.h"
bsd-user/main.c +1 -0
@@ -39,6 +39,7 @@#include "user/guest-base.h" #include "user/page-protection.h" #include "accel/accel-ops.h" +#include "accel/tcg/cpu-loop.h" #include "tcg/startup.h" #include "qemu/timer.h" #include "qemu/envlist.h"
Signature · 1 line
2.53.0
PATCH v2 5/11 accel/tcg: Move cpu_exec_step_atomic() out of 'exec/cpu-common.h'
In reply to Philippe Mathieu-DaudéMove the TCG-specific cpu_exec_step_atomic() declaration out of the generic "exec/cpu-common.h" header, to the recently created "accel/tcg/cpu-loop.h" one.
Include "accel/tcg/cpu-loop.h" where appropriate.
--- include/accel/tcg/cpu-loop.h | 2 ++ include/exec/cpu-common.h | 2 -- accel/tcg/tcg-accel-ops-mttcg.c | 1 + accel/tcg/tcg-accel-ops-rr.c | 1 + 4 files changed, 4 insertions(+), 2 deletions(-)
include/accel/tcg/cpu-loop.h +2 -0
@@ -13,4 +13,6 @@*/ int cpu_exec (CPUState *cpu); +void cpu_exec_step_atomic (CPUState *cpu); +#endif
include/exec/cpu-common.h +0 -2
@@ -21,8 +21,6 @@#define EXCP_YIELD 0x10004/* cpu wants to yield timeslice to another */ #define EXCP_ATOMIC 0x10005/* stop-the-world and emulate atomic */ -void cpu_exec_step_atomic (CPUState *cpu); -#define REAL_HOST_PAGE_ALIGN (addr) ROUND_UP((addr), qemu_real_host_page_size())/* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */
accel/tcg/tcg-accel-ops-mttcg.c +1 -0
@@ -32,6 +32,7 @@#include "qemu/notify.h" #include "qemu/guest-random.h" #include "hw/core/boards.h" +#include "accel/tcg/cpu-loop.h" #include "tcg/startup.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-mttcg.h"
accel/tcg/tcg-accel-ops-rr.c +1 -0
@@ -32,6 +32,7 @@#include "qemu/notify.h" #include "qemu/guest-random.h" #include "exec/cpu-common.h" +#include "accel/tcg/cpu-loop.h" #include "tcg/startup.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-rr.h"
Signature · 1 line
2.53.0
PATCH v2 6/11 accel/tcg: Move cpu_unwind_state_data() out of 'exec/cpu-common.h'
In reply to Philippe Mathieu-DaudéMove the TCG-specific cpu_unwind_state_data() declaration out of the generic "exec/cpu-common.h" header, to the recently created "accel/tcg/cpu-loop.h" one.
Include "accel/tcg/cpu-loop.h" where appropriate.
--- include/accel/tcg/cpu-loop.h | 13 +++++++++++++ include/exec/cpu-common.h | 13 ------------- accel/tcg/translate-all.c | 1 + target/i386/helper.c | 1 + target/or1k/sys_helper.c | 1 + target/riscv/csr.c | 1 + 6 files changed, 17 insertions(+), 13 deletions(-)
include/accel/tcg/cpu-loop.h +13 -0
@@ -15,4 +15,17 @@ int cpu_exec(CPUState *cpu);void cpu_exec_step_atomic (CPUState *cpu); +/** +* cpu_unwind_state_data: +* @cpu: the cpu context +* @host_pc: the host pc within the translation +* @data: output data +* +* Attempt to load the unwind state for a host pc occurring in +* translated code. If @host_pc is not in translated code, the +* function returns false; otherwise @data is loaded. +* This is the same unwind info as given to restore_state_to_opc. +*/ +bool cpu_unwind_state_data (CPUState *cpu,uintptr_t host_pc,uint64_t *data); +#endif
include/exec/cpu-common.h +0 -13
@@ -64,19 +64,6 @@ void list_cpus(void);#ifdef CONFIG_TCG #include "qemu/atomic.h" -/** -* cpu_unwind_state_data: -* @cpu: the cpu context -* @host_pc: the host pc within the translation -* @data: output data -* -* Attempt to load the unwind state for a host pc occurring in -* translated code. If @host_pc is not in translated code, the -* function returns false; otherwise @data is loaded. -* This is the same unwind info as given to restore_state_to_opc. -*/ -bool cpu_unwind_state_data (CPUState *cpu,uintptr_t host_pc,uint64_t *data); -/** * cpu_restore_state: * @cpu: the cpu context
accel/tcg/translate-all.c +1 -0
@@ -29,6 +29,7 @@#include "qemu/target-info.h" #include "exec/log.h" #include "exec/icount.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/cpu-ops.h" #include "tb-jmp-cache.h" #include "tb-hash.h"
target/i386/helper.c +1 -0
@@ -32,6 +32,7 @@#endif #include "qemu/log.h" #ifdef CONFIG_TCG +#include "accel/tcg/cpu-loop.h" #include "tcg/insn-start-words.h" #endif
target/or1k/sys_helper.c +1 -0
@@ -23,6 +23,7 @@#include "exec/cputlb.h" #include "exec/target_page.h" #include "exec/helper-proto.h" +#include "accel/tcg/cpu-loop.h" #include "exception.h" #ifndef CONFIG_USER_ONLY #include "hw/core/boards.h"
target/riscv/csr.c +1 -0
@@ -26,6 +26,7 @@#include "time_helper.h" #include "exec/cputlb.h" #include "exec/icount.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/getpc.h" #include "qemu/guest-random.h" #include "qapi/error.h"
Signature · 1 line
2.53.0
PATCH v2 7/11 accel/tcg: Move cpu_restore_state() out of 'exec/cpu-common.h'
In reply to Philippe Mathieu-DaudéMove the TCG-specific cpu_restore_state() declaration out of the generic "exec/cpu-common.h" header, to the recently created "accel/tcg/cpu-loop.h" one.
Include "accel/tcg/cpu-loop.h" where appropriate.
--- include/accel/tcg/cpu-loop.h | 12 ++++++++++++ include/exec/cpu-common.h | 12 ------------ accel/tcg/cpu-exec-common.c | 1 + accel/tcg/user-exec.c | 1 + target/alpha/helper.c | 1 + target/alpha/mem_helper.c | 1 + target/arm/tcg/op_helper.c | 1 + target/arm/tcg/tlb_helper.c | 1 + target/hppa/cpu.c | 1 + target/hppa/mem_helper.c | 1 + target/hppa/op_helper.c | 1 + target/i386/tcg/system/svm_helper.c | 1 + target/m68k/op_helper.c | 1 + target/microblaze/helper.c | 1 + target/ppc/tcg-excp_helper.c | 1 + target/s390x/tcg/excp_helper.c | 1 + target/sh4/op_helper.c | 1 + target/tricore/op_helper.c | 1 + target/xtensa/helper.c | 1 + 19 files changed, 29 insertions(+), 12 deletions(-)
include/accel/tcg/cpu-loop.h +12 -0
@@ -28,4 +28,16 @@ void cpu_exec_step_atomic(CPUState *cpu);*/ bool cpu_unwind_state_data (CPUState *cpu,uintptr_t host_pc,uint64_t *data); +/** +* cpu_restore_state: +* @cpu: the cpu context +* @host_pc: the host pc within the translation +* @return: true if state was restored, false otherwise +* +* Attempt to restore the state for a fault occurring in translated +* code. If @host_pc is not in translated code no state is +* restored and the function returns false. +*/ +bool cpu_restore_state (CPUState *cpu,uintptr_t host_pc); +#endif
include/exec/cpu-common.h +0 -12
@@ -64,18 +64,6 @@ void list_cpus(void);#ifdef CONFIG_TCG #include "qemu/atomic.h" -/** -* cpu_restore_state: -* @cpu: the cpu context -* @host_pc: the host pc within the translation -* @return: true if state was restored, false otherwise -* -* Attempt to restore the state for a fault occurring in translated -* code. If @host_pc is not in translated code no state is -* restored and the function returns false. -*/ -bool cpu_restore_state (CPUState *cpu,uintptr_t host_pc); -/** * cpu_loop_exit_requested: * @cpu: The CPU state to be tested
accel/tcg/cpu-exec-common.c +1 -0
@@ -21,6 +21,7 @@#include "exec/log.h" #include "system/tcg.h" #include "qemu/plugin.h" +#include "accel/tcg/cpu-loop.h" #include "internal-common.h" bool tcg_allowed;
accel/tcg/user-exec.c +1 -0
@@ -25,6 +25,7 @@#include "qemu/bitops.h" #include "qemu/rcu.h" #include "accel/tcg/cpu-ldst-common.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/helper-retaddr.h" #include "accel/tcg/probe.h" #include "user/cpu_loop.h"
target/alpha/helper.c +1 -0
@@ -28,6 +28,7 @@#include "exec/helper-proto.h" #include "qemu/qemu-print.h" #include "system/memory.h" +#include "accel/tcg/cpu-loop.h" #include "qemu/plugin.h"
target/alpha/mem_helper.c +1 -0
@@ -21,6 +21,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" static void do_unaligned_access (CPUAlphaState *env,vaddr addr,uintptr_t retaddr) {
target/arm/tcg/op_helper.c +1 -0
@@ -23,6 +23,7 @@#include "helper.h" #include "internals.h" #include "cpu-features.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/probe.h" #include "cpregs.h"
target/arm/tcg/tlb_helper.c +1 -0
@@ -8,6 +8,7 @@#include "qemu/osdep.h" #include "cpu.h" #include "helper.h" +#include "accel/tcg/cpu-loop.h" #include "internals.h" #include "cpu-features.h"
target/hppa/cpu.c +1 -0
@@ -29,6 +29,7 @@#include "fpu/softfloat.h" #include "tcg/tcg.h" #include "hw/hppa/hppa_hardware.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/cpu-ops.h" static void hppa_cpu_set_pc (CPUState *cs,vaddr value)
target/hppa/mem_helper.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/log.h" #include "cpu.h" #include "exec/cputlb.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/cpu-mmu-index.h" #include "accel/tcg/probe.h" #include "exec/page-protection.h"
target/hppa/op_helper.c +1 -0
@@ -22,6 +22,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/probe.h" #include "qemu/timer.h" #include "trace.h"
target/i386/tcg/system/svm_helper.c +1 -0
@@ -23,6 +23,7 @@#include "exec/helper-proto.h" #include "exec/cputlb.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "tcg/helper-tcg.h" /* Secure Virtual Machine helpers */
target/m68k/op_helper.c +1 -0
@@ -21,6 +21,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "semihosting/semihost.h" #include "qemu/plugin.h"
target/microblaze/helper.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "cpu.h" #include "exec/cputlb.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/cpu-mmu-index.h" #include "exec/page-protection.h" #include "exec/target_page.h"
target/ppc/tcg-excp_helper.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/log.h" #include "target/ppc/cpu.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "exec/helper-proto.h" #include "system/runstate.h"
target/s390x/tcg/excp_helper.c +1 -0
@@ -24,6 +24,7 @@#include "exec/helper-proto.h" #include "exec/cputlb.h" #include "exec/target_page.h" +#include "accel/tcg/cpu-loop.h" #include "s390x-internal.h" #include "tcg_s390x.h" #ifndef CONFIG_USER_ONLY
target/sh4/op_helper.c +1 -0
@@ -20,6 +20,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "fpu/softfloat.h" #ifndef CONFIG_USER_ONLY
target/tricore/op_helper.c +1 -0
@@ -19,6 +19,7 @@#include "qemu/host-utils.h" #include "exec/helper-proto.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "qemu/plugin.h" #include <zlib.h> /* for crc32 */
target/xtensa/helper.c +1 -0
@@ -32,6 +32,7 @@#include "exec/target_page.h" #include "gdbstub/helpers.h" #include "exec/helper-proto.h" +#include "accel/tcg/cpu-loop.h" #include "qemu/error-report.h" #include "qemu/qemu-print.h" #include "qemu/host-utils.h"
Signature · 1 line
2.53.0
PATCH v2 8/11 accel/tcg: Have cpu_loop_exit_requested() take const @cpu argument
In reply to Philippe Mathieu-DaudéSince the CPUState argument is simply read-only accessed, make it const.
--- include/exec/cpu-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/exec/cpu-common.h +1 -1
@@ -76,7 +76,7 @@ void list_cpus(void);* call can be used to check if it makes sense to return to the main loop * or to continue executing the interruptible instruction. */ -static inline bool cpu_loop_exit_requested (CPUState *cpu) +static inline bool cpu_loop_exit_requested (const CPUState *cpu) {return (int32_t )qatomic_read (&cpu->neg.icount_decr.u32) <0 ; }
Signature · 1 line
2.53.0
Re: [PATCH v2 08/11] accel/tcg: Have cpu_loop_exit_requested() take const @cpu argument
Quoted 12 lines · Philippe Mathieu-Daudé
Since the CPUState argument is simply read-only accessed, make it const.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- include/exec/cpu-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/exec/cpu-common.h +0
-0
include/exec/cpu-common.h void list_cpus(void);
Quoted 9 lines
include/exec/cpu-common.h +1
-2@@ -76,7 +76,7 @@ void list_cpus(void);* call can be used to check if it makes sense to return to the main loop * or to continue executing the interruptible instruction. */ -static inline bool cpu_loop_exit_requested (CPUState *cpu) +static inline bool cpu_loop_exit_requested (const CPUState *cpu) {return (int32_t )qatomic_read (&cpu->neg.icount_decr.u32) <0 ; } -- 2.53.0
r~
PATCH v2 9/11 accel/tcg: Move cpu_loop_exit_requested() out of 'exec/cpu-common.h'
In reply to Philippe Mathieu-Daudécpu_loop_exit_requested() is part of the TCG cpu-loop API, defined in "accel/tcg/cpu-loop.h". Ideally we'd move it declaration there, but it is defined inlined and access CPUState internal fields, itself defined in "hw/core/cpu.h". Since keeping it inlined in the 3 call sites is important, move the definition to "hw/core/cpu.h" and call it a day.
--- include/exec/cpu-common.h | 19 ------------------- include/hw/core/cpu.h | 20 ++++++++++++++++++++ target/arm/tcg/helper-a64.c | 1 + target/s390x/tcg/mem_helper.c | 1 + 4 files changed, 22 insertions(+), 19 deletions(-)
include/exec/cpu-common.h +0 -19
@@ -62,25 +62,6 @@ void cpu_destroy_address_spaces(CPUState *cpu);void list_cpus (void );#ifdef CONFIG_TCG -#include "qemu/atomic.h" - -/** -* cpu_loop_exit_requested: -* @cpu: The CPU state to be tested -* -* Indicate if somebody asked for a return of the CPU to the main loop -* (e.g., via cpu_exit() or cpu_interrupt()). -* -* This is helpful for architectures that support interruptible -* instructions. After writing back all state to registers/memory, this -* call can be used to check if it makes sense to return to the main loop -* or to continue executing the interruptible instruction. -*/ -static inline bool cpu_loop_exit_requested (const CPUState *cpu) -{ -return (int32_t )qatomic_read (&cpu->neg.icount_decr.u32) <0 ; -} - G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc);
include/hw/core/cpu.h +20 -0
@@ -612,6 +612,26 @@ static inline CPUTLBDescFast *cpu_tlb_fast(CPUState *cpu, int mmu_idx) {return &cpu->neg.tlb.f[mmuidx_to_fast_index (mmu_idx)]; } + +#include "qemu/atomic.h" + +/** +* cpu_loop_exit_requested: +* @cpu: The CPU state to be tested +* +* Indicate if somebody asked for a return of the CPU to the main loop +* (e.g., via cpu_exit() or cpu_interrupt()). +* +* This is helpful for architectures that support interruptible +* instructions. After writing back all state to registers/memory, this +* call can be used to check if it makes sense to return to the main loop +* or to continue executing the interruptible instruction. +*/ +static inline bool cpu_loop_exit_requested (const CPUState *cpu) +{ +return (int32_t )qatomic_read (&cpu->neg.icount_decr.u32) <0 ; +} +#endif typedef QTAILQ_HEAD(CPUTailQ, CPUState) CPUTailQ;
target/arm/tcg/helper-a64.c +1 -0
@@ -43,6 +43,7 @@#include "user/page-protection.h" #endif #include "vec_internal.h" +#include "hw/core/cpu.h" #define HELPER_H "tcg/helper-a64-defs.h"#include "exec/helper-info.c.inc"
target/s390x/tcg/mem_helper.c +1 -0
@@ -43,6 +43,7 @@#include "hw/core/boards.h" #include "system/memory.h" #endif +#include "hw/core/cpu.h" #ifdef CONFIG_USER_ONLY # define user_or_likely (X ) true
Signature · 1 line
2.53.0
Re: [PATCH v2 09/11] accel/tcg: Move cpu_loop_exit_requested() out of 'exec/cpu-common.h'
Quoted 50 lines · Philippe Mathieu-Daudé
cpu_loop_exit_requested()is part of the TCG cpu-loop API, defined in "accel/tcg/cpu-loop.h". Ideally we'd move it declaration there, but it is defined inlined and access CPUState internal fields, itself defined in "hw/core/cpu.h". Since keeping it inlined in the 3 call sites is important, move the definition to "hw/core/cpu.h" and call it a day.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/exec/cpu-common.h | 19 ------------------- include/hw/core/cpu.h | 20 ++++++++++++++++++++ target/arm/tcg/helper-a64.c | 1 + target/s390x/tcg/mem_helper.c | 1 + 4 files changed, 22 insertions(+), 19 deletions(-)include/exec/cpu-common.h +0
-19@@ -62,25 +62,6 @@ void cpu_destroy_address_spaces(CPUState *cpu);void list_cpus (void );#ifdef CONFIG_TCG -#include "qemu/atomic.h" - -/** -* cpu_loop_exit_requested: -* @cpu: The CPU state to be tested -* -* Indicate if somebody asked for a return of the CPU to the main loop -* (e.g., via cpu_exit() or cpu_interrupt()). -* -* This is helpful for architectures that support interruptible -* instructions. After writing back all state to registers/memory, this -* call can be used to check if it makes sense to return to the main loop -* or to continue executing the interruptible instruction. -*/ -static inline bool cpu_loop_exit_requested (const CPUState *cpu) -{ -return (int32_t )qatomic_read (&cpu->neg.icount_decr.u32) <0 ; -} - G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc);include/hw/core/cpu.h +0
-0
include/hw/core/cpu.h static inline CPUTLBDescFast *cpu_tlb_fast(CPUState *cpu, int mmu_idx) · line 616
Quoted 5 lines
include/hw/core/cpu.h +2
-0@@ -612,6 +612,26 @@ static inline CPUTLBDescFast *cpu_tlb_fast(CPUState *cpu, int mmu_idx) {return &cpu->neg.tlb.f[mmuidx_to_fast_index (mmu_idx)]; } + +#include "qemu/atomic.h"
We already use qatomic_load_acquire within this header (without including atomic.h). Just put the include properly at the top of the file.
Quoted 16 lines
target/arm/tcg/helper-a64.c +1
-0@@ -43,6 +43,7 @@#include "user/page-protection.h" #endif #include "vec_internal.h" +#include "hw/core/cpu.h">#define HELPER_H "tcg/helper-a64-defs.h"#include "exec/helper-info.c.inc" target/s390x/tcg/mem_helper.c +0
-0
target/s390x/tcg/mem_helper.c line 49
Quoted 7 lines
target/s390x/tcg/mem_helper.c +1
-0@@ -43,6 +43,7 @@#include "hw/core/boards.h" #include "system/memory.h" #endif +#include "hw/core/cpu.h" #ifdef CONFIG_USER_ONLY # define user_or_likely (X ) true
Do we honestly need these? This *must* have been done by target/arch/cpu.h.
r~
PATCH v2 10/11 accel/tcg: Move cpu_loop_exit_*() out of 'exec/cpu-common.h'
In reply to Philippe Mathieu-DaudéMove the following TCG-specific cpu_loop_exit_*() declarations out of the generic "exec/cpu-common.h" header, to the recently created "accel/tcg/cpu-loop.h" one, documenting them:
- cpu_loop_exit_noexc()
- cpu_loop_exit_atomic()
- cpu_loop_exit_restore()
- cpu_loop_exit()
Include "accel/tcg/cpu-loop.h" where appropriate.
--- include/accel/tcg/cpu-loop.h | 30 ++++++++++++++++++++++++++++ include/exec/cpu-common.h | 7 ------- accel/tcg/cputlb.c | 1 + accel/tcg/tb-maint.c | 1 + accel/tcg/tcg-runtime.c | 1 + accel/tcg/watchpoint.c | 1 + hw/misc/mips_itu.c | 1 + plugins/api.c | 1 + semihosting/console.c | 1 + target/arm/tcg/helper-a64.c | 1 + target/avr/helper.c | 1 + target/hexagon/op_helper.c | 1 + target/i386/tcg/excp_helper.c | 1 + target/i386/tcg/misc_helper.c | 1 + target/i386/tcg/system/bpt_helper.c | 1 + target/i386/tcg/system/misc_helper.c | 1 + target/i386/tcg/user/excp_helper.c | 1 + target/i386/tcg/user/seg_helper.c | 1 + target/loongarch/tcg/tcg_cpu.c | 1 + target/loongarch/tcg/tlb_helper.c | 1 + target/m68k/helper.c | 1 + target/microblaze/op_helper.c | 1 + target/mips/tcg/exception.c | 1 + target/mips/tcg/system/tlb_helper.c | 1 + target/or1k/exception_helper.c | 1 + target/or1k/fpu_helper.c | 1 + target/or1k/mmu.c | 1 + target/ppc/user_only_helper.c | 1 + target/riscv/cpu_helper.c | 1 + target/riscv/op_helper.c | 1 + target/rx/op_helper.c | 1 + target/s390x/mmu_helper.c | 3 +++ target/s390x/tcg/cc_helper.c | 1 + target/s390x/tcg/debug.c | 1 + target/s390x/tcg/mem_helper.c | 1 + target/s390x/tcg/misc_helper.c | 1 + target/sh4/helper.c | 1 + target/sparc/helper.c | 1 + target/sparc/mmu_helper.c | 1 + target/tricore/helper.c | 1 + target/xtensa/exc_helper.c | 1 + 41 files changed, 71 insertions(+), 7 deletions(-)
include/accel/tcg/cpu-loop.h +30 -0
@@ -5,6 +5,8 @@#error Can only include this header with TCG#endif +#include "qemu/atomic.h" +/** * cpu_exec: * @cpu: the cpu context
@@ -40,4 +42,32 @@ bool cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data);*/ bool cpu_restore_state (CPUState *cpu,uintptr_t host_pc); +/** +* cpu_loop_exit_noexc: +* @cpu: the cpu context +* +* Exit the current TB, but without causing any exception to be raised. +*/ +G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); + +/** +* cpu_loop_exit_restore: +* @cpu: the cpu context +* @host_pc: the host pc within the translation +* +* Attempt to restore the state for a fault occurring in translated +* code. If @host_pc is not in translated code no state is +* restored. Finally, exit the current TB. +*/ +G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t host_pc); +G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t host_pc); + +/** +* cpu_loop_exit: +* @cpu: the cpu context +* +* Exit the current TB. +*/ +G_NORETURN void cpu_loop_exit(CPUState *cpu); +#endif
include/exec/cpu-common.h +0 -7
@@ -61,13 +61,6 @@ void cpu_destroy_address_spaces(CPUState *cpu);/* vl.c */ void list_cpus (void ); -#ifdef CONFIG_TCG -G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); -G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); -G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); -#endif /* CONFIG_TCG */ -G_NORETURN void cpu_loop_exit(CPUState *cpu); -/** * env_archcpu(env) * @env: The architecture environment
accel/tcg/cputlb.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu/main-loop.h" #include "qemu/target-info.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/cpu-ops.h" #include "accel/tcg/iommu.h" #include "accel/tcg/probe.h"
accel/tcg/tb-maint.c +1 -0
@@ -26,6 +26,7 @@#include "exec/mmap-lock.h" #include "exec/tb-flush.h" #include "exec/target_page.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/cpu-ops.h" #include "tb-internal.h" #include "system/tcg.h"
accel/tcg/tcg-runtime.c +1 -0
@@ -25,6 +25,7 @@#include "qemu/host-utils.h" #include "exec/cpu-common.h" #include "exec/helper-proto-common.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/getpc.h" #define HELPER_H "accel/tcg/tcg-runtime.h"
accel/tcg/watchpoint.c +1 -0
@@ -25,6 +25,7 @@#include "exec/translation-block.h" #include "system/tcg.h" #include "system/replay.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/cpu-ops.h" #include "hw/core/cpu.h" #include "internal-common.h"
hw/misc/mips_itu.c +1 -0
@@ -25,6 +25,7 @@#include "hw/core/cpu.h" #include "hw/misc/mips_itu.h" #include "hw/core/qdev-properties.h" +#include "accel/tcg/cpu-loop.h" #include "target/mips/cpu.h" #define ITC_TAG_ADDRSPACE_SZ (ITC_ADDRESSMAP_NUM * 8)
plugins/api.c +1 -0
@@ -40,6 +40,7 @@#include "qemu/plugin.h" #include "qemu/log.h" #include "system/memory.h" +#include "accel/tcg/cpu-loop.h" #include "tcg/tcg.h" #include "exec/cpu-common.h" #include "exec/gdbstub.h"
semihosting/console.c +1 -0
@@ -18,6 +18,7 @@#include "qemu/osdep.h" #include "semihosting/semihost.h" #include "semihosting/console.h" +#include "accel/tcg/cpu-loop.h" #include "exec/cpu-common.h" #include "exec/gdbstub.h" #include "qemu/log.h"
target/arm/tcg/helper-a64.c +1 -0
@@ -31,6 +31,7 @@#include "qemu/crc32c.h" #include "exec/cpu-common.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/helper-retaddr.h" #include "accel/tcg/probe.h" #include "exec/target_page.h"
target/avr/helper.c +1 -0
@@ -23,6 +23,7 @@#include "qemu/error-report.h" #include "cpu.h" #include "accel/tcg/cpu-ops.h" +#include "accel/tcg/cpu-loop.h" #include "exec/cputlb.h" #include "exec/page-protection.h" #include "exec/target_page.h"
target/hexagon/op_helper.c +1 -0
@@ -18,6 +18,7 @@#include "qemu/osdep.h" #include "qemu/log.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/probe.h" #include "exec/helper-proto.h" #include "fpu/softfloat.h"
target/i386/tcg/excp_helper.c +1 -0
@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "accel/tcg/cpu-loop.h" #include "cpu.h" #include "qemu/log.h" #include "system/runstate.h"
target/i386/tcg/misc_helper.c +1 -0
@@ -19,6 +19,7 @@#include "qemu/osdep.h" #include "qemu/log.h" +#include "accel/tcg/cpu-loop.h" #include "cpu.h" #include "exec/helper-proto.h" #include "exec/cputlb.h"
target/i386/tcg/system/bpt_helper.c +1 -0
@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "accel/tcg/cpu-loop.h" #include "cpu.h" #include "exec/helper-proto.h" #include "exec/watchpoint.h"
target/i386/tcg/system/misc_helper.c +1 -0
@@ -22,6 +22,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "system/address-spaces.h" #include "system/memory.h" #include "exec/cputlb.h"
target/i386/tcg/user/excp_helper.c +1 -0
@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "accel/tcg/cpu-loop.h" #include "cpu.h" #include "tcg/helper-tcg.h"
target/i386/tcg/user/seg_helper.c +1 -0
@@ -22,6 +22,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "tcg/helper-tcg.h" #include "tcg/seg_helper.h"
target/loongarch/tcg/tcg_cpu.c +1 -0
@@ -10,6 +10,7 @@#include "qemu/log.h" #include "qemu/plugin.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/cpu-ops.h" #include "exec/translation-block.h" #include "exec/target_page.h"
target/loongarch/tcg/tlb_helper.c +1 -0
@@ -17,6 +17,7 @@#include "exec/page-protection.h" #include "exec/target_page.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "exec/log.h" #include "cpu-csr.h" #include "tcg/tcg_loongarch.h"
target/m68k/helper.c +1 -0
@@ -25,6 +25,7 @@#include "exec/target_page.h" #include "exec/gdbstub.h" #include "exec/helper-proto.h" +#include "accel/tcg/cpu-loop.h" #include "system/memory.h" #include "gdbstub/helpers.h" #include "fpu/softfloat.h"
target/microblaze/op_helper.c +1 -0
@@ -24,6 +24,7 @@#include "exec/helper-proto.h" #include "qemu/host-utils.h" #include "accel/tcg/cpu-ldst-common.h" +#include "accel/tcg/cpu-loop.h" #include "fpu/softfloat.h" void helper_put (uint32_t id,uint32_t ctrl,uint32_t data)
target/mips/tcg/exception.c +1 -0
@@ -24,6 +24,7 @@#include "internal.h" #include "exec/helper-proto.h" #include "exec/translation-block.h" +#include "accel/tcg/cpu-loop.h" target_ulong exception_resume_pc (CPUMIPSState *env) {
target/mips/tcg/system/tlb_helper.c +1 -0
@@ -26,6 +26,7 @@#include "exec/page-protection.h" #include "exec/target_page.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "exec/log.h" #include "exec/helper-proto.h"
target/or1k/exception_helper.c +1 -0
@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "accel/tcg/cpu-loop.h" #include "exec/helper-proto.h" #include "target/or1k/cpu.h"
target/or1k/fpu_helper.c +1 -0
@@ -19,6 +19,7 @@*/ #include "qemu/osdep.h" +#include "accel/tcg/cpu-loop.h" #include "cpu.h" #include "exec/helper-proto.h" #include "fpu/softfloat.h"
target/or1k/mmu.c +1 -0
@@ -24,6 +24,7 @@#include "exec/cputlb.h" #include "exec/page-protection.h" #include "exec/target_page.h" +#include "accel/tcg/cpu-loop.h" #include "qemu/host-utils.h" #include "hw/core/loader.h"
target/ppc/user_only_helper.c +1 -0
@@ -19,6 +19,7 @@*/ #include "qemu/osdep.h" +#include "accel/tcg/cpu-loop.h" #include "cpu.h" #include "internal.h"
target/riscv/cpu_helper.c +1 -0
@@ -29,6 +29,7 @@#include "system/memory.h" #include "instmap.h" #include "tcg/tcg-op.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/cpu-ops.h" #include "trace.h" #include "semihosting/common-semi.h"
target/riscv/op_helper.c +1 -0
@@ -23,6 +23,7 @@#include "internals.h" #include "exec/cputlb.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/probe.h" #include "exec/helper-proto.h" #include "exec/tlb-flags.h"
target/rx/op_helper.c +1 -0
@@ -21,6 +21,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "fpu/softfloat.h" #include "tcg/debug-assert.h"
target/s390x/mmu_helper.c +3 -0
@@ -24,6 +24,9 @@#include "system/kvm.h" #include "system/tcg.h" #include "system/memory.h" +#ifdef CONFIG_TCG +#include "accel/tcg/cpu-loop.h" +#endif #include "exec/page-protection.h" #include "exec/target_page.h" #include "hw/core/hw-error.h"
target/s390x/tcg/cc_helper.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "cpu.h" +#include "accel/tcg/cpu-loop.h" #include "s390x-internal.h" #include "tcg_s390x.h" #include "exec/helper-proto.h"
target/s390x/tcg/debug.c +1 -0
@@ -7,6 +7,7 @@#include "qemu/osdep.h" #include "exec/breakpoint.h" #include "exec/watchpoint.h" +#include "accel/tcg/cpu-loop.h" #include "target/s390x/cpu.h" #include "target/s390x/s390x-internal.h" #include "tcg_s390x.h"
target/s390x/tcg/mem_helper.c +1 -0
@@ -28,6 +28,7 @@#include "exec/cputlb.h" #include "exec/page-protection.h" #include "accel/tcg/cpu-ldst.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/probe.h" #include "exec/target_page.h" #include "exec/tlb-flags.h"
target/s390x/tcg/misc_helper.c +1 -0
@@ -28,6 +28,7 @@#include "qemu/timer.h" #include "exec/cputlb.h" #include "accel/tcg/cpu-ldst-common.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/cpu-mmu-index.h" #include "exec/target_page.h" #include "qapi/error.h"
target/sh4/helper.c +1 -0
@@ -24,6 +24,7 @@#include "exec/page-protection.h" #include "exec/target_page.h" #include "exec/log.h" +#include "accel/tcg/cpu-loop.h" #include "qemu/plugin.h" #if !defined(CONFIG_USER_ONLY )
target/sparc/helper.c +1 -0
@@ -21,6 +21,7 @@#include "cpu.h" #include "qemu/timer.h" #include "qemu/host-utils.h" +#include "accel/tcg/cpu-loop.h" #include "exec/cpu-common.h" #include "exec/helper-proto.h"
target/sparc/mmu_helper.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/log.h" #include "cpu.h" #include "exec/cputlb.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/cpu-mmu-index.h" #include "exec/page-protection.h" #include "exec/target_page.h"
target/tricore/helper.c +1 -0
@@ -20,6 +20,7 @@#include "hw/core/registerfields.h" #include "cpu.h" #include "exec/cputlb.h" +#include "accel/tcg/cpu-loop.h" #include "accel/tcg/cpu-mmu-index.h" #include "exec/page-protection.h" #include "exec/target_page.h"
target/xtensa/exc_helper.c +1 -0
@@ -28,6 +28,7 @@#include "qemu/osdep.h" #include "qemu/log.h" #include "qemu/main-loop.h" +#include "accel/tcg/cpu-loop.h" #include "cpu.h" #include "exec/helper-proto.h" #include "qemu/host-utils.h"
Signature · 1 line
2.53.0
PATCH v2 11/11 accel/tcg: Restrict headers being TCG specific
In reply to Philippe Mathieu-DaudéForbid including TCG-specific headers in non-TCG builds.
--- include/accel/tcg/cpu-mmu-index.h | 4 ++++ include/accel/tcg/cpu-ops.h | 4 ++++ include/accel/tcg/getpc.h | 4 ++++ include/accel/tcg/helper-retaddr.h | 4 ++++ include/accel/tcg/probe.h | 4 ++++ include/accel/tcg/tb-cpu-state.h | 4 ++++ 6 files changed, 24 insertions(+)
include/accel/tcg/cpu-mmu-index.h +4 -0
@@ -9,6 +9,10 @@#ifndef ACCEL_TCG_CPU_MMU_INDEX_H #define ACCEL_TCG_CPU_MMU_INDEX_H +#ifndef CONFIG_TCG +#error Can only include this header with TCG +#endif +#include "hw/core/cpu.h" #include "accel/tcg/cpu-ops.h" #include "tcg/debug-assert.h"
include/accel/tcg/cpu-ops.h +4 -0
@@ -10,6 +10,10 @@#ifndef TCG_CPU_OPS_H #define TCG_CPU_OPS_H +#ifndef CONFIG_TCG +#error Can only include this header with TCG +#endif +#include "exec/breakpoint.h" #include "exec/hwaddr.h" #include "exec/memattrs.h"
include/accel/tcg/getpc.h +4 -0
@@ -8,6 +8,10 @@#ifndef ACCEL_TCG_GETPC_H #define ACCEL_TCG_GETPC_H +#ifndef CONFIG_TCG +#error Can only include this header with TCG +#endif +/* GETPC is the true target of the return instruction that we'll execute. */ #ifdef CONFIG_TCG_INTERPRETER extern __threaduintptr_t tci_tb_ptr;
include/accel/tcg/helper-retaddr.h +4 -0
@@ -6,6 +6,10 @@#ifndef ACCEL_TCG_HELPER_RETADDR_H #define ACCEL_TCG_HELPER_RETADDR_H +#ifndef CONFIG_TCG +#error Can only include this header with TCG +#endif +/* * For user-only, helpers that use guest to host address translation * must protect the actual host memory access by recording 'retaddr'
include/accel/tcg/probe.h +4 -0
@@ -7,6 +7,10 @@#ifndef ACCEL_TCG_PROBE_H #define ACCEL_TCG_PROBE_H +#ifndef CONFIG_TCG +#error Can only include this header with TCG +#endif +#include "exec/mmu-access-type.h" #include "exec/vaddr.h"
include/accel/tcg/tb-cpu-state.h +4 -0
@@ -6,6 +6,10 @@ #ifndef EXEC_TB_CPU_STATE_H #define EXEC_TB_CPU_STATE_H +#ifndef CONFIG_TCG +#error Can only include this header with TCG +#endif + #include "exec/vaddr.h" typedef struct TCGTBCPUState {
Signature · 1 line
2.53.0
Philippe Mathieu-Daudé
AppliedQuoted 4 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (11):
target/arm: Restrict TCG specific headers hw/s390x/ipl: Remove TCG dependency inhandle_diag_308()accel/tcg: Removecpu_loop_exit()stub
Quoted 8 lines
accel/tcg: Move
cpu_exec()out of 'exec/cpu-common.h' accel/tcg: Movecpu_exec_step_atomic()out of 'exec/cpu-common.h' accel/tcg: Movecpu_unwind_state_data()out of 'exec/cpu-common.h' accel/tcg: Movecpu_restore_state()out of 'exec/cpu-common.h' accel/tcg: Havecpu_loop_exit_requested()take const @cpu argument accel/tcg: Movecpu_loop_exit_requested()out of 'exec/cpu-common.h' accel/tcg: Move cpu_loop_exit_*() out of 'exec/cpu-common.h' accel/tcg: Restrict headers being TCG specific
Queued except #9, thanks.