accel/tcg: Extract cpu-loop API out of 'exec/cpu-common.h'
Subsystems (2)
cover accel/tcg: Extract cpu-loop API out of 'exec/cpu-common.h'
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é (10):
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 and un-inline 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 | 85 ++++++++++++++++++++++++++++ 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/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 | 7 +++ 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 | 1 + 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 | 30 ++++++---- 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 | 1 + 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 - 82 files changed, 214 insertions(+), 98 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 1/10 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
Re: [PATCH 01/10] target/arm: Restrict TCG specific headers
Quoted 7 lines · Philippe Mathieu-Daudé
Avoid including TCG-specific headers in non-TCG builds.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/arm/internals.h | 4 +++- target/arm/cpu-irq.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-)
r~
PATCH 2/10 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 | 30 +++++++++++++++++++----------- target/s390x/tcg/misc_helper.c | 5 ++++- 4 files changed, 25 insertions(+), 18 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 +19 -11
@@ -95,44 +95,49 @@ 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);uint64_t addr = env->regs[r1];uint64_t subcode = env->regs[r3];IplParameterBlock *iplb; +bool reset_requested;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; } + reset_requested = false;switch (subcode) {case DIAG308_RESET_MOD_CLR :s390_ipl_reset_request (cs,S390_RESET_MODIFIED_CLEAR ); + reset_requested = true;break ;case DIAG308_RESET_LOAD_NORM :s390_ipl_reset_request (cs,S390_RESET_LOAD_NORMAL ); + reset_requested = true;break ;case DIAG308_LOAD_CLEAR :/* Well we still lack the clearing bit... */ s390_ipl_reset_request (cs,S390_RESET_REIPL ); + reset_requested = true;break ;case DIAG308_SET :case DIAG308_PV_SET :if (diag308_parm_check (env, r1, addr, ra, false)) { -return ; +break ; } iplb =g_new0 (IplParameterBlock,1 );s390_ipl_read (env, addr, iplb,sizeof (iplb->len));
@@ -159,11 +164,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 ; +break ;case DIAG308_STORE :case DIAG308_PV_STORE :if (diag308_parm_check (env, r1, addr, ra, true)) { -return ; +break ; }if (subcode ==DIAG308_PV_STORE ) { iplb =s390_ipl_get_iplb_pv ();
@@ -172,30 +177,33 @@ out: }if (!iplb) { env->regs[r1 +1 ] =DIAG_308_RC_NO_CONF ; -return ; +break ; }s390_ipl_write (env, addr, iplb,be32_to_cpu (iplb->len)); env->regs[r1 +1 ] =DIAG_308_RC_OK ; -return ; +break ;case DIAG308_PV_START : iplb =s390_ipl_get_iplb_pv ();if (!iplb) { env->regs[r1 +1 ] =DIAG_308_RC_NO_PV_CONF ; -return ; +break ; }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 ; +break ; }s390_ipl_reset_request (cs,S390_RESET_PV ); + reset_requested = true;break ;default :s390_program_interrupt (env,PGM_SPECIFICATION , ra);break ; } + +return reset_requested; }
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
Re: [PATCH 02/10] hw/s390x/ipl: Remove TCG dependency in handle_diag_308()
target/s390x/diag.c void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra) · line 174
Quoted 8 lines · Philippe Mathieu-Daudé
case DIAG308_STORE: case DIAG308_PV_STORE: if (diag308_parm_check(env, r1, addr, ra, true)) {target/s390x/diag.c +1
-1-return ; +break ; }if (subcode ==DIAG308_PV_STORE ) { iplb =s390_ipl_get_iplb_pv ();
Why change these return to break, rather than just return false? There aren't *that* many places where reset_requested are set.
r~
Re: [PATCH 02/10] hw/s390x/ipl: Remove TCG dependency in handle_diag_308()
Quoted 10 lines · Richard Henderson
Quoted 8 lines · Philippe Mathieu-Daudé
case
DIAG308_STORE:
caseDIAG308_PV_STORE:
if (diag308_parm_check(env, r1, addr, ra, true)) { - return;
+ break;
}
if (subcode ==DIAG308_PV_STORE) {
iplb =s390_ipl_get_iplb_pv();
Quoted 2 lines
Why change these return to break, rather than just return false? There aren't *that* many places where
reset_requestedare set.
I thought the diff would result smaller, but not really ;)
- 4 files changed, 25 insertions(+), 18 deletions(-)
+ 4 files changed, 22 insertions(+), 23 deletions(-)
PATCH 3/10 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
Re: [PATCH 03/10] accel/tcg: Remove cpu_loop_exit() stub
Quoted 10 lines · 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.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- accel/stubs/tcg-stub.c | 20 -------------------- accel/stubs/meson.build | 1 - 2 files changed, 21 deletions(-)delete mode 100644
accel/stubs/tcg-stub.c
r~
PATCH 4/10 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
Re: [PATCH 04/10] accel/tcg: Move cpu_exec() out of 'exec/cpu-common.h'
Quoted 17 lines · Philippe Mathieu-Daudé
In order to keep TCG-specific functions under a TCG API namespace, add the "
accel/tcg/cpu-loop.h" header and movecpu_exec()declaration to it. Add a bit of documentation.Include "
accel/tcg/cpu-loop.h" where appropriate.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- 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(-)
Quoted 1 line
create mode 100644
include/accel/tcg/cpu-loop.h
r~
PATCH 5/10 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
Re: [PATCH 05/10] accel/tcg: Move cpu_exec_step_atomic() out of 'exec/cpu-common.h'
Quoted 6 lines · 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.
Quoted 7 lines
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- 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(-)
r~
PATCH 6/10 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
Re: [PATCH 06/10] accel/tcg: Move cpu_unwind_state_data() out of 'exec/cpu-common.h'
Quoted 7 lines · 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.Signed-off-by Philippe Mathieu-Daudé<[email protected]>
Quoted 8 lines
--- 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(-)
r~
PATCH 7/10 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/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 + 18 files changed, 28 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/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
Re: [PATCH 07/10] accel/tcg: Move cpu_restore_state() out of 'exec/cpu-common.h'
Quoted 8 lines · 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.Signed-off-by Philippe Mathieu-Daudé<[email protected]>---
r~
PATCH 8/10 accel/tcg: Have cpu_loop_exit_requested() take const cpu and un-inline
In reply to Philippe Mathieu-DaudéOf the 5 calls in our codebase, 4 are unlikely(), so not worth inlining in header. Since the CPUState is simply read-only accessed, make the argument const.
--- include/exec/cpu-common.h | 6 +----- accel/tcg/cpu-exec-common.c | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-)
include/exec/cpu-common.h +1 -5
@@ -62,7 +62,6 @@ void cpu_destroy_address_spaces(CPUState *cpu);void list_cpus (void );#ifdef CONFIG_TCG -#include "qemu/atomic.h" /** * cpu_loop_exit_requested:
@@ -76,10 +75,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) -{ -return (int32_t )qatomic_read (&cpu->neg.icount_decr.u32) <0 ; -} +bool cpu_loop_exit_requested (const CPUState *cpu); G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc);
accel/tcg/cpu-exec-common.c +6 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "exec/log.h" #include "system/tcg.h" +#include "qemu/atomic.h" #include "qemu/plugin.h" #include "internal-common.h"
@@ -88,3 +89,8 @@ void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc) cpu->exception_index =EXCP_ATOMIC ;cpu_loop_exit_restore (cpu, pc); } + +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 08/10] accel/tcg: Have cpu_loop_exit_requested() take const cpu and un-inline
Quoted 3 lines · Philippe Mathieu-Daudé
Of the 5 calls in our codebase, 4 are
unlikely(), so not worth inlining in header. Since the CPUState is simply read-only accessed, make the argument const.
Unlikely to trigger, but still called within inner loops. Please keep this inline.
r~
Re: [PATCH 08/10] accel/tcg: Have cpu_loop_exit_requested() take const cpu and un-inline
Quoted 7 lines · Richard Henderson
Quoted 3 lines · Philippe Mathieu-Daudé
Of the 5 calls in our codebase, 4 are
unlikely(), so not worth inlining in header. Since the CPUState is simply read-only accessed, make the argument const.Unlikely to trigger, but still called within inner loops. Please keep this inline.
Why not inline all of them then? What is so special about this particular one?
Re: [PATCH 08/10] accel/tcg: Have cpu_loop_exit_requested() take const cpu and un-inline
Quoted 6 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Richard Henderson
Quoted 3 lines · Philippe Mathieu-Daudé
Of the 5 calls in our codebase, 4 are
unlikely(), so not worth inlining in header. Since the CPUState is simply read-only accessed, make the argument const.
Quoted 6 lines
Quoted 2 lines
Unlikely to trigger, but still called within inner loops. Please keep this inline.
Why not inline all of them then? What is so special about this particular one?
I'd really like to not pull the whole "hw/core/cpu.h" there:
include/accel/tcg/cpu-loop.h:87:38: error: incomplete definition of type 'const CPUState' (aka 'const struct CPUState')
87 | return (int32_t)qatomic_read(&cpu->neg.icount_decr.u32) < 0;
| ~~~^
Re: [PATCH 08/10] accel/tcg: Have cpu_loop_exit_requested() take const cpu and un-inline
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Richard Henderson
Quoted 3 lines · Philippe Mathieu-Daudé
Of the 5 calls in our codebase, 4 are
unlikely(), so not worth inlining in header. Since the CPUState is simply read-only accessed, make the argument const.Quoted 6 lines
Quoted 2 lines
Unlikely to trigger, but still called within inner loops. Please keep this inline.
Why not inline all of them then? What is so special about this particular one?
Quoted 6 lines
I'd really like to not pull the whole "
hw/core/cpu.h" there:
include/accel/tcg/cpu-loop.h:87:38: error: incomplete definition of type 'const CPUState' (aka 'const struct CPUState')
87 | return (int32_t)qatomic_read(&cpu->neg.icount_decr.u32) < 0;
| ~~~^
Then perhaps we should leave this one in cpu-common.h.
r~
PATCH 9/10 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_requested()
- 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 | 42 ++++++++++++++++++++++++++++ include/exec/cpu-common.h | 22 --------------- accel/tcg/cpu-exec-common.c | 1 + 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 + 42 files changed, 84 insertions(+), 22 deletions(-)
include/accel/tcg/cpu-loop.h +42 -0
@@ -40,4 +40,46 @@ 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); + +/** +* 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. +*/ +bool cpu_loop_exit_requested (const CPUState *cpu); +#endif
include/exec/cpu-common.h +0 -22
@@ -61,28 +61,6 @@ void cpu_destroy_address_spaces(CPUState *cpu);/* vl.c */ void list_cpus (void ); -#ifdef CONFIG_TCG - -/** -* 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. -*/ -bool cpu_loop_exit_requested (const CPUState *cpu); - -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/cpu-exec-common.c +1 -0
@@ -22,6 +22,7 @@#include "system/tcg.h" #include "qemu/atomic.h" #include "qemu/plugin.h" +#include "accel/tcg/cpu-loop.h" #include "internal-common.h" bool tcg_allowed;
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
Re: [PATCH 09/10] accel/tcg: Move cpu_loop_exit_*() out of 'exec/cpu-common.h'
Quoted 10 lines · 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_requested()
-cpu_loop_exit_noexc()
-cpu_loop_exit_atomic()
-cpu_loop_exit_restore()
-cpu_loop_exit()
Quoted 4 lines
Include "
accel/tcg/cpu-loop.h" where appropriate.Signed-off-by Philippe Mathieu-Daudé<[email protected]>---
r~
PATCH 10/10 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
Re: [PATCH 10/10] accel/tcg: Restrict headers being TCG specific
Quoted 11 lines · Philippe Mathieu-Daudé
Forbid including TCG-specific headers in non-TCG builds.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- 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(+)
r~