tcg: philmd's queue
v3 cover tcg: philmd's queue
Hi Richard,
Here is my patch queue based on your tcg-next tree fixed.
You can find it as commit 511d57c091f on my repository:
https://gitlab.com/philmd/qemu/-/tree/tcg-next-fixed
Thanks,
Phil.
Since v1:
- Deferred warning change and updated desc (patches 40 & 42) Since v2:
- Rebased & addressed review comments
Philippe Mathieu-Daudé (19):
target/riscv: Do not expose rv128 CPU on user mode emulation
tcg: Include missing 'cpu.h' in translate-all.c
tcg: Declare TARGET_INSN_START_EXTRA_WORDS in 'cpu-param.h'
tcg: Always define TARGET_INSN_START_EXTRA_WORDS
exec: Restrict 'cpu-ldst-common.h' to accel/tcg/
exec: Restrict 'cpu_ldst.h' to accel/tcg/
exec: Do not include 'accel/tcg/cpu-ldst.h' in 'exec-all.h'
tcg: Always define TCG_GUEST_DEFAULT_MO
tcg: Simplify tcg_req_mo() macro
tcg: Define guest_default_memory_order in TCGCPUOps
tcg: Remove use of TCG_GUEST_DEFAULT_MO in tb_gen_code()
tcg: Propagate CPUState argument to cpu_req_mo()
tcg: Have tcg_req_mo() use TCGCPUOps::guest_default_memory_order
tcg: Remove the TCG_GUEST_DEFAULT_MO definition globally
tcg: Move cpu_req_mo() macro to target-agnostic 'backend-ldst.h'
tcg: Move qemu_tcg_mttcg_enabled() to 'system/tcg.h'
tcg: Convert TCGState::mttcg_enabled to TriState
tcg: Factor mttcg_init() out
tcg: Convert TARGET_SUPPORTS_MTTCG to TCGCPUOps::mttcg_supported field
docs/devel/multi-thread-tcg.rst | 6 +-
configs/targets/aarch64-softmmu.mak | 1 -
configs/targets/alpha-softmmu.mak | 1 -
configs/targets/arm-softmmu.mak | 1 -
configs/targets/hppa-softmmu.mak | 1 -
configs/targets/i386-softmmu.mak | 1 -
configs/targets/loongarch64-softmmu.mak | 1 -
configs/targets/microblaze-softmmu.mak | 1 -
configs/targets/microblazeel-softmmu.mak | 1 -
configs/targets/mips-softmmu.mak | 1 -
configs/targets/mipsel-softmmu.mak | 1 -
configs/targets/or1k-softmmu.mak | 1 -
configs/targets/ppc64-softmmu.mak | 1 -
configs/targets/riscv32-softmmu.mak | 1 -
configs/targets/riscv64-softmmu.mak | 1 -
configs/targets/s390x-softmmu.mak | 1 -
configs/targets/sparc-softmmu.mak | 1 -
configs/targets/sparc64-softmmu.mak | 1 -
configs/targets/x86_64-softmmu.mak | 1 -
configs/targets/xtensa-softmmu.mak | 1 -
configs/targets/xtensaeb-softmmu.mak | 1 -
accel/tcg/backend-ldst.h | 41 +++++++++
accel/tcg/internal-target.h | 35 --------
bsd-user/qemu.h | 2 +-
include/{exec => accel/tcg}/cpu-ldst-common.h | 6 +-
.../{exec/cpu_ldst.h => accel/tcg/cpu-ldst.h} | 8 +-
include/accel/tcg/cpu-ops.h | 16 ++++
include/exec/exec-all.h | 3 -
include/exec/poison.h | 1 -
include/hw/core/cpu.h | 9 --
include/system/tcg.h | 8 ++
include/tcg/insn-start-words.h | 6 +-
include/tcg/tcg-op.h | 2 +-
linux-user/qemu.h | 2 +-
target/alpha/cpu-param.h | 3 +-
target/arm/cpu-param.h | 8 +-
target/arm/cpu.h | 6 --
target/arm/tcg/sve_ldst_internal.h | 2 +-
target/avr/cpu-param.h | 2 +-
target/hexagon/cpu-param.h | 2 +
target/hppa/cpu-param.h | 8 +-
target/hppa/cpu.h | 2 -
target/i386/cpu-param.h | 3 +-
target/i386/cpu.h | 2 -
target/loongarch/cpu-param.h | 2 +-
target/m68k/cpu-param.h | 2 +
target/m68k/cpu.h | 2 -
target/microblaze/cpu-param.h | 3 +-
target/microblaze/cpu.h | 2 -
target/mips/cpu-param.h | 2 +-
target/mips/cpu.h | 2 -
target/openrisc/cpu-param.h | 2 +-
target/openrisc/cpu.h | 2 -
target/ppc/cpu-param.h | 2 +-
target/riscv/cpu-param.h | 10 ++-
target/riscv/cpu.h | 6 --
target/rx/cpu-param.h | 2 +
target/s390x/cpu-param.h | 6 +-
target/s390x/cpu.h | 2 -
target/sh4/cpu-param.h | 2 +
target/sh4/cpu.h | 2 -
target/sparc/cpu-param.h | 23 +----
target/sparc/cpu.h | 1 -
target/tricore/cpu-param.h | 2 +
target/xtensa/cpu-param.h | 3 +-
accel/tcg/cpu-exec.c | 1 +
accel/tcg/cputlb.c | 23 ++---
accel/tcg/tcg-all.c | 84 +++++++++++--------
accel/tcg/translate-all.c | 7 +-
accel/tcg/translator.c | 2 +-
accel/tcg/user-exec.c | 23 ++---
target/alpha/cpu.c | 4 +
target/alpha/mem_helper.c | 2 +-
target/arm/cpu.c | 4 +
target/arm/tcg/cpu-v7m.c | 4 +
target/arm/tcg/helper-a64.c | 2 +-
target/arm/tcg/m_helper.c | 2 +-
target/arm/tcg/mte_helper.c | 2 +-
target/arm/tcg/mve_helper.c | 2 +-
target/arm/tcg/op_helper.c | 2 +-
target/arm/tcg/pauth_helper.c | 2 +-
target/arm/tcg/sme_helper.c | 2 +-
target/arm/tcg/sve_helper.c | 1 +
target/avr/cpu.c | 2 +
target/avr/helper.c | 2 +-
target/hexagon/cpu.c | 3 +
target/hexagon/op_helper.c | 2 +-
target/hexagon/translate.c | 2 +-
target/hppa/cpu.c | 9 ++
target/hppa/op_helper.c | 2 +-
target/i386/tcg/access.c | 2 +-
target/i386/tcg/fpu_helper.c | 2 +-
target/i386/tcg/mem_helper.c | 2 +-
target/i386/tcg/mpx_helper.c | 2 +-
target/i386/tcg/seg_helper.c | 2 +-
target/i386/tcg/system/excp_helper.c | 2 +-
target/i386/tcg/system/misc_helper.c | 2 +-
target/i386/tcg/system/seg_helper.c | 2 +-
target/i386/tcg/system/svm_helper.c | 2 +-
target/i386/tcg/tcg-cpu.c | 5 ++
target/i386/tcg/user/seg_helper.c | 2 +-
target/loongarch/cpu.c | 5 +-
target/loongarch/tcg/csr_helper.c | 2 +-
target/loongarch/tcg/fpu_helper.c | 2 +-
target/loongarch/tcg/iocsr_helper.c | 2 +-
target/loongarch/tcg/op_helper.c | 2 +-
target/loongarch/tcg/tlb_helper.c | 2 +-
target/m68k/cpu.c | 4 +
target/m68k/fpu_helper.c | 2 +-
target/m68k/op_helper.c | 2 +-
target/microblaze/cpu.c | 6 +-
target/microblaze/op_helper.c | 2 +-
target/microblaze/translate.c | 2 +-
target/mips/cpu.c | 3 +
target/mips/tcg/ldst_helper.c | 2 +-
target/mips/tcg/msa_helper.c | 2 +-
target/mips/tcg/system/tlb_helper.c | 2 +-
target/openrisc/cpu.c | 3 +
target/ppc/cpu_init.c | 2 +
target/ppc/mem_helper.c | 2 +-
target/ppc/mmu_helper.c | 2 +-
target/ppc/tcg-excp_helper.c | 2 +-
target/riscv/cpu.c | 10 +--
target/riscv/op_helper.c | 2 +-
target/riscv/tcg/tcg-cpu.c | 9 +-
target/riscv/vector_helper.c | 2 +-
target/riscv/zce_helper.c | 2 +-
target/rx/cpu.c | 4 +
target/rx/helper.c | 2 +-
target/rx/op_helper.c | 2 +-
target/s390x/cpu.c | 7 ++
target/s390x/tcg/crypto_helper.c | 2 +-
target/s390x/tcg/int_helper.c | 2 +-
target/s390x/tcg/mem_helper.c | 2 +-
target/s390x/tcg/misc_helper.c | 2 +-
target/s390x/tcg/vec_helper.c | 2 +-
target/sh4/cpu.c | 4 +
target/sh4/op_helper.c | 2 +-
target/sparc/cpu.c | 24 ++++++
target/sparc/int32_helper.c | 2 +-
target/sparc/ldst_helper.c | 2 +-
target/tricore/cpu.c | 3 +
target/tricore/op_helper.c | 2 +-
target/tricore/translate.c | 2 +-
target/xtensa/cpu.c | 4 +
tcg/region.c | 4 +-
146 files changed, 357 insertions(+), 294 deletions(-)
create mode 100644 accel/tcg/backend-ldst.h
rename include/{exec => accel/tcg}/cpu-ldst-common.h (97%)
rename include/{exec/cpu_ldst.h => accel/tcg/cpu-ldst.h} (99%)Signature · 1 line
2.47.1
PATCH v3 1/19 target/riscv: Do not expose rv128 CPU on user mode emulation
As Richard mentioned:
We should allow RV128 in user-mode at all until there's a kernel abi for it.
Remove the experimental 'x-rv128' CPU on user emulation (since it is experimental, no deprecation period is required).
--- target/riscv/cpu.c | 10 ++++------ target/riscv/tcg/tcg-cpu.c | 5 +++-- 2 files changed, 7 insertions(+), 8 deletions(-)
target/riscv/cpu.c +4 -6
@@ -697,7 +697,7 @@ static void rv64_xiangshan_nanhu_cpu_init(Object *obj)#endif } -#ifdef CONFIG_TCG +#if defined(CONFIG_TCG ) && !defined(CONFIG_USER_ONLY )static void rv128_base_cpu_init (Object *obj) {RISCVCPU *cpu =RISCV_CPU (obj);
@@ -708,11 +708,9 @@ static void rv128_base_cpu_init(Object *obj)/* Set latest version of privileged specification */ env->priv_ver =PRIV_VERSION_LATEST ; -#ifndef CONFIG_USER_ONLY set_satp_mode_max_supported(RISCV_CPU(obj), VM_1_10_SV57); -#endif } -#endif /* CONFIG_TCG */ +#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */ static void rv64i_bare_cpu_init (Object *obj) {
@@ -3255,9 +3253,9 @@ static const TypeInfo riscv_cpu_type_infos[] = { DEFINE_VENDOR_CPU(TYPE_RISCV_CPU_VEYRON_V1, MXL_RV64, rv64_veyron_v1_cpu_init), DEFINE_VENDOR_CPU(TYPE_RISCV_CPU_XIANGSHAN_NANHU, MXL_RV64, rv64_xiangshan_nanhu_cpu_init), -#ifdef CONFIG_TCG +#if defined(CONFIG_TCG ) && !defined(CONFIG_USER_ONLY )DEFINE_DYNAMIC_CPU (TYPE_RISCV_CPU_BASE128 ,MXL_RV128 , rv128_base_cpu_init), -#endif /* CONFIG_TCG */ +#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */DEFINE_BARE_CPU (TYPE_RISCV_CPU_RV64I ,MXL_RV64 , rv64i_bare_cpu_init),DEFINE_BARE_CPU (TYPE_RISCV_CPU_RV64E ,MXL_RV64 , rv64e_bare_cpu_init), DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA22U64, MXL_RV64, rva22u64_profile_cpu_init),
target/riscv/tcg/tcg-cpu.c +3 -2
@@ -1046,7 +1046,6 @@ static bool riscv_cpu_is_generic(Object *cpu_obj)static bool riscv_tcg_cpu_realize (CPUState *cs,Error **errp) {RISCVCPU *cpu =RISCV_CPU (cs); -RISCVCPUClass *mcc =RISCV_CPU_GET_CLASS (cpu);if (!riscv_cpu_tcg_compatible (cpu)) { g_autofree char *name = riscv_cpu_get_name(cpu);
@@ -1055,6 +1054,9 @@ static bool riscv_tcg_cpu_realize(CPUState *cs, Error **errp)return false; } +#ifndef CONFIG_USER_ONLY +RISCVCPUClass *mcc =RISCV_CPU_GET_CLASS (cpu); +if (mcc->misa_mxl_max >=MXL_RV128 &&qemu_tcg_mttcg_enabled ()) {/* Missing 128-bit aligned atomics */ error_setg(errp,
@@ -1063,7 +1065,6 @@ static bool riscv_tcg_cpu_realize(CPUState *cs, Error **errp)return false; } -#ifndef CONFIG_USER_ONLY CPURISCVState *env = &cpu->env;tcg_cflags_set (CPU (cs),CF_PCREL );
Signature · 1 line
2.47.1
PATCH v3 2/19 tcg: Include missing 'cpu.h' in translate-all.c
In reply to Philippe Mathieu-Daudétb_check_watchpoint() calls cpu_get_tb_cpu_state(), which is declared in each "cpu.h" header. It is indirectly included via "tcg/insn-start-words.h". Since we want to rework "tcg/insn-start-words.h", removing "cpu.h" in the next commit, add the missing header now, otherwise we'd get:
accel/tcg/translate-all.c:598:9: error: call to undeclared function 'cpu_get_tb_cpu_state' [-Wimplicit-function-declaration]
598 | cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
| ^--- accel/tcg/translate-all.c | 1 + 1 file changed, 1 insertion(+)
accel/tcg/translate-all.c +1 -0
@@ -69,6 +69,7 @@#include "internal-target.h" #include "tcg/perf.h" #include "tcg/insn-start-words.h" +#include "cpu.h" TBContext tb_ctx;
Signature · 1 line
2.47.1
PATCH v3 3/19 tcg: Declare TARGET_INSN_START_EXTRA_WORDS in 'cpu-param.h'
In reply to Philippe Mathieu-DaudéTo avoid including the huge "cpu.h" for a simple definition, move TARGET_INSN_START_EXTRA_WORDS to "cpu-param.h".
--- include/tcg/insn-start-words.h | 2 +- target/arm/cpu-param.h | 7 +++++++ target/arm/cpu.h | 6 ------ target/hppa/cpu-param.h | 2 ++ target/hppa/cpu.h | 2 -- target/i386/cpu-param.h | 2 ++ target/i386/cpu.h | 2 -- target/m68k/cpu-param.h | 2 ++ target/m68k/cpu.h | 2 -- target/microblaze/cpu-param.h | 2 ++ target/microblaze/cpu.h | 2 -- target/mips/cpu-param.h | 2 ++ target/mips/cpu.h | 2 -- target/openrisc/cpu-param.h | 2 ++ target/openrisc/cpu.h | 2 -- target/riscv/cpu-param.h | 8 ++++++++ target/riscv/cpu.h | 6 ------ target/s390x/cpu-param.h | 2 ++ target/s390x/cpu.h | 2 -- target/sh4/cpu-param.h | 2 ++ target/sh4/cpu.h | 2 -- target/sparc/cpu-param.h | 2 ++ target/sparc/cpu.h | 1 - 23 files changed, 34 insertions(+), 30 deletions(-)
include/tcg/insn-start-words.h +1 -1
@@ -6,7 +6,7 @@#ifndef TARGET_INSN_START_WORDS -#include "cpu.h" +#include "cpu-param.h" #ifndef TARGET_INSN_START_EXTRA_WORDS # define TARGET_INSN_START_WORDS 1
target/arm/cpu-param.h +7 -0
@@ -37,6 +37,13 @@# define TARGET_PAGE_BITS_LEGACY 10#endif /* !CONFIG_USER_ONLY */ +/* +* ARM-specific extra insn start words: +* 1: Conditional execution bits +* 2: Partial exception syndrome for data aborts +*/ +#define TARGET_INSN_START_EXTRA_WORDS 2 +/* ARM processors have a weak memory model */ #define TCG_GUEST_DEFAULT_MO (0)
target/arm/cpu.h +0 -6
@@ -98,12 +98,6 @@#define offsetofhigh32 (S ,M ) (offsetof(S, M) + sizeof(uint32_t))#endif -/* ARM-specific extra insn start words: -* 1: Conditional execution bits -* 2: Partial exception syndrome for data aborts -*/ -#define TARGET_INSN_START_EXTRA_WORDS 2 -/* The 2nd extra word holding syndrome info for data aborts does not use * the upper 6 bits nor the lower 13 bits. We mask and shift it down to * help the sleb128 encoder do a better job.
target/hppa/cpu-param.h +2 -0
@@ -19,6 +19,8 @@#define TARGET_PAGE_BITS 12 +#define TARGET_INSN_START_EXTRA_WORDS 2 +/* PA-RISC 1.x processors have a strong memory model. */ /* * ??? While we do not yet implement PA-RISC 2.0, those processors have
target/hppa/cpu.h +0 -2
@@ -48,8 +48,6 @@#define PRIV_KERNEL 0#define PRIV_USER 3 -#define TARGET_INSN_START_EXTRA_WORDS 2 -/* No need to flush MMU_ABS*_IDX */ #define HPPA_MMU_FLUSH_MASK \ (1 << MMU_KERNEL_IDX | 1 << MMU_KERNEL_P_IDX | \
target/i386/cpu-param.h +2 -0
@@ -22,6 +22,8 @@#endif #define TARGET_PAGE_BITS 12 +#define TARGET_INSN_START_EXTRA_WORDS 1 +/* The x86 has a strong memory model with some store-after-load re-ordering */ #define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD)
target/i386/cpu.h +0 -2
@@ -1610,8 +1610,6 @@ typedef struct {#define MAX_FIXED_COUNTERS 3#define MAX_GP_COUNTERS (MSR_IA32_PERF_STATUS - MSR_P6_EVNTSEL0) -#define TARGET_INSN_START_EXTRA_WORDS 1 -#define NB_OPMASK_REGS 8/* CPU can't have 0xFFFFFFFF APIC ID, use that value to distinguish
target/m68k/cpu-param.h +2 -0
@@ -17,4 +17,6 @@#define TARGET_PHYS_ADDR_SPACE_BITS 32#define TARGET_VIRT_ADDR_SPACE_BITS 32 +#define TARGET_INSN_START_EXTRA_WORDS 1 +#endif
target/m68k/cpu.h +0 -2
@@ -78,8 +78,6 @@#define M68K_MAX_TTR 2#define TTR (type, index) ttr[((type & ACCESS_CODE) == ACCESS_CODE) * 2 + index] -#define TARGET_INSN_START_EXTRA_WORDS 1 -typedef CPU_LDoubleU FPReg ; typedef struct CPUArchState {
target/microblaze/cpu-param.h +2 -0
@@ -27,6 +27,8 @@/* FIXME: MB uses variable pages down to 1K but linux only uses 4k. */ #define TARGET_PAGE_BITS 12 +#define TARGET_INSN_START_EXTRA_WORDS 1 +/* MicroBlaze is always in-order. */ #define TCG_GUEST_DEFAULT_MO TCG_MO_ALL
target/microblaze/cpu.h +0 -2
@@ -233,8 +233,6 @@ typedef struct CPUArchState CPUMBState;#define STREAM_CONTROL (1 << 3)#define STREAM_NONBLOCK (1 << 4) -#define TARGET_INSN_START_EXTRA_WORDS 1 -/* use-non-secure property masks */ #define USE_NON_SECURE_M_AXI_DP_MASK 0x1#define USE_NON_SECURE_M_AXI_IP_MASK 0x2
target/mips/cpu-param.h +2 -0
@@ -20,6 +20,8 @@#endif #define TARGET_PAGE_BITS 12 +#define TARGET_INSN_START_EXTRA_WORDS 2 +#define TCG_GUEST_DEFAULT_MO (0)#endif
target/mips/cpu.h +0 -2
@@ -100,8 +100,6 @@ struct CPUMIPSFPUContext {#define FP_UNIMPLEMENTED 32 }; -#define TARGET_INSN_START_EXTRA_WORDS 2 -typedef struct CPUMIPSMVPContext CPUMIPSMVPContext ;struct CPUMIPSMVPContext {int32_t CP0_MVPControl;
target/openrisc/cpu-param.h +2 -0
@@ -12,6 +12,8 @@#define TARGET_PHYS_ADDR_SPACE_BITS 32#define TARGET_VIRT_ADDR_SPACE_BITS 32 +#define TARGET_INSN_START_EXTRA_WORDS 1 +#define TCG_GUEST_DEFAULT_MO (0)#endif
target/openrisc/cpu.h +0 -2
@@ -40,8 +40,6 @@ struct OpenRISCCPUClass {ResettablePhases parent_phases; }; -#define TARGET_INSN_START_EXTRA_WORDS 1 -enum {MMU_NOMMU_IDX =0 ,MMU_SUPERVISOR_IDX =1 ,
target/riscv/cpu-param.h +8 -0
@@ -16,6 +16,14 @@# define TARGET_VIRT_ADDR_SPACE_BITS 32/* sv32 */ #endif #define TARGET_PAGE_BITS 12/* 4 KiB Pages */ + +/* +* RISC-V-specific extra insn start words: +* 1: Original instruction opcode +* 2: more information about instruction +*/ +#define TARGET_INSN_START_EXTRA_WORDS 2 +/* * The current MMU Modes are: * - U mode 0b000
target/riscv/cpu.h +0 -6
@@ -45,12 +45,6 @@ typedef struct CPUArchState CPURISCVState;# define TYPE_RISCV_CPU_BASE TYPE_RISCV_CPU_BASE64#endif -/* -* RISC-V-specific extra insn start words: -* 1: Original instruction opcode -* 2: more information about instruction -*/ -#define TARGET_INSN_START_EXTRA_WORDS 2/* * b0: Whether a instruction always raise a store AMO or not. */
target/s390x/cpu-param.h +2 -0
@@ -12,6 +12,8 @@#define TARGET_PHYS_ADDR_SPACE_BITS 64#define TARGET_VIRT_ADDR_SPACE_BITS 64 +#define TARGET_INSN_START_EXTRA_WORDS 2 +/* * The z/Architecture has a strong memory model with some * store-after-load re-ordering.
target/s390x/cpu.h +0 -2
@@ -37,8 +37,6 @@#define TARGET_HAS_PRECISE_SMC -#define TARGET_INSN_START_EXTRA_WORDS 2 -#define MMU_USER_IDX 0#define S390_MAX_CPUS 248
target/sh4/cpu-param.h +2 -0
@@ -16,4 +16,6 @@# define TARGET_VIRT_ADDR_SPACE_BITS 32#endif +#define TARGET_INSN_START_EXTRA_WORDS 1 +#endif
target/sh4/cpu.h +0 -2
@@ -127,8 +127,6 @@ typedef struct tlb_t {#define UTLB_SIZE 64#define ITLB_SIZE 4 -#define TARGET_INSN_START_EXTRA_WORDS 1 -enum sh_features {SH_FEATURE_SH4A =1 ,SH_FEATURE_BCR3_AND_BCR4 =2 ,
target/sparc/cpu-param.h +2 -0
@@ -21,6 +21,8 @@# define TARGET_VIRT_ADDR_SPACE_BITS 32#endif +#define TARGET_INSN_START_EXTRA_WORDS 1 +/* * From Oracle SPARC Architecture 2015: *
target/sparc/cpu.h +0 -1
@@ -223,7 +223,6 @@ typedef struct trap_state {uint32_t tt; } trap_state;#endif -#define TARGET_INSN_START_EXTRA_WORDS 1 typedef struct sparc_def_t { const char *name;
Signature · 1 line
2.47.1
PATCH v3 4/19 tcg: Always define TARGET_INSN_START_EXTRA_WORDS
In reply to Philippe Mathieu-DaudéDo not define TARGET_INSN_START_EXTRA_WORDS under the hood, have each target explicitly define it.
--- include/tcg/insn-start-words.h | 4 ---- include/tcg/tcg-op.h | 2 +- target/alpha/cpu-param.h | 2 ++ target/avr/cpu-param.h | 2 ++ target/hexagon/cpu-param.h | 2 ++ target/loongarch/cpu-param.h | 2 ++ target/ppc/cpu-param.h | 2 ++ target/rx/cpu-param.h | 2 ++ target/tricore/cpu-param.h | 2 ++ target/xtensa/cpu-param.h | 2 ++ 10 files changed, 17 insertions(+), 5 deletions(-)
include/tcg/insn-start-words.h +0 -4
@@ -8,10 +8,6 @@#include "cpu-param.h" -#ifndef TARGET_INSN_START_EXTRA_WORDS -# define TARGET_INSN_START_WORDS 1 -#else # define TARGET_INSN_START_WORDS (1 + TARGET_INSN_START_EXTRA_WORDS) -#endif #endif /* TARGET_INSN_START_WORDS */
include/tcg/tcg-op.h +1 -1
@@ -23,7 +23,7 @@# error #endif -#ifndef TARGET_INSN_START_EXTRA_WORDS +#if TARGET_INSN_START_EXTRA_WORDS ==0 static inline void tcg_gen_insn_start (target_ulong pc) {TCGOp *op =tcg_emit_op (INDEX_op_insn_start,64 /TCG_TARGET_REG_BITS );
target/alpha/cpu-param.h +2 -0
@@ -24,6 +24,8 @@# define TARGET_VIRT_ADDR_SPACE_BITS (30 + TARGET_PAGE_BITS)#endif +#define TARGET_INSN_START_EXTRA_WORDS 0 +/* Alpha processors have a weak memory model */ #define TCG_GUEST_DEFAULT_MO (0)
target/avr/cpu-param.h +2 -0
@@ -25,6 +25,8 @@#define TARGET_PHYS_ADDR_SPACE_BITS 24#define TARGET_VIRT_ADDR_SPACE_BITS 24 +#define TARGET_INSN_START_EXTRA_WORDS 0 +#define TCG_GUEST_DEFAULT_MO 0#endif
target/hexagon/cpu-param.h +2 -0
@@ -23,4 +23,6 @@#define TARGET_PHYS_ADDR_SPACE_BITS 36#define TARGET_VIRT_ADDR_SPACE_BITS 32 +#define TARGET_INSN_START_EXTRA_WORDS 0 +#endif
target/loongarch/cpu-param.h +2 -0
@@ -13,6 +13,8 @@#define TARGET_PAGE_BITS 12 +#define TARGET_INSN_START_EXTRA_WORDS 0 +#define TCG_GUEST_DEFAULT_MO (0)#endif
target/ppc/cpu-param.h +2 -0
@@ -37,6 +37,8 @@# define TARGET_PAGE_BITS 12#endif +#define TARGET_INSN_START_EXTRA_WORDS 0 +#define TCG_GUEST_DEFAULT_MO 0#endif
target/rx/cpu-param.h +2 -0
@@ -24,4 +24,6 @@#define TARGET_PHYS_ADDR_SPACE_BITS 32#define TARGET_VIRT_ADDR_SPACE_BITS 32 +#define TARGET_INSN_START_EXTRA_WORDS 0 +#endif
target/tricore/cpu-param.h +2 -0
@@ -12,4 +12,6 @@#define TARGET_PHYS_ADDR_SPACE_BITS 32#define TARGET_VIRT_ADDR_SPACE_BITS 32 +#define TARGET_INSN_START_EXTRA_WORDS 0 +#endif
target/xtensa/cpu-param.h +2 -0
@@ -16,6 +16,8 @@#define TARGET_VIRT_ADDR_SPACE_BITS 32#endif +#define TARGET_INSN_START_EXTRA_WORDS 0 +/* Xtensa processors have a weak memory model */ #define TCG_GUEST_DEFAULT_MO (0)
Signature · 1 line
2.47.1
PATCH v3 5/19 exec: Restrict 'cpu-ldst-common.h' to accel/tcg/
In reply to Philippe Mathieu-Daudé---
include/{exec => accel/tcg}/cpu-ldst-common.h | 6 +++---
include/exec/cpu_ldst.h | 2 +-
accel/tcg/translator.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
rename include/{exec => accel/tcg}/cpu-ldst-common.h (97%)include/accel/tcg/cpu-ldst-common.h renamed from include/exec/cpu-ldst-common.h +3 -3
@@ -4,8 +4,8 @@* SPDX-License-Identifier: LGPL-2.1-or-later */ -#ifndef CPU_LDST_COMMON_H -#define CPU_LDST_COMMON_H +#ifndef ACCEL_TCG_CPU_LDST_COMMON_H +#define ACCEL_TCG_CPU_LDST_COMMON_H #ifndef CONFIG_TCG #error Can only include this header with TCG
@@ -119,4 +119,4 @@ uint32_t cpu_ldl_code_mmu(CPUArchState *env, vaddr addr,uint64_t cpu_ldq_code_mmu (CPUArchState *env,vaddr addr,MemOpIdx oi,uintptr_t ra); -#endif /* CPU_LDST_COMMON_H */ +#endif /* ACCEL_TCG_CPU_LDST_COMMON_H */
include/exec/cpu_ldst.h +1 -1
@@ -67,7 +67,7 @@#endif #include "exec/cpu-common.h" -#include "exec/cpu-ldst-common.h" +#include "accel/tcg/cpu-ldst-common.h" #include "accel/tcg/cpu-mmu-index.h" #include "exec/abi_ptr.h"
accel/tcg/translator.c +1 -1
@@ -11,7 +11,7 @@#include "qemu/bswap.h" #include "qemu/log.h" #include "qemu/error-report.h" -#include "exec/cpu-ldst-common.h" +#include "accel/tcg/cpu-ldst-common.h" #include "accel/tcg/cpu-mmu-index.h" #include "exec/target_page.h" #include "exec/translator.h"
Signature · 1 line
2.47.1
PATCH v3 6/19 exec: Restrict 'cpu_ldst.h' to accel/tcg/
In reply to Philippe Mathieu-DaudéMechanical change using:
$ sed -i -e 's,exec/cpu_ldst,accel/tcg/cpu-ldst,' \
$(git grep -l exec/cpu_ldst.h)---
bsd-user/qemu.h | 2 +-
include/{exec/cpu_ldst.h => accel/tcg/cpu-ldst.h} | 6 +++---
include/exec/exec-all.h | 2 +-
linux-user/qemu.h | 2 +-
target/arm/tcg/sve_ldst_internal.h | 2 +-
accel/tcg/cputlb.c | 2 +-
accel/tcg/user-exec.c | 2 +-
target/alpha/mem_helper.c | 2 +-
target/arm/tcg/helper-a64.c | 2 +-
target/arm/tcg/m_helper.c | 2 +-
target/arm/tcg/mte_helper.c | 2 +-
target/arm/tcg/mve_helper.c | 2 +-
target/arm/tcg/op_helper.c | 2 +-
target/arm/tcg/pauth_helper.c | 2 +-
target/arm/tcg/sme_helper.c | 2 +-
target/avr/helper.c | 2 +-
target/hexagon/op_helper.c | 2 +-
target/hexagon/translate.c | 2 +-
target/hppa/op_helper.c | 2 +-
target/i386/tcg/access.c | 2 +-
target/i386/tcg/fpu_helper.c | 2 +-
target/i386/tcg/mem_helper.c | 2 +-
target/i386/tcg/mpx_helper.c | 2 +-
target/i386/tcg/seg_helper.c | 2 +-
target/i386/tcg/system/excp_helper.c | 2 +-
target/i386/tcg/system/misc_helper.c | 2 +-
target/i386/tcg/system/seg_helper.c | 2 +-
target/i386/tcg/system/svm_helper.c | 2 +-
target/i386/tcg/user/seg_helper.c | 2 +-
target/loongarch/cpu.c | 2 +-
target/loongarch/tcg/csr_helper.c | 2 +-
target/loongarch/tcg/fpu_helper.c | 2 +-
target/loongarch/tcg/iocsr_helper.c | 2 +-
target/loongarch/tcg/op_helper.c | 2 +-
target/loongarch/tcg/tlb_helper.c | 2 +-
target/m68k/fpu_helper.c | 2 +-
target/m68k/op_helper.c | 2 +-
target/microblaze/cpu.c | 2 +-
target/microblaze/op_helper.c | 2 +-
target/microblaze/translate.c | 2 +-
target/mips/tcg/ldst_helper.c | 2 +-
target/mips/tcg/msa_helper.c | 2 +-
target/mips/tcg/system/tlb_helper.c | 2 +-
target/ppc/mem_helper.c | 2 +-
target/ppc/mmu_helper.c | 2 +-
target/ppc/tcg-excp_helper.c | 2 +-
target/riscv/op_helper.c | 2 +-
target/riscv/vector_helper.c | 2 +-
target/riscv/zce_helper.c | 2 +-
target/rx/helper.c | 2 +-
target/rx/op_helper.c | 2 +-
target/s390x/tcg/crypto_helper.c | 2 +-
target/s390x/tcg/int_helper.c | 2 +-
target/s390x/tcg/mem_helper.c | 2 +-
target/s390x/tcg/misc_helper.c | 2 +-
target/s390x/tcg/vec_helper.c | 2 +-
target/sh4/op_helper.c | 2 +-
target/sparc/int32_helper.c | 2 +-
target/sparc/ldst_helper.c | 2 +-
target/tricore/op_helper.c | 2 +-
target/tricore/translate.c | 2 +-
61 files changed, 63 insertions(+), 63 deletions(-)
rename include/{exec/cpu_ldst.h => accel/tcg/cpu-ldst.h} (99%)bsd-user/qemu.h +1 -1
@@ -22,7 +22,7 @@#include "qemu/int128.h" #include "cpu.h" #include "qemu/units.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/exec-all.h" #include "user/abitypes.h"
include/accel/tcg/cpu-ldst.h renamed from include/exec/cpu_ldst.h +3 -3
@@ -59,8 +59,8 @@* The "mmu" suffix carries the full MemOpIdx, with both mmu_idx and the * MemOp including alignment requirements. The alignment will be enforced. */ -#ifndef CPU_LDST_H -#define CPU_LDST_H +#ifndef ACCEL_TCG_CPU_LDST_H +#define ACCEL_TCG_CPU_LDST_H #ifndef CONFIG_TCG #error Can only include this header with TCG
@@ -560,4 +560,4 @@ static inline void clear_helper_retaddr(void)#define clear_helper_retaddr () do { } while (0)#endif -#endif /* CPU_LDST_H */ +#endif /* ACCEL_TCG_CPU_LDST_H */
include/exec/exec-all.h +1 -1
@@ -21,7 +21,7 @@#define EXEC_ALL_H #if defined(CONFIG_USER_ONLY ) -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #endif #include "exec/mmu-access-type.h" #include "exec/translation-block.h"
linux-user/qemu.h +1 -1
@@ -2,7 +2,7 @@#define QEMU_H #include "cpu.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "user/abitypes.h" #include "user/page-protection.h"
target/arm/tcg/sve_ldst_internal.h +1 -1
@@ -20,7 +20,7 @@#ifndef TARGET_ARM_SVE_LDST_INTERNAL_H #define TARGET_ARM_SVE_LDST_INTERNAL_H -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" /* * Load one element into @vd + @reg_off from @host.
accel/tcg/cputlb.c +1 -1
@@ -23,7 +23,7 @@#include "exec/exec-all.h" #include "exec/page-protection.h" #include "system/memory.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/cputlb.h" #include "exec/tb-flush.h" #include "system/ram_addr.h"
accel/tcg/user-exec.c +1 -1
@@ -26,7 +26,7 @@#include "tcg/tcg.h" #include "qemu/bitops.h" #include "qemu/rcu.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "user/cpu_loop.h" #include "qemu/main-loop.h" #include "user/page-protection.h"
target/alpha/mem_helper.c +1 -1
@@ -21,7 +21,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" static void do_unaligned_access (CPUAlphaState *env,vaddr addr,uintptr_t retaddr) {
target/arm/tcg/helper-a64.c +1 -1
@@ -30,7 +30,7 @@#include "qemu/crc32c.h" #include "exec/cpu-common.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/target_page.h" #include "exec/tlb-flags.h" #include "qemu/int128.h"
target/arm/tcg/m_helper.c +1 -1
@@ -18,7 +18,7 @@#include "exec/exec-all.h" #include "exec/page-protection.h" #ifdef CONFIG_TCG -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "semihosting/common-semi.h" #endif #if !defined(CONFIG_USER_ONLY )
target/arm/tcg/mte_helper.c +1 -1
@@ -29,7 +29,7 @@#else #include "system/ram_addr.h" #endif -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/helper-proto.h" #include "exec/tlb-flags.h" #include "accel/tcg/cpu-ops.h"
target/arm/tcg/mve_helper.c +1 -1
@@ -22,7 +22,7 @@#include "internals.h" #include "vec_internal.h" #include "exec/helper-proto.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/exec-all.h" #include "tcg/tcg.h" #include "fpu/softfloat.h"
target/arm/tcg/op_helper.c +1 -1
@@ -24,7 +24,7 @@#include "internals.h" #include "cpu-features.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "cpregs.h" #define SIGNBIT (uint32_t)0x80000000
target/arm/tcg/pauth_helper.c +1 -1
@@ -22,7 +22,7 @@#include "internals.h" #include "cpu-features.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/helper-proto.h" #include "tcg/tcg-gvec-desc.h" #include "qemu/xxhash.h"
target/arm/tcg/sme_helper.c +1 -1
@@ -22,7 +22,7 @@#include "internals.h" #include "tcg/tcg-gvec-desc.h" #include "exec/helper-proto.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/exec-all.h" #include "qemu/int128.h" #include "fpu/softfloat.h"
target/avr/helper.c +1 -1
@@ -27,7 +27,7 @@#include "exec/cputlb.h" #include "exec/page-protection.h" #include "exec/target_page.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/helper-proto.h" bool avr_cpu_exec_interrupt (CPUState *cs,int interrupt_request)
target/hexagon/op_helper.c +1 -1
@@ -18,7 +18,7 @@#include "qemu/osdep.h" #include "qemu/log.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/helper-proto.h" #include "fpu/softfloat.h" #include "cpu.h"
target/hexagon/translate.c +1 -1
@@ -23,7 +23,7 @@#include "exec/helper-gen.h" #include "exec/helper-proto.h" #include "exec/translation-block.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/log.h" #include "internal.h" #include "attribs.h"
target/hppa/op_helper.c +1 -1
@@ -22,7 +22,7 @@#include "cpu.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "qemu/timer.h" #include "trace.h" #ifdef CONFIG_USER_ONLY
target/i386/tcg/access.c +1 -1
@@ -3,7 +3,7 @@#include "qemu/osdep.h" #include "cpu.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/exec-all.h" #include "exec/target_page.h" #include "access.h"
target/i386/tcg/fpu_helper.c +1 -1
@@ -22,7 +22,7 @@#include "cpu.h" #include "tcg-cpu.h" #include "exec/cputlb.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/helper-proto.h" #include "fpu/softfloat.h" #include "fpu/softfloat-macros.h"
target/i386/tcg/mem_helper.c +1 -1
@@ -21,7 +21,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "qemu/int128.h" #include "qemu/atomic128.h" #include "tcg/tcg.h"
target/i386/tcg/mpx_helper.c +1 -1
@@ -20,7 +20,7 @@#include "qemu/osdep.h" #include "cpu.h" #include "exec/helper-proto.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/exec-all.h" #include "exec/target_page.h" #include "helper-tcg.h"
target/i386/tcg/seg_helper.c +1 -1
@@ -23,7 +23,7 @@#include "qemu/log.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/log.h" #include "helper-tcg.h" #include "seg_helper.h"
target/i386/tcg/system/excp_helper.c +1 -1
@@ -19,7 +19,7 @@#include "qemu/osdep.h" #include "cpu.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/cputlb.h" #include "exec/page-protection.h" #include "exec/target_page.h"
target/i386/tcg/system/misc_helper.c +1 -1
@@ -21,7 +21,7 @@#include "qemu/main-loop.h" #include "cpu.h" #include "exec/helper-proto.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "system/address-spaces.h" #include "system/memory.h" #include "exec/cputlb.h"
target/i386/tcg/system/seg_helper.c +1 -1
@@ -23,7 +23,7 @@#include "qemu/main-loop.h" #include "cpu.h" #include "exec/helper-proto.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "tcg/helper-tcg.h" #include "../seg_helper.h"
target/i386/tcg/system/svm_helper.c +1 -1
@@ -22,7 +22,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "exec/cputlb.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "tcg/helper-tcg.h" /* Secure Virtual Machine helpers */
target/i386/tcg/user/seg_helper.c +1 -1
@@ -22,7 +22,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "tcg/helper-tcg.h" #include "tcg/seg_helper.h"
target/loongarch/cpu.c +1 -1
@@ -29,7 +29,7 @@#include <linux/kvm.h> #endif #ifdef CONFIG_TCG -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "tcg/tcg.h" #endif
target/loongarch/tcg/csr_helper.c +1 -1
@@ -13,7 +13,7 @@#include "qemu/host-utils.h" #include "exec/helper-proto.h" #include "exec/cputlb.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "hw/irq.h" #include "cpu-csr.h"
target/loongarch/tcg/fpu_helper.c +1 -1
@@ -9,7 +9,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "fpu/softfloat.h" #include "internals.h"
target/loongarch/tcg/iocsr_helper.c +1 -1
@@ -10,7 +10,7 @@#include "qemu/host-utils.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #define GET_MEMTXATTRS (cas) \ ((MemTxAttrs){.requester_id = env_cpu(cas)->cpu_index})
target/loongarch/tcg/op_helper.c +1 -1
@@ -11,7 +11,7 @@#include "qemu/host-utils.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "internals.h" #include "qemu/crc32c.h" #include <zlib.h> /* for crc32 */
target/loongarch/tcg/tlb_helper.c +1 -1
@@ -16,7 +16,7 @@#include "exec/exec-all.h" #include "exec/page-protection.h" #include "exec/target_page.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/log.h" #include "cpu-csr.h"
target/m68k/fpu_helper.c +1 -1
@@ -22,7 +22,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "softfloat.h" /*
target/m68k/op_helper.c +1 -1
@@ -21,7 +21,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "semihosting/semihost.h" #if !defined(CONFIG_USER_ONLY )
target/microblaze/cpu.c +1 -1
@@ -28,7 +28,7 @@#include "qemu/module.h" #include "hw/qdev-properties.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/gdbstub.h" #include "exec/translation-block.h" #include "fpu/softfloat-helpers.h"
target/microblaze/op_helper.c +1 -1
@@ -24,7 +24,7 @@#include "exec/helper-proto.h" #include "qemu/host-utils.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "fpu/softfloat.h" void helper_put (uint32_t id,uint32_t ctrl,uint32_t data)
target/microblaze/translate.c +1 -1
@@ -21,7 +21,7 @@#include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "tcg/tcg-op.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h"
target/mips/tcg/ldst_helper.c +1 -1
@@ -24,7 +24,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/memop.h" #include "internal.h"
target/mips/tcg/msa_helper.c +1 -1
@@ -22,7 +22,7 @@#include "internal.h" #include "tcg/tcg.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/helper-proto.h" #include "exec/memop.h" #include "exec/target_page.h"
target/mips/tcg/system/tlb_helper.c +1 -1
@@ -25,7 +25,7 @@#include "exec/exec-all.h" #include "exec/page-protection.h" #include "exec/target_page.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/log.h" #include "exec/helper-proto.h"
target/ppc/mem_helper.c +1 -1
@@ -24,7 +24,7 @@#include "qemu/host-utils.h" #include "exec/helper-proto.h" #include "helper_regs.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "internal.h" #include "qemu/atomic128.h"
target/ppc/mmu_helper.c +1 -1
@@ -37,7 +37,7 @@#include "mmu-radix64.h" #include "mmu-booke.h" #include "exec/helper-proto.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" /* #define FLUSH_ALL_TLBS */
target/ppc/tcg-excp_helper.c +1 -1
@@ -20,7 +20,7 @@#include "qemu/main-loop.h" #include "qemu/log.h" #include "target/ppc/cpu.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" #include "system/runstate.h"
target/riscv/op_helper.c +1 -1
@@ -23,7 +23,7 @@#include "internals.h" #include "exec/exec-all.h" #include "exec/cputlb.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/helper-proto.h" #include "exec/tlb-flags.h" #include "trace.h"
target/riscv/vector_helper.c +1 -1
@@ -22,7 +22,7 @@#include "cpu.h" #include "exec/memop.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/page-protection.h" #include "exec/helper-proto.h" #include "exec/tlb-flags.h"
target/riscv/zce_helper.c +1 -1
@@ -20,7 +20,7 @@#include "cpu.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" target_ulong HELPER (cm_jalt )(CPURISCVState *env,uint32_t index) {
target/rx/helper.c +1 -1
@@ -20,7 +20,7 @@#include "qemu/bitops.h" #include "cpu.h" #include "exec/log.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "hw/irq.h" void rx_cpu_unpack_psw (CPURXState *env,uint32_t psw,int rte)
target/rx/op_helper.c +1 -1
@@ -21,7 +21,7 @@#include "cpu.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "fpu/softfloat.h" #include "tcg/debug-assert.h"
target/s390x/tcg/crypto_helper.c +1 -1
@@ -18,7 +18,7 @@#include "tcg_s390x.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" static uint64_t R (uint64_t x,int c) {
target/s390x/tcg/int_helper.c +1 -1
@@ -25,7 +25,7 @@#include "exec/exec-all.h" #include "qemu/host-utils.h" #include "exec/helper-proto.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" /* #define DEBUG_HELPER */ #ifdef DEBUG_HELPER
target/s390x/tcg/mem_helper.c +1 -1
@@ -28,7 +28,7 @@#include "exec/exec-all.h" #include "exec/cputlb.h" #include "exec/page-protection.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/target_page.h" #include "exec/tlb-flags.h" #include "accel/tcg/cpu-ops.h"
target/s390x/tcg/misc_helper.c +1 -1
@@ -28,7 +28,7 @@#include "qemu/timer.h" #include "exec/exec-all.h" #include "exec/cputlb.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/target_page.h" #include "qapi/error.h" #include "tcg_s390x.h"
target/s390x/tcg/vec_helper.c +1 -1
@@ -16,7 +16,7 @@#include "tcg/tcg.h" #include "tcg/tcg-gvec-desc.h" #include "exec/helper-proto.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/exec-all.h" void HELPER(gvec_vbperm)(void *v1, const void *v2, const void *v3,
target/sh4/op_helper.c +1 -1
@@ -20,7 +20,7 @@#include "cpu.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "fpu/softfloat.h" #ifndef CONFIG_USER_ONLY
target/sparc/int32_helper.c +1 -1
@@ -21,7 +21,7 @@#include "qemu/main-loop.h" #include "cpu.h" #include "trace.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "exec/log.h" #include "system/runstate.h"
target/sparc/ldst_helper.c +1 -1
@@ -27,7 +27,7 @@#include "exec/cputlb.h" #include "exec/page-protection.h" #include "exec/target_page.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "system/memory.h" #ifdef CONFIG_USER_ONLY #include "user/page-protection.h"
target/tricore/op_helper.c +1 -1
@@ -19,7 +19,7 @@#include "qemu/host-utils.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include <zlib.h> /* for crc32 */
target/tricore/translate.c +1 -1
@@ -22,7 +22,7 @@#include "cpu.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" -#include "exec/cpu_ldst.h" +#include "accel/tcg/cpu-ldst.h" #include "qemu/qemu-print.h" #include "exec/helper-proto.h"
Signature · 1 line
2.47.1
PATCH v3 7/19 exec: Do not include 'accel/tcg/cpu-ldst.h' in 'exec-all.h'
In reply to Philippe Mathieu-DaudéOnly 2 files requiring "accel/tcg/cpu-ldst.h" API do not include it:
- accel/tcg/cpu-exec.c
- target/arm/tcg/sve_helper.c
Include it there and remove it from "exec/exec-all.h".
--- include/exec/exec-all.h | 3 --- accel/tcg/cpu-exec.c | 1 + target/arm/tcg/sve_helper.c | 1 + 3 files changed, 2 insertions(+), 3 deletions(-)
include/exec/exec-all.h +0 -3
@@ -20,9 +20,6 @@#ifndef EXEC_ALL_H #define EXEC_ALL_H -#if defined(CONFIG_USER_ONLY ) -#include "accel/tcg/cpu-ldst.h" -#endif #include "exec/mmu-access-type.h" #include "exec/translation-block.h"
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-ldst.h" #include "accel/tcg/cpu-ops.h" #include "trace.h" #include "disas/disas.h"
target/arm/tcg/sve_helper.c +1 -0
@@ -30,6 +30,7 @@#include "tcg/tcg.h" #include "vec_internal.h" #include "sve_ldst_internal.h" +#include "accel/tcg/cpu-ldst.h" #include "accel/tcg/cpu-ops.h" #ifdef CONFIG_USER_ONLY #include "user/page-protection.h"
Signature · 1 line
2.47.1
PATCH v3 8/19 tcg: Always define TCG_GUEST_DEFAULT_MO
In reply to Philippe Mathieu-DaudéWe only require the TCG_GUEST_DEFAULT_MO for MTTCG-enabled frontends, otherwise we use a default value of TCG_MO_ALL.
In order to simplify, require the definition for all targets, defining it for hexagon, m68k, rx, sh4 and tricore.
--- target/hexagon/cpu-param.h | 3 +++ target/m68k/cpu-param.h | 3 +++ target/rx/cpu-param.h | 3 +++ target/sh4/cpu-param.h | 3 +++ target/tricore/cpu-param.h | 3 +++ accel/tcg/translate-all.c | 4 ---- 6 files changed, 15 insertions(+), 4 deletions(-)
target/hexagon/cpu-param.h +3 -0
@@ -25,4 +25,7 @@#define TARGET_INSN_START_EXTRA_WORDS 0 +/* MTTCG not yet supported: require strict ordering */ +#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL +#endif
target/m68k/cpu-param.h +3 -0
@@ -19,4 +19,7 @@#define TARGET_INSN_START_EXTRA_WORDS 1 +/* MTTCG not yet supported: require strict ordering */ +#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL +#endif
target/rx/cpu-param.h +3 -0
@@ -26,4 +26,7 @@#define TARGET_INSN_START_EXTRA_WORDS 0 +/* MTTCG not yet supported: require strict ordering */ +#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL +#endif
target/sh4/cpu-param.h +3 -0
@@ -18,4 +18,7 @@#define TARGET_INSN_START_EXTRA_WORDS 1 +/* MTTCG not yet supported: require strict ordering */ +#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL +#endif
target/tricore/cpu-param.h +3 -0
@@ -14,4 +14,7 @@#define TARGET_INSN_START_EXTRA_WORDS 0 +/* MTTCG not yet supported: require strict ordering */ +#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL +#endif
accel/tcg/translate-all.c +0 -4
@@ -353,11 +353,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tcg_ctx->tlb_dyn_max_bits =CPU_TLB_DYN_MAX_BITS ;#endif tcg_ctx->insn_start_words =TARGET_INSN_START_WORDS ; -#ifdef TCG_GUEST_DEFAULT_MO tcg_ctx->guest_mo =TCG_GUEST_DEFAULT_MO ; -#else - tcg_ctx->guest_mo =TCG_MO_ALL ; -#endif restart_translate:trace_translate_block (tb, pc, tb->tc.ptr);
Signature · 1 line
2.47.1
PATCH v3 9/19 tcg: Simplify tcg_req_mo() macro
In reply to Philippe Mathieu-DaudéNow that TCG_GUEST_DEFAULT_MO is always defined,
simplify the tcg_req_mo() macro.
--- accel/tcg/internal-target.h | 9 +-------- accel/tcg/tcg-all.c | 3 --- 2 files changed, 1 insertion(+), 11 deletions(-)
accel/tcg/internal-target.h +1 -8
@@ -52,17 +52,10 @@ G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);* memory ordering vs the host memory ordering. A non-zero * result indicates that some barrier is required. * -* If TCG_GUEST_DEFAULT_MO is not defined, assume that the -* guest requires strict ordering. -* * This is a macro so that it's constant even without optimization. */ -#ifdef TCG_GUEST_DEFAULT_MO -# define tcg_req_mo (type) \ +#define tcg_req_mo (type) \ ((type) & TCG_GUEST_DEFAULT_MO & ~TCG_TARGET_DEFAULT_MO) -#else -# define tcg_req_mo (type) ((type) & ~TCG_TARGET_DEFAULT_MO) -#endif /** * cpu_req_mo:
accel/tcg/tcg-all.c +0 -3
@@ -77,9 +77,6 @@ static bool default_mttcg_enabled(void)return false; }#ifdef TARGET_SUPPORTS_MTTCG -# ifndef TCG_GUEST_DEFAULT_MO -# error "TARGET_SUPPORTS_MTTCG without TCG_GUEST_DEFAULT_MO" -# endif return true;#else return false;
Signature · 1 line
2.47.1
PATCH v3 10/19 tcg: Define guest_default_memory_order in TCGCPUOps
In reply to Philippe Mathieu-DaudéAdd the TCGCPUOps::guest_default_memory_order field and have each target initialize it.
--- include/accel/tcg/cpu-ops.h | 8 ++++++++ target/alpha/cpu.c | 2 ++ target/arm/cpu.c | 2 ++ target/arm/tcg/cpu-v7m.c | 2 ++ target/avr/cpu.c | 1 + target/hexagon/cpu.c | 1 + target/hppa/cpu.c | 2 ++ target/i386/tcg/tcg-cpu.c | 1 + target/loongarch/cpu.c | 2 ++ target/m68k/cpu.c | 2 ++ target/microblaze/cpu.c | 2 ++ target/mips/cpu.c | 2 ++ target/openrisc/cpu.c | 2 ++ target/ppc/cpu_init.c | 1 + target/riscv/tcg/tcg-cpu.c | 2 ++ target/rx/cpu.c | 2 ++ target/s390x/cpu.c | 2 ++ target/sh4/cpu.c | 2 ++ target/sparc/cpu.c | 2 ++ target/tricore/cpu.c | 1 + target/xtensa/cpu.c | 2 ++ 21 files changed, 43 insertions(+)
include/accel/tcg/cpu-ops.h +8 -0
@@ -16,8 +16,16 @@#include "exec/memop.h" #include "exec/mmu-access-type.h" #include "exec/vaddr.h" +#include "tcg/tcg-mo.h" struct TCGCPUOps { + +/** +* @guest_default_memory_order: default barrier that is required +* for the guest memory ordering. +*/ +TCGBar guest_default_memory_order; +/** * @initialize: Initialize TCG state *
target/alpha/cpu.c +2 -0
@@ -235,6 +235,8 @@ static const struct SysemuCPUOps alpha_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps alpha_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = alpha_translate_init, .translate_code = alpha_translate_code, .synchronize_from_tb = alpha_cpu_synchronize_from_tb,
target/arm/cpu.c +2 -0
@@ -2671,6 +2671,8 @@ static const struct SysemuCPUOps arm_sysemu_ops = {#ifdef CONFIG_TCG static const TCGCPUOps arm_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = arm_translate_init, .translate_code = arm_translate_code, .synchronize_from_tb = arm_cpu_synchronize_from_tb,
target/arm/tcg/cpu-v7m.c +2 -0
@@ -232,6 +232,8 @@ static void cortex_m55_initfn(Object *obj) }static const TCGCPUOps arm_v7m_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = arm_translate_init, .translate_code = arm_translate_code, .synchronize_from_tb = arm_cpu_synchronize_from_tb,
target/avr/cpu.c +1 -0
@@ -224,6 +224,7 @@ static const struct SysemuCPUOps avr_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps avr_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , .initialize = avr_cpu_tcg_init, .translate_code = avr_cpu_translate_code, .synchronize_from_tb = avr_cpu_synchronize_from_tb,
target/hexagon/cpu.c +1 -0
@@ -325,6 +325,7 @@ static void hexagon_cpu_init(Object *obj)#include "accel/tcg/cpu-ops.h" static const TCGCPUOps hexagon_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , .initialize = hexagon_translate_init, .translate_code = hexagon_translate_code, .synchronize_from_tb = hexagon_cpu_synchronize_from_tb,
target/hppa/cpu.c +2 -0
@@ -253,6 +253,8 @@ static const struct SysemuCPUOps hppa_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps hppa_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = hppa_translate_init, .translate_code = hppa_translate_code, .synchronize_from_tb = hppa_cpu_synchronize_from_tb,
target/i386/tcg/tcg-cpu.c +1 -0
@@ -125,6 +125,7 @@ static bool x86_debug_check_breakpoint(CPUState *cs)#include "accel/tcg/cpu-ops.h" static const TCGCPUOps x86_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , .initialize = tcg_x86_init, .translate_code = x86_translate_code, .synchronize_from_tb = x86_cpu_synchronize_from_tb,
target/loongarch/cpu.c +2 -0
@@ -864,6 +864,8 @@ static void loongarch_cpu_dump_state(CPUState *cs, FILE *f, int flags)#include "accel/tcg/cpu-ops.h" static const TCGCPUOps loongarch_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = loongarch_translate_init, .translate_code = loongarch_translate_code, .synchronize_from_tb = loongarch_cpu_synchronize_from_tb,
target/m68k/cpu.c +2 -0
@@ -589,6 +589,8 @@ static const struct SysemuCPUOps m68k_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps m68k_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = m68k_tcg_init, .translate_code = m68k_translate_code, .restore_state_to_opc = m68k_restore_state_to_opc,
target/microblaze/cpu.c +2 -0
@@ -427,6 +427,8 @@ static const struct SysemuCPUOps mb_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps mb_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = mb_tcg_init, .translate_code = mb_translate_code, .synchronize_from_tb = mb_cpu_synchronize_from_tb,
target/mips/cpu.c +2 -0
@@ -550,6 +550,8 @@ static const Property mips_cpu_properties[] = {#ifdef CONFIG_TCG #include "accel/tcg/cpu-ops.h" static const TCGCPUOps mips_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = mips_tcg_init, .translate_code = mips_translate_code, .synchronize_from_tb = mips_cpu_synchronize_from_tb,
target/openrisc/cpu.c +2 -0
@@ -243,6 +243,8 @@ static const struct SysemuCPUOps openrisc_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps openrisc_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = openrisc_translate_init, .translate_code = openrisc_translate_code, .synchronize_from_tb = openrisc_cpu_synchronize_from_tb,
target/ppc/cpu_init.c +1 -0
@@ -7478,6 +7478,7 @@ static const struct SysemuCPUOps ppc_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps ppc_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , .initialize = ppc_translate_init, .translate_code = ppc_translate_code, .restore_state_to_opc = ppc_restore_state_to_opc,
target/riscv/tcg/tcg-cpu.c +2 -0
@@ -140,6 +140,8 @@ static void riscv_restore_state_to_opc(CPUState *cs, }static const TCGCPUOps riscv_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = riscv_translate_init, .translate_code = riscv_translate_code, .synchronize_from_tb = riscv_cpu_synchronize_from_tb,
target/rx/cpu.c +2 -0
@@ -204,6 +204,8 @@ static const struct SysemuCPUOps rx_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps rx_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = rx_translate_init, .translate_code = rx_translate_code, .synchronize_from_tb = rx_cpu_synchronize_from_tb,
target/s390x/cpu.c +2 -0
@@ -345,6 +345,8 @@ void cpu_get_tb_cpu_state(CPUS390XState *env, vaddr *pc, }static const TCGCPUOps s390_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = s390x_translate_init, .translate_code = s390x_translate_code, .restore_state_to_opc = s390x_restore_state_to_opc,
target/sh4/cpu.c +2 -0
@@ -262,6 +262,8 @@ static const struct SysemuCPUOps sh4_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps superh_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = sh4_translate_init, .translate_code = sh4_translate_code, .synchronize_from_tb = superh_cpu_synchronize_from_tb,
target/sparc/cpu.c +2 -0
@@ -1001,6 +1001,8 @@ static const struct SysemuCPUOps sparc_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps sparc_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = sparc_tcg_init, .translate_code = sparc_translate_code, .synchronize_from_tb = sparc_cpu_synchronize_from_tb,
target/tricore/cpu.c +1 -0
@@ -172,6 +172,7 @@ static const struct SysemuCPUOps tricore_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps tricore_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , .initialize = tricore_tcg_init, .translate_code = tricore_translate_code, .synchronize_from_tb = tricore_cpu_synchronize_from_tb,
target/xtensa/cpu.c +2 -0
@@ -232,6 +232,8 @@ static const struct SysemuCPUOps xtensa_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps xtensa_tcg_ops = { + .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .initialize = xtensa_translate_init, .translate_code = xtensa_translate_code, .debug_excp_handler = xtensa_breakpoint_handler,
Signature · 1 line
2.47.1
PATCH v3 11/19 tcg: Remove use of TCG_GUEST_DEFAULT_MO in tb_gen_code()
In reply to Philippe Mathieu-DaudéUse TCGCPUOps::guest_default_memory_order to set TCGContext::guest_mo.
--- accel/tcg/translate-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
accel/tcg/translate-all.c +1 -1
@@ -353,7 +353,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tcg_ctx->tlb_dyn_max_bits =CPU_TLB_DYN_MAX_BITS ;#endif tcg_ctx->insn_start_words =TARGET_INSN_START_WORDS ; - tcg_ctx->guest_mo =TCG_GUEST_DEFAULT_MO ; + tcg_ctx->guest_mo = cpu->cc->tcg_ops->guest_default_memory_order; restart_translate:trace_translate_block (tb, pc, tb->tc.ptr);
Signature · 1 line
2.47.1
PATCH v3 12/19 tcg: Propagate CPUState argument to cpu_req_mo()
In reply to Philippe Mathieu-DaudéIn preparation of having tcg_req_mo() access CPUState in the next commit, pass it to cpu_req_mo(), its single caller.
--- accel/tcg/internal-target.h | 3 ++- accel/tcg/cputlb.c | 20 ++++++++++---------- accel/tcg/user-exec.c | 20 ++++++++++---------- 3 files changed, 22 insertions(+), 21 deletions(-)
accel/tcg/internal-target.h +2 -1
@@ -59,12 +59,13 @@ G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);/** * cpu_req_mo: +* @cpu: CPUState * @type: TCGBar * * If tcg_req_mo indicates a barrier for @type is required * for the guest memory model, issue a host memory barrier. */ -#define cpu_req_mo (type) \ +#define cpu_req_mo (cpu, type) \ do { \ if (tcg_req_mo(type)) { \ smp_mb(); \
accel/tcg/cputlb.c +10 -10
@@ -2324,7 +2324,7 @@ static uint8_t do_ld1_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi,MMULookupLocals l;bool crosspage; -cpu_req_mo (TCG_MO_LD_LD |TCG_MO_ST_LD ); +cpu_req_mo (cpu,TCG_MO_LD_LD |TCG_MO_ST_LD ); crosspage =mmu_lookup (cpu, addr, oi, ra, access_type, &l);tcg_debug_assert (!crosspage);
@@ -2339,7 +2339,7 @@ static uint16_t do_ld2_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi,uint16_t ret;uint8_t a, b; -cpu_req_mo (TCG_MO_LD_LD |TCG_MO_ST_LD ); +cpu_req_mo (cpu,TCG_MO_LD_LD |TCG_MO_ST_LD ); crosspage =mmu_lookup (cpu, addr, oi, ra, access_type, &l);if (likely (!crosspage)) {return do_ld_2 (cpu, &l.page[0 ], l.mmu_idx, access_type, l.memop, ra);
@@ -2363,7 +2363,7 @@ static uint32_t do_ld4_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi,bool crosspage;uint32_t ret; -cpu_req_mo (TCG_MO_LD_LD |TCG_MO_ST_LD ); +cpu_req_mo (cpu,TCG_MO_LD_LD |TCG_MO_ST_LD ); crosspage =mmu_lookup (cpu, addr, oi, ra, access_type, &l);if (likely (!crosspage)) {return do_ld_4 (cpu, &l.page[0 ], l.mmu_idx, access_type, l.memop, ra);
@@ -2384,7 +2384,7 @@ static uint64_t do_ld8_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi,bool crosspage;uint64_t ret; -cpu_req_mo (TCG_MO_LD_LD |TCG_MO_ST_LD ); +cpu_req_mo (cpu,TCG_MO_LD_LD |TCG_MO_ST_LD ); crosspage =mmu_lookup (cpu, addr, oi, ra, access_type, &l);if (likely (!crosspage)) {return do_ld_8 (cpu, &l.page[0 ], l.mmu_idx, access_type, l.memop, ra);
@@ -2407,7 +2407,7 @@ static Int128 do_ld16_mmu(CPUState *cpu, vaddr addr,Int128 ret;int first; -cpu_req_mo (TCG_MO_LD_LD |TCG_MO_ST_LD ); +cpu_req_mo (cpu,TCG_MO_LD_LD |TCG_MO_ST_LD ); crosspage =mmu_lookup (cpu, addr, oi, ra,MMU_DATA_LOAD , &l);if (likely (!crosspage)) {if (unlikely (l.page[0 ].flags &TLB_MMIO )) {
@@ -2735,7 +2735,7 @@ static void do_st1_mmu(CPUState *cpu, vaddr addr, uint8_t val,MMULookupLocals l;bool crosspage; -cpu_req_mo (TCG_MO_LD_ST |TCG_MO_ST_ST ); +cpu_req_mo (cpu,TCG_MO_LD_ST |TCG_MO_ST_ST ); crosspage =mmu_lookup (cpu, addr, oi, ra,MMU_DATA_STORE , &l);tcg_debug_assert (!crosspage);
@@ -2749,7 +2749,7 @@ static void do_st2_mmu(CPUState *cpu, vaddr addr, uint16_t val,bool crosspage;uint8_t a, b; -cpu_req_mo (TCG_MO_LD_ST |TCG_MO_ST_ST ); +cpu_req_mo (cpu,TCG_MO_LD_ST |TCG_MO_ST_ST ); crosspage =mmu_lookup (cpu, addr, oi, ra,MMU_DATA_STORE , &l);if (likely (!crosspage)) {do_st_2 (cpu, &l.page[0 ], val, l.mmu_idx, l.memop, ra);
@@ -2771,7 +2771,7 @@ static void do_st4_mmu(CPUState *cpu, vaddr addr, uint32_t val,MMULookupLocals l;bool crosspage; -cpu_req_mo (TCG_MO_LD_ST |TCG_MO_ST_ST ); +cpu_req_mo (cpu,TCG_MO_LD_ST |TCG_MO_ST_ST ); crosspage =mmu_lookup (cpu, addr, oi, ra,MMU_DATA_STORE , &l);if (likely (!crosspage)) {do_st_4 (cpu, &l.page[0 ], val, l.mmu_idx, l.memop, ra);
@@ -2792,7 +2792,7 @@ static void do_st8_mmu(CPUState *cpu, vaddr addr, uint64_t val,MMULookupLocals l;bool crosspage; -cpu_req_mo (TCG_MO_LD_ST |TCG_MO_ST_ST ); +cpu_req_mo (cpu,TCG_MO_LD_ST |TCG_MO_ST_ST ); crosspage =mmu_lookup (cpu, addr, oi, ra,MMU_DATA_STORE , &l);if (likely (!crosspage)) {do_st_8 (cpu, &l.page[0 ], val, l.mmu_idx, l.memop, ra);
@@ -2815,7 +2815,7 @@ static void do_st16_mmu(CPUState *cpu, vaddr addr, Int128 val,uint64_t a, b;int first; -cpu_req_mo (TCG_MO_LD_ST |TCG_MO_ST_ST ); +cpu_req_mo (cpu,TCG_MO_LD_ST |TCG_MO_ST_ST ); crosspage =mmu_lookup (cpu, addr, oi, ra,MMU_DATA_STORE , &l);if (likely (!crosspage)) {if (unlikely (l.page[0 ].flags &TLB_MMIO )) {
accel/tcg/user-exec.c +10 -10
@@ -1061,7 +1061,7 @@ static uint8_t do_ld1_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi,void *haddr;uint8_t ret; -cpu_req_mo (TCG_MO_LD_LD |TCG_MO_ST_LD ); +cpu_req_mo (cpu,TCG_MO_LD_LD |TCG_MO_ST_LD ); haddr =cpu_mmu_lookup (cpu, addr,get_memop (oi), ra, access_type); ret =ldub_p (haddr);clear_helper_retaddr ();
@@ -1075,7 +1075,7 @@ static uint16_t do_ld2_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi,uint16_t ret;MemOp mop =get_memop (oi); -cpu_req_mo (TCG_MO_LD_LD |TCG_MO_ST_LD ); +cpu_req_mo (cpu,TCG_MO_LD_LD |TCG_MO_ST_LD ); haddr =cpu_mmu_lookup (cpu, addr, mop, ra, access_type); ret =load_atom_2 (cpu, ra, haddr, mop);clear_helper_retaddr ();
@@ -1093,7 +1093,7 @@ static uint32_t do_ld4_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi,uint32_t ret;MemOp mop =get_memop (oi); -cpu_req_mo (TCG_MO_LD_LD |TCG_MO_ST_LD ); +cpu_req_mo (cpu,TCG_MO_LD_LD |TCG_MO_ST_LD ); haddr =cpu_mmu_lookup (cpu, addr, mop, ra, access_type); ret =load_atom_4 (cpu, ra, haddr, mop);clear_helper_retaddr ();
@@ -1111,7 +1111,7 @@ static uint64_t do_ld8_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi,uint64_t ret;MemOp mop =get_memop (oi); -cpu_req_mo (TCG_MO_LD_LD |TCG_MO_ST_LD ); +cpu_req_mo (cpu,TCG_MO_LD_LD |TCG_MO_ST_LD ); haddr =cpu_mmu_lookup (cpu, addr, mop, ra, access_type); ret =load_atom_8 (cpu, ra, haddr, mop);clear_helper_retaddr ();
@@ -1130,7 +1130,7 @@ static Int128 do_ld16_mmu(CPUState *cpu, abi_ptr addr,MemOp mop =get_memop (oi);tcg_debug_assert ((mop &MO_SIZE ) ==MO_128 ); -cpu_req_mo (TCG_MO_LD_LD |TCG_MO_ST_LD ); +cpu_req_mo (cpu,TCG_MO_LD_LD |TCG_MO_ST_LD ); haddr =cpu_mmu_lookup (cpu, addr, mop, ra,MMU_DATA_LOAD ); ret =load_atom_16 (cpu, ra, haddr, mop);clear_helper_retaddr ();
@@ -1146,7 +1146,7 @@ static void do_st1_mmu(CPUState *cpu, vaddr addr, uint8_t val, {void *haddr; -cpu_req_mo (TCG_MO_LD_ST |TCG_MO_ST_ST ); +cpu_req_mo (cpu,TCG_MO_LD_ST |TCG_MO_ST_ST ); haddr =cpu_mmu_lookup (cpu, addr,get_memop (oi), ra,MMU_DATA_STORE );stb_p (haddr, val);clear_helper_retaddr ();
@@ -1158,7 +1158,7 @@ static void do_st2_mmu(CPUState *cpu, vaddr addr, uint16_t val,void *haddr;MemOp mop =get_memop (oi); -cpu_req_mo (TCG_MO_LD_ST |TCG_MO_ST_ST ); +cpu_req_mo (cpu,TCG_MO_LD_ST |TCG_MO_ST_ST ); haddr =cpu_mmu_lookup (cpu, addr, mop, ra,MMU_DATA_STORE );if (mop &MO_BSWAP ) {
@@ -1174,7 +1174,7 @@ static void do_st4_mmu(CPUState *cpu, vaddr addr, uint32_t val,void *haddr;MemOp mop =get_memop (oi); -cpu_req_mo (TCG_MO_LD_ST |TCG_MO_ST_ST ); +cpu_req_mo (cpu,TCG_MO_LD_ST |TCG_MO_ST_ST ); haddr =cpu_mmu_lookup (cpu, addr, mop, ra,MMU_DATA_STORE );if (mop &MO_BSWAP ) {
@@ -1190,7 +1190,7 @@ static void do_st8_mmu(CPUState *cpu, vaddr addr, uint64_t val,void *haddr;MemOp mop =get_memop (oi); -cpu_req_mo (TCG_MO_LD_ST |TCG_MO_ST_ST ); +cpu_req_mo (cpu,TCG_MO_LD_ST |TCG_MO_ST_ST ); haddr =cpu_mmu_lookup (cpu, addr, mop, ra,MMU_DATA_STORE );if (mop &MO_BSWAP ) {
@@ -1206,7 +1206,7 @@ static void do_st16_mmu(CPUState *cpu, vaddr addr, Int128 val,void *haddr;MemOpIdx mop =get_memop (oi); -cpu_req_mo (TCG_MO_LD_ST |TCG_MO_ST_ST ); +cpu_req_mo (cpu,TCG_MO_LD_ST |TCG_MO_ST_ST ); haddr =cpu_mmu_lookup (cpu, addr, mop, ra,MMU_DATA_STORE );if (mop &MO_BSWAP ) {
Signature · 1 line
2.47.1
PATCH v3 13/19 tcg: Have tcg_req_mo() use TCGCPUOps::guest_default_memory_order
In reply to Philippe Mathieu-DaudéIn order to use TCG with multiple targets, replace the compile time use of TCG_GUEST_DEFAULT_MO by a runtime access to TCGCPUOps::guest_default_memory_order via CPUState.
--- accel/tcg/internal-target.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
accel/tcg/internal-target.h +4 -5
@@ -46,16 +46,15 @@ G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);/** * tcg_req_mo: +* @guest_mo: Guest default memory order * @type: TCGBar * * Filter @type to the barrier that is required for the guest * memory ordering vs the host memory ordering. A non-zero * result indicates that some barrier is required. -* -* This is a macro so that it's constant even without optimization. */ -#define tcg_req_mo (type) \ - ((type) & TCG_GUEST_DEFAULT_MO & ~TCG_TARGET_DEFAULT_MO) +#define tcg_req_mo (guest_mo, type) \ + ((type) & guest_mo & ~TCG_TARGET_DEFAULT_MO)/** * cpu_req_mo:
@@ -67,7 +66,7 @@ G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);*/ #define cpu_req_mo (cpu, type) \ do { \ - if (tcg_req_mo(type)) { \ + if (tcg_req_mo(cpu->cc->tcg_ops->guest_default_memory_order, type)) { \ smp_mb(); \ } \ } while (0)
Signature · 1 line
2.47.1
PATCH v3 14/19 tcg: Remove the TCG_GUEST_DEFAULT_MO definition globally
In reply to Philippe Mathieu-DaudéBy directly using TCGCPUOps::guest_default_memory_order, we don't need the TCG_GUEST_DEFAULT_MO definition anymore.
--- docs/devel/multi-thread-tcg.rst | 4 ++-- target/alpha/cpu-param.h | 3 --- target/arm/cpu-param.h | 3 --- target/avr/cpu-param.h | 2 -- target/hexagon/cpu-param.h | 3 --- target/hppa/cpu-param.h | 8 -------- target/i386/cpu-param.h | 3 --- target/loongarch/cpu-param.h | 2 -- target/m68k/cpu-param.h | 3 --- target/microblaze/cpu-param.h | 3 --- target/mips/cpu-param.h | 2 -- target/openrisc/cpu-param.h | 2 -- target/ppc/cpu-param.h | 2 -- target/riscv/cpu-param.h | 2 -- target/rx/cpu-param.h | 3 --- target/s390x/cpu-param.h | 6 ------ target/sh4/cpu-param.h | 3 --- target/sparc/cpu-param.h | 23 ----------------------- target/tricore/cpu-param.h | 3 --- target/xtensa/cpu-param.h | 3 --- target/alpha/cpu.c | 3 ++- target/arm/cpu.c | 3 ++- target/arm/tcg/cpu-v7m.c | 3 ++- target/avr/cpu.c | 2 +- target/hexagon/cpu.c | 3 ++- target/hppa/cpu.c | 8 +++++++- target/i386/tcg/tcg-cpu.c | 5 ++++- target/loongarch/cpu.c | 2 +- target/m68k/cpu.c | 3 ++- target/microblaze/cpu.c | 3 ++- target/mips/cpu.c | 2 +- target/openrisc/cpu.c | 2 +- target/ppc/cpu_init.c | 2 +- target/riscv/tcg/tcg-cpu.c | 2 +- target/rx/cpu.c | 3 ++- target/s390x/cpu.c | 6 +++++- target/sh4/cpu.c | 3 ++- target/sparc/cpu.c | 23 ++++++++++++++++++++++- target/tricore/cpu.c | 3 ++- target/xtensa/cpu.c | 3 ++- 40 files changed, 66 insertions(+), 101 deletions(-)
docs/devel/multi-thread-tcg.rst +2 -2
@@ -28,8 +28,8 @@ vCPU Scheduling We introduce a new running mode where each vCPU will run on its own user-space thread. This is enabled by default for all FE/BE combinations where the host memory model is able to accommodate the -guest (TCG_GUEST_DEFAULT_MO & ~TCG_TARGET_DEFAULT_MO is zero) and the -guest has had the required work done to support this safely +guest (TCGCPUOps::guest_default_memory_order & ~TCG_TARGET_DEFAULT_MO is zero) +and the guest has had the required work done to support this safely (TARGET_SUPPORTS_MTTCG). System emulation will fall back to the original round robin approach
target/alpha/cpu-param.h +0 -3
@@ -26,7 +26,4 @@#define TARGET_INSN_START_EXTRA_WORDS 0 -/* Alpha processors have a weak memory model */ -#define TCG_GUEST_DEFAULT_MO (0) -#endif
target/arm/cpu-param.h +0 -3
@@ -44,7 +44,4 @@*/ #define TARGET_INSN_START_EXTRA_WORDS 2 -/* ARM processors have a weak memory model */ -#define TCG_GUEST_DEFAULT_MO (0) -#endif
target/avr/cpu-param.h +0 -2
@@ -27,6 +27,4 @@#define TARGET_INSN_START_EXTRA_WORDS 0 -#define TCG_GUEST_DEFAULT_MO 0 -#endif
target/hexagon/cpu-param.h +0 -3
@@ -25,7 +25,4 @@#define TARGET_INSN_START_EXTRA_WORDS 0 -/* MTTCG not yet supported: require strict ordering */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL -#endif
target/hppa/cpu-param.h +0 -8
@@ -21,12 +21,4 @@#define TARGET_INSN_START_EXTRA_WORDS 2 -/* PA-RISC 1.x processors have a strong memory model. */ -/* -* ??? While we do not yet implement PA-RISC 2.0, those processors have -* a weak memory model, but with TLB bits that force ordering on a per-page -* basis. It's probably easier to fall back to a strong memory model. -*/ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL -#endif
target/i386/cpu-param.h +0 -3
@@ -24,7 +24,4 @@#define TARGET_INSN_START_EXTRA_WORDS 1 -/* The x86 has a strong memory model with some store-after-load re-ordering */ -#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) -#endif
target/loongarch/cpu-param.h +0 -2
@@ -15,6 +15,4 @@#define TARGET_INSN_START_EXTRA_WORDS 0 -#define TCG_GUEST_DEFAULT_MO (0) -#endif
target/m68k/cpu-param.h +0 -3
@@ -19,7 +19,4 @@#define TARGET_INSN_START_EXTRA_WORDS 1 -/* MTTCG not yet supported: require strict ordering */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL -#endif
target/microblaze/cpu-param.h +0 -3
@@ -29,7 +29,4 @@#define TARGET_INSN_START_EXTRA_WORDS 1 -/* MicroBlaze is always in-order. */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL -#endif
target/mips/cpu-param.h +0 -2
@@ -22,6 +22,4 @@#define TARGET_INSN_START_EXTRA_WORDS 2 -#define TCG_GUEST_DEFAULT_MO (0) -#endif
target/openrisc/cpu-param.h +0 -2
@@ -14,6 +14,4 @@#define TARGET_INSN_START_EXTRA_WORDS 1 -#define TCG_GUEST_DEFAULT_MO (0) -#endif
target/ppc/cpu-param.h +0 -2
@@ -39,6 +39,4 @@#define TARGET_INSN_START_EXTRA_WORDS 0 -#define TCG_GUEST_DEFAULT_MO 0 -#endif
target/riscv/cpu-param.h +0 -2
@@ -34,6 +34,4 @@* - M mode HLV/HLVX/HSV 0b111 */ -#define TCG_GUEST_DEFAULT_MO 0 -#endif
target/rx/cpu-param.h +0 -3
@@ -26,7 +26,4 @@#define TARGET_INSN_START_EXTRA_WORDS 0 -/* MTTCG not yet supported: require strict ordering */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL -#endif
target/s390x/cpu-param.h +0 -6
@@ -14,10 +14,4 @@#define TARGET_INSN_START_EXTRA_WORDS 2 -/* -* The z/Architecture has a strong memory model with some -* store-after-load re-ordering. -*/ -#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) -#endif
target/sh4/cpu-param.h +0 -3
@@ -18,7 +18,4 @@#define TARGET_INSN_START_EXTRA_WORDS 1 -/* MTTCG not yet supported: require strict ordering */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL -#endif
target/sparc/cpu-param.h +0 -23
@@ -23,27 +23,4 @@#define TARGET_INSN_START_EXTRA_WORDS 1 -/* -* From Oracle SPARC Architecture 2015: -* -* Compatibility notes: The PSO memory model described in SPARC V8 and -* SPARC V9 compatibility architecture specifications was never implemented -* in a SPARC V9 implementation and is not included in the Oracle SPARC -* Architecture specification. -* -* The RMO memory model described in the SPARC V9 specification was -* implemented in some non-Sun SPARC V9 implementations, but is not -* directly supported in Oracle SPARC Architecture 2015 implementations. -* -* Therefore always use TSO in QEMU. -* -* D.5 Specification of Partial Store Order (PSO) -* ... [loads] are followed by an implied MEMBAR #LoadLoad | #LoadStore. -* -* D.6 Specification of Total Store Order (TSO) -* ... PSO with the additional requirement that all [stores] are followed -* by an implied MEMBAR #StoreStore. -*/ -#define TCG_GUEST_DEFAULT_MO (TCG_MO_LD_LD | TCG_MO_LD_ST | TCG_MO_ST_ST) -#endif
target/tricore/cpu-param.h +0 -3
@@ -14,7 +14,4 @@#define TARGET_INSN_START_EXTRA_WORDS 0 -/* MTTCG not yet supported: require strict ordering */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL -#endif
target/xtensa/cpu-param.h +0 -3
@@ -18,7 +18,4 @@#define TARGET_INSN_START_EXTRA_WORDS 0 -/* Xtensa processors have a weak memory model */ -#define TCG_GUEST_DEFAULT_MO (0) -#endif
target/alpha/cpu.c +2 -1
@@ -235,7 +235,8 @@ static const struct SysemuCPUOps alpha_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps alpha_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* Alpha processors have a weak memory model */ + .guest_default_memory_order =0 , .initialize = alpha_translate_init, .translate_code = alpha_translate_code,
target/arm/cpu.c +2 -1
@@ -2671,7 +2671,8 @@ static const struct SysemuCPUOps arm_sysemu_ops = {#ifdef CONFIG_TCG static const TCGCPUOps arm_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* ARM processors have a weak memory model */ + .guest_default_memory_order =0 , .initialize = arm_translate_init, .translate_code = arm_translate_code,
target/arm/tcg/cpu-v7m.c +2 -1
@@ -232,7 +232,8 @@ static void cortex_m55_initfn(Object *obj) }static const TCGCPUOps arm_v7m_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* ARM processors have a weak memory model */ + .guest_default_memory_order =0 , .initialize = arm_translate_init, .translate_code = arm_translate_code,
target/avr/cpu.c +1 -1
@@ -224,7 +224,7 @@ static const struct SysemuCPUOps avr_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps avr_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .guest_default_memory_order =0 , .initialize = avr_cpu_tcg_init, .translate_code = avr_cpu_translate_code, .synchronize_from_tb = avr_cpu_synchronize_from_tb,
target/hexagon/cpu.c +2 -1
@@ -325,7 +325,8 @@ static void hexagon_cpu_init(Object *obj)#include "accel/tcg/cpu-ops.h" static const TCGCPUOps hexagon_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* MTTCG not yet supported: require strict ordering */ + .guest_default_memory_order =TCG_MO_ALL , .initialize = hexagon_translate_init, .translate_code = hexagon_translate_code, .synchronize_from_tb = hexagon_cpu_synchronize_from_tb,
target/hppa/cpu.c +7 -1
@@ -253,7 +253,13 @@ static const struct SysemuCPUOps hppa_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps hppa_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* PA-RISC 1.x processors have a strong memory model. */ +/* +* ??? While we do not yet implement PA-RISC 2.0, those processors have +* a weak memory model, but with TLB bits that force ordering on a per-page +* basis. It's probably easier to fall back to a strong memory model. +*/ + .guest_default_memory_order =TCG_MO_ALL , .initialize = hppa_translate_init, .translate_code = hppa_translate_code,
target/i386/tcg/tcg-cpu.c +4 -1
@@ -125,7 +125,10 @@ static bool x86_debug_check_breakpoint(CPUState *cs)#include "accel/tcg/cpu-ops.h" static const TCGCPUOps x86_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* +* The x86 has a strong memory model with some store-after-load re-ordering +*/ + .guest_default_memory_order =TCG_MO_ALL & ~TCG_MO_ST_LD , .initialize = tcg_x86_init, .translate_code = x86_translate_code, .synchronize_from_tb = x86_cpu_synchronize_from_tb,
target/loongarch/cpu.c +1 -1
@@ -864,7 +864,7 @@ static void loongarch_cpu_dump_state(CPUState *cs, FILE *f, int flags)#include "accel/tcg/cpu-ops.h" static const TCGCPUOps loongarch_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .guest_default_memory_order =0 , .initialize = loongarch_translate_init, .translate_code = loongarch_translate_code,
target/m68k/cpu.c +2 -1
@@ -589,7 +589,8 @@ static const struct SysemuCPUOps m68k_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps m68k_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* MTTCG not yet supported: require strict ordering */ + .guest_default_memory_order =TCG_MO_ALL , .initialize = m68k_tcg_init, .translate_code = m68k_translate_code,
target/microblaze/cpu.c +2 -1
@@ -427,7 +427,8 @@ static const struct SysemuCPUOps mb_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps mb_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* MicroBlaze is always in-order. */ + .guest_default_memory_order =TCG_MO_ALL , .initialize = mb_tcg_init, .translate_code = mb_translate_code,
target/mips/cpu.c +1 -1
@@ -550,7 +550,7 @@ static const Property mips_cpu_properties[] = {#ifdef CONFIG_TCG #include "accel/tcg/cpu-ops.h" static const TCGCPUOps mips_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .guest_default_memory_order =0 , .initialize = mips_tcg_init, .translate_code = mips_translate_code,
target/openrisc/cpu.c +1 -1
@@ -243,7 +243,7 @@ static const struct SysemuCPUOps openrisc_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps openrisc_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .guest_default_memory_order =0 , .initialize = openrisc_translate_init, .translate_code = openrisc_translate_code,
target/ppc/cpu_init.c +1 -1
@@ -7478,7 +7478,7 @@ static const struct SysemuCPUOps ppc_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps ppc_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .guest_default_memory_order =0 , .initialize = ppc_translate_init, .translate_code = ppc_translate_code, .restore_state_to_opc = ppc_restore_state_to_opc,
target/riscv/tcg/tcg-cpu.c +1 -1
@@ -140,7 +140,7 @@ static void riscv_restore_state_to_opc(CPUState *cs, }static const TCGCPUOps riscv_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , + .guest_default_memory_order =0 , .initialize = riscv_translate_init, .translate_code = riscv_translate_code,
target/rx/cpu.c +2 -1
@@ -204,7 +204,8 @@ static const struct SysemuCPUOps rx_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps rx_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* MTTCG not yet supported: require strict ordering */ + .guest_default_memory_order =TCG_MO_ALL , .initialize = rx_translate_init, .translate_code = rx_translate_code,
target/s390x/cpu.c +5 -1
@@ -345,7 +345,11 @@ void cpu_get_tb_cpu_state(CPUS390XState *env, vaddr *pc, }static const TCGCPUOps s390_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* +* The z/Architecture has a strong memory model with some +* store-after-load re-ordering. +*/ + .guest_default_memory_order =TCG_MO_ALL & ~TCG_MO_ST_LD , .initialize = s390x_translate_init, .translate_code = s390x_translate_code,
target/sh4/cpu.c +2 -1
@@ -262,7 +262,8 @@ static const struct SysemuCPUOps sh4_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps superh_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* MTTCG not yet supported: require strict ordering */ + .guest_default_memory_order =TCG_MO_ALL , .initialize = sh4_translate_init, .translate_code = sh4_translate_code,
target/sparc/cpu.c +22 -1
@@ -1001,7 +1001,28 @@ static const struct SysemuCPUOps sparc_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps sparc_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* +* From Oracle SPARC Architecture 2015: +* +* Compatibility notes: The PSO memory model described in SPARC V8 and +* SPARC V9 compatibility architecture specifications was never +* implemented in a SPARC V9 implementation and is not included in the +* Oracle SPARC Architecture specification. +* +* The RMO memory model described in the SPARC V9 specification was +* implemented in some non-Sun SPARC V9 implementations, but is not +* directly supported in Oracle SPARC Architecture 2015 implementations. +* +* Therefore always use TSO in QEMU. +* +* D.5 Specification of Partial Store Order (PSO) +* ... [loads] are followed by an implied MEMBAR #LoadLoad | #LoadStore. +* +* D.6 Specification of Total Store Order (TSO) +* ... PSO with the additional requirement that all [stores] are followed +* by an implied MEMBAR #StoreStore. +*/ + .guest_default_memory_order =TCG_MO_LD_LD |TCG_MO_LD_ST |TCG_MO_ST_ST , .initialize = sparc_tcg_init, .translate_code = sparc_translate_code,
target/tricore/cpu.c +2 -1
@@ -172,7 +172,8 @@ static const struct SysemuCPUOps tricore_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps tricore_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* MTTCG not yet supported: require strict ordering */ + .guest_default_memory_order =TCG_MO_ALL , .initialize = tricore_tcg_init, .translate_code = tricore_translate_code, .synchronize_from_tb = tricore_cpu_synchronize_from_tb,
target/xtensa/cpu.c +2 -1
@@ -232,7 +232,8 @@ static const struct SysemuCPUOps xtensa_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps xtensa_tcg_ops = { - .guest_default_memory_order =TCG_GUEST_DEFAULT_MO , +/* Xtensa processors have a weak memory model */ + .guest_default_memory_order =0 , .initialize = xtensa_translate_init, .translate_code = xtensa_translate_code,
Signature · 1 line
2.47.1
Re: [PATCH-for-10.1 v3 14/19] tcg: Remove the TCG_GUEST_DEFAULT_MO definition globally
Hi Richard,
Quoted 41 lines · Philippe Mathieu-Daudé
By directly using
TCGCPUOps::guest_default_memory_order, we don't need theTCG_GUEST_DEFAULT_MOdefinition anymore.Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Anton Johansson <[email protected]>Reviewed-by Richard Henderson <[email protected]>Reviewed-by Pierrick Bouvier <[email protected]>--- docs/devel/multi-thread-tcg.rst | 4 ++-- target/alpha/cpu-param.h | 3 --- target/arm/cpu-param.h | 3 --- target/avr/cpu-param.h | 2 -- target/hexagon/cpu-param.h | 3 --- target/hppa/cpu-param.h | 8 -------- target/i386/cpu-param.h | 3 --- target/loongarch/cpu-param.h | 2 -- target/m68k/cpu-param.h | 3 --- target/microblaze/cpu-param.h | 3 --- target/mips/cpu-param.h | 2 -- target/openrisc/cpu-param.h | 2 -- target/ppc/cpu-param.h | 2 -- target/riscv/cpu-param.h | 2 -- target/rx/cpu-param.h | 3 --- target/s390x/cpu-param.h | 6 ------ target/sh4/cpu-param.h | 3 --- target/sparc/cpu-param.h | 23 ----------------------- target/tricore/cpu-param.h | 3 --- target/xtensa/cpu-param.h | 3 --- target/alpha/cpu.c | 3 ++- target/arm/cpu.c | 3 ++- target/arm/tcg/cpu-v7m.c | 3 ++- target/avr/cpu.c | 2 +- target/hexagon/cpu.c | 3 ++- target/hppa/cpu.c | 8 +++++++- target/i386/tcg/tcg-cpu.c | 5 ++++- target/loongarch/cpu.c | 2 +- target/m68k/cpu.c | 3 ++- target/microblaze/cpu.c | 3 ++- target/mips/cpu.c | 2 +- target/openrisc/cpu.c | 2 +- target/ppc/cpu_init.c | 2 +-
Quoted 8 lines
target/riscv/tcg/tcg-cpu.c | 2 +- target/rx/cpu.c | 3 ++- target/s390x/cpu.c | 6 +++++- target/sh4/cpu.c | 3 ++- target/sparc/cpu.c | 23 ++++++++++++++++++++++- target/tricore/cpu.c | 3 ++- target/xtensa/cpu.c | 3 ++- 40 files changed, 66 insertions(+), 101 deletions(-)
I forgot this:
-- >8 --
include/exec/poison.h +0 -1
@@ -38,3 +38,2 @@#pragma GCC poison TARGET_BIG_ENDIAN -#pragma GCC poison TCG_GUEST_DEFAULT_MO#pragma GCC poison TARGET_HAS_PRECISE_SMC
---
Could you squash it in your tcg-next tree?
Thanks,
Phil.
PATCH v3 15/19 tcg: Move cpu_req_mo() macro to target-agnostic 'backend-ldst.h'
In reply to Philippe Mathieu-Daudé--- accel/tcg/backend-ldst.h | 41 +++++++++++++++++++++++++++++++++++++ accel/tcg/internal-target.h | 28 ------------------------- accel/tcg/cputlb.c | 1 + accel/tcg/user-exec.c | 1 + 4 files changed, 43 insertions(+), 28 deletions(-) create mode 100644 accel/tcg/backend-ldst.h
accel/tcg/backend-ldst.h new file +41 -0
@@ -0,0 +1,41 @@ +/* +* Internal memory barrier helpers for QEMU (target agnostic) +* +* Copyright (c) 2003 Fabrice Bellard +* +* SPDX-License-Identifier: LGPL-2.1-or-later +*/ + +#ifndef ACCEL_TCG_BACKEND_LDST_H +#define ACCEL_TCG_BACKEND_LDST_H + +#include "tcg-target-mo.h" + +/** +* tcg_req_mo: +* @guest_mo: Guest default memory order +* @type: TCGBar +* +* Filter @type to the barrier that is required for the guest +* memory ordering vs the host memory ordering. A non-zero +* result indicates that some barrier is required. +*/ +#define tcg_req_mo (guest_mo, type) \ + ((type) & guest_mo & ~TCG_TARGET_DEFAULT_MO) + +/** +* cpu_req_mo: +* @cpu: CPUState +* @type: TCGBar +* +* If tcg_req_mo indicates a barrier for @type is required +* for the guest memory model, issue a host memory barrier. +*/ +#define cpu_req_mo (cpu, type) \ + do { \ + if (tcg_req_mo(cpu->cc->tcg_ops->guest_default_memory_order, type)) { \ + smp_mb(); \ + } \ + } while (0) + +#endif
accel/tcg/internal-target.h +0 -28
@@ -13,7 +13,6 @@#include "exec/exec-all.h" #include "exec/translation-block.h" #include "tb-internal.h" -#include "tcg-target-mo.h" #include "exec/mmap-lock.h" /*
@@ -44,31 +43,4 @@ void page_table_config_init(void); G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);#endif /* CONFIG_USER_ONLY */ -/** -* tcg_req_mo: -* @guest_mo: Guest default memory order -* @type: TCGBar -* -* Filter @type to the barrier that is required for the guest -* memory ordering vs the host memory ordering. A non-zero -* result indicates that some barrier is required. -*/ -#define tcg_req_mo (guest_mo, type) \ - ((type) & guest_mo & ~TCG_TARGET_DEFAULT_MO) - -/** -* cpu_req_mo: -* @cpu: CPUState -* @type: TCGBar -* -* If tcg_req_mo indicates a barrier for @type is required -* for the guest memory model, issue a host memory barrier. -*/ -#define cpu_req_mo (cpu, type) \ - do { \ - if (tcg_req_mo(cpu->cc->tcg_ops->guest_default_memory_order, type)) { \ - smp_mb(); \ - } \ - } while (0) -#endif /* ACCEL_TCG_INTERNAL_H */
accel/tcg/cputlb.c +1 -0
@@ -48,6 +48,7 @@#include "qemu/plugin-memory.h" #endif #include "tcg/tcg-ldst.h" +#include "backend-ldst.h" /* DEBUG defines, enable DEBUG_TLB_LOG to log to the CPU_LOG_MMU target */
accel/tcg/user-exec.c +1 -0
@@ -37,6 +37,7 @@#include "qemu/int128.h" #include "trace.h" #include "tcg/tcg-ldst.h" +#include "backend-ldst.h" #include "internal-common.h" #include "internal-target.h" #include "tb-internal.h"
Signature · 1 line
2.47.1
PATCH v3 16/19 tcg: Move qemu_tcg_mttcg_enabled() to 'system/tcg.h'
In reply to Philippe Mathieu-Daudéqemu_tcg_mttcg_enabled() is specific to 1/ TCG and 2/ system emulation. Move the prototype declaration to "system/tcg.h", reducing 'mttcg_enabled' variable scope.
--- include/hw/core/cpu.h | 9 --------- include/system/tcg.h | 8 ++++++++ accel/tcg/tcg-all.c | 16 ++++++++++++++-- target/riscv/tcg/tcg-cpu.c | 1 + tcg/region.c | 4 +++- 5 files changed, 26 insertions(+), 12 deletions(-)
include/hw/core/cpu.h +0 -9
@@ -594,15 +594,6 @@ extern CPUTailQ cpus_queue;extern __threadCPUState *current_cpu; -/** -* qemu_tcg_mttcg_enabled: -* Check whether we are running MultiThread TCG or not. -* -* Returns: %true if we are in MTTCG mode %false otherwise. -*/ -extern bool mttcg_enabled; -#define qemu_tcg_mttcg_enabled () (mttcg_enabled) -/** * cpu_paging_enabled: * @cpu: The CPU whose state is to be inspected.
include/system/tcg.h +8 -0
@@ -17,4 +17,12 @@ extern bool tcg_allowed;#define tcg_enabled () 0#endif +/** +* qemu_tcg_mttcg_enabled: +* Check whether we are running MultiThread TCG or not. +* +* Returns: %true if we are in MTTCG mode %false otherwise. +*/ +bool qemu_tcg_mttcg_enabled (void ); +#endif
accel/tcg/tcg-all.c +14 -2
@@ -38,6 +38,7 @@#include "hw/qdev-core.h" #else #include "hw/boards.h" +#include "system/tcg.h" #endif #include "internal-common.h" #include "cpu-param.h"
@@ -58,6 +59,17 @@ typedef struct TCGState TCGState;DECLARE_INSTANCE_CHECKER (TCGState,TCG_STATE , TYPE_TCG_ACCEL) +#ifndef CONFIG_USER_ONLY + +static bool mttcg_enabled; + +bool qemu_tcg_mttcg_enabled (void ) +{ +return mttcg_enabled; +} + +#endif /* !CONFIG_USER_ONLY */ +/* * We default to false if we know other options have been enabled * which are currently incompatible with MTTCG. Otherwise when each
@@ -97,7 +109,6 @@ static void tcg_accel_instance_init(Object *obj)#endif } -bool mttcg_enabled;bool one_insn_per_tb;static int tcg_init_machine (MachineState *ms)
@@ -107,10 +118,11 @@ static int tcg_init_machine(MachineState *ms)unsigned max_cpus =1 ;#else unsigned max_cpus = ms->smp.max_cpus; + + mttcg_enabled = s->mttcg_enabled;#endif tcg_allowed = true; - mttcg_enabled = s->mttcg_enabled;page_init ();tb_htable_init ();
target/riscv/tcg/tcg-cpu.c +1 -0
@@ -36,6 +36,7 @@#include "tcg/tcg.h" #ifndef CONFIG_USER_ONLY #include "hw/boards.h" +#include "system/tcg.h" #endif /* Hash that stores user set extensions */
tcg/region.c +3 -1
@@ -34,7 +34,9 @@#include "exec/translation-block.h" #include "tcg-internal.h" #include "host/cpuinfo.h" - +#ifndef CONFIG_USER_ONLY +#include "system/tcg.h" +#endif /* * Local source-level compatibility with Unix.
Signature · 1 line
2.47.1
PATCH v3 17/19 tcg: Convert TCGState::mttcg_enabled to TriState
In reply to Philippe Mathieu-DaudéUse the OnOffAuto type as 3-state.
Since the TCGState instance is zero-initialized, the mttcg_enabled is initialzed as AUTO (ON_OFF_AUTO_AUTO).
In tcg_init_machine(), if mttcg_enabled is still AUTO, set a default value (effectively inlining the default_mttcg_enabled() method content).
In the tcg_get_thread() getter, consider AUTO / OFF states as "single", otherwise ON is "multi".
--- accel/tcg/tcg-all.c | 60 ++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 31 deletions(-)
accel/tcg/tcg-all.c +29 -31
@@ -32,6 +32,7 @@#include "qemu/error-report.h" #include "qemu/accel.h" #include "qemu/atomic.h" +#include "qapi/qapi-types-common.h" #include "qapi/qapi-builtin-visit.h" #include "qemu/units.h" #if defined(CONFIG_USER_ONLY )
@@ -47,7 +48,7 @@struct TCGState {AccelState parent_obj; -bool mttcg_enabled; +OnOffAuto mttcg_enabled;bool one_insn_per_tb;int splitwx_enabled;unsigned long tb_size;
@@ -70,37 +71,10 @@ bool qemu_tcg_mttcg_enabled(void)#endif /* !CONFIG_USER_ONLY */ -/* -* We default to false if we know other options have been enabled -* which are currently incompatible with MTTCG. Otherwise when each -* guest (target) has been updated to support: -* - atomic instructions -* - memory ordering primitives (barriers) -* they can set the appropriate CONFIG flags in ${target}-softmmu.mak -* -* Once a guest architecture has been converted to the new primitives -* there is one remaining limitation to check: -* - The guest can't be oversized (e.g. 64 bit guest on 32 bit host) -*/ - -static bool default_mttcg_enabled (void ) -{ -if (icount_enabled ()) { -return false; - } -#ifdef TARGET_SUPPORTS_MTTCG -return true; -#else -return false; -#endif -} -static void tcg_accel_instance_init (Object *obj) {TCGState *s =TCG_STATE (obj); - s->mttcg_enabled =default_mttcg_enabled (); -/* If debugging enabled, default "auto on", otherwise off. */ #if defined(CONFIG_DEBUG_TCG ) && !defined(CONFIG_USER_ONLY ) s->splitwx_enabled =-1 ;
@@ -118,7 +92,31 @@ static int tcg_init_machine(MachineState *ms)unsigned max_cpus =1 ;#else unsigned max_cpus = ms->smp.max_cpus; +#ifdef TARGET_SUPPORTS_MTTCG +bool mttcg_supported = true; +#else +bool mttcg_supported = false; +#endif +if (s->mttcg_enabled ==ON_OFF_AUTO_AUTO ) { +/* +* We default to false if we know other options have been enabled +* which are currently incompatible with MTTCG. Otherwise when each +* guest (target) has been updated to support: +* - atomic instructions +* - memory ordering primitives (barriers) +* they can set the appropriate CONFIG flags in ${target}-softmmu.mak +* +* Once a guest architecture has been converted to the new primitives +* there is one remaining limitation to check: +* - The guest can't be oversized (e.g. 64 bit guest on 32 bit host) +*/ +if (icount_enabled ()) { + s->mttcg_enabled =ON_OFF_AUTO_OFF ; + }else { + s->mttcg_enabled = mttcg_supported; + } + } mttcg_enabled = s->mttcg_enabled;#endif
@@ -147,7 +145,7 @@ static char *tcg_get_thread(Object *obj, Error **errp) {TCGState *s =TCG_STATE (obj); -return g_strdup (s->mttcg_enabled ?"multi" :"single" ); +return g_strdup (s->mttcg_enabled ==ON_OFF_AUTO_ON ?"multi" :"single" ); }static void tcg_set_thread (Object *obj,const char *value,Error **errp)
@@ -162,10 +160,10 @@ static void tcg_set_thread(Object *obj, const char *value, Error **errp)warn_report ("Guest not yet converted to MTTCG - " "you may get unexpected results" );#endif - s->mttcg_enabled = true; + s->mttcg_enabled =ON_OFF_AUTO_ON ; } }else if (strcmp (value,"single" ) ==0 ) { - s->mttcg_enabled = false; + s->mttcg_enabled =ON_OFF_AUTO_OFF ; }else {error_setg (errp,"Invalid 'thread' setting %s" , value); }
Signature · 1 line
2.47.1
PATCH v3 18/19 tcg: Factor mttcg_init() out
In reply to Philippe Mathieu-DaudéKeep MTTCG initialization code out of tcg_init_machine().
--- accel/tcg/tcg-all.c | 50 +++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 22 deletions(-)
accel/tcg/tcg-all.c +28 -22
@@ -69,29 +69,8 @@ bool qemu_tcg_mttcg_enabled(void)return mttcg_enabled; } -#endif /* !CONFIG_USER_ONLY */ - -static void tcg_accel_instance_init (Object *obj) +static void mttcg_init (TCGState *s) { -TCGState *s =TCG_STATE (obj); - -/* If debugging enabled, default "auto on", otherwise off. */ -#if defined(CONFIG_DEBUG_TCG ) && !defined(CONFIG_USER_ONLY ) - s->splitwx_enabled =-1 ; -#else - s->splitwx_enabled =0 ; -#endif -} - -bool one_insn_per_tb; - -static int tcg_init_machine (MachineState *ms) -{ -TCGState *s =TCG_STATE (current_accel ()); -#ifdef CONFIG_USER_ONLY -unsigned max_cpus =1 ; -#else -unsigned max_cpus = ms->smp.max_cpus;#ifdef TARGET_SUPPORTS_MTTCG bool mttcg_supported = true;#else
@@ -118,6 +97,33 @@ static int tcg_init_machine(MachineState *ms) } } mttcg_enabled = s->mttcg_enabled; +} + +#endif /* !CONFIG_USER_ONLY */ + +static void tcg_accel_instance_init (Object *obj) +{ +TCGState *s =TCG_STATE (obj); + +/* If debugging enabled, default "auto on", otherwise off. */ +#if defined(CONFIG_DEBUG_TCG ) && !defined(CONFIG_USER_ONLY ) + s->splitwx_enabled =-1 ; +#else + s->splitwx_enabled =0 ; +#endif +} + +bool one_insn_per_tb; + +static int tcg_init_machine (MachineState *ms) +{ +TCGState *s =TCG_STATE (current_accel ()); +#ifdef CONFIG_USER_ONLY +unsigned max_cpus =1 ; +#else +unsigned max_cpus = ms->smp.max_cpus; + +mttcg_init (s);#endif tcg_allowed = true;
Signature · 1 line
2.47.1
PATCH v3 19/19 tcg: Convert TARGET_SUPPORTS_MTTCG to TCGCPUOps::mttcg_supported field
In reply to Philippe Mathieu-DaudéInstead of having a compile-time TARGET_SUPPORTS_MTTCG definition, have each target set the 'mttcg_supported' field in the TCGCPUOps structure.
Since so far we only emulate one target architecture at a time, tcg_init_machine() gets whether MTTCG is supported via the current CPU class (CPU_RESOLVING_TYPE).
Since TARGET_SUPPORTS_MTTCG isn't available anymore, instead of emiting a warning when the 'thread' property is set in tcg_set_thread(), emit it in tcg_init_machine() where it is consumed.
--- docs/devel/multi-thread-tcg.rst | 2 +- configs/targets/aarch64-softmmu.mak | 1 - configs/targets/alpha-softmmu.mak | 1 - configs/targets/arm-softmmu.mak | 1 - configs/targets/hppa-softmmu.mak | 1 - configs/targets/i386-softmmu.mak | 1 - configs/targets/loongarch64-softmmu.mak | 1 - configs/targets/microblaze-softmmu.mak | 1 - configs/targets/microblazeel-softmmu.mak | 1 - configs/targets/mips-softmmu.mak | 1 - configs/targets/mipsel-softmmu.mak | 1 - configs/targets/or1k-softmmu.mak | 1 - configs/targets/ppc64-softmmu.mak | 1 - configs/targets/riscv32-softmmu.mak | 1 - configs/targets/riscv64-softmmu.mak | 1 - configs/targets/s390x-softmmu.mak | 1 - configs/targets/sparc-softmmu.mak | 1 - configs/targets/sparc64-softmmu.mak | 1 - configs/targets/x86_64-softmmu.mak | 1 - configs/targets/xtensa-softmmu.mak | 1 - configs/targets/xtensaeb-softmmu.mak | 1 - include/accel/tcg/cpu-ops.h | 8 ++++++++ include/exec/poison.h | 1 - accel/tcg/tcg-all.c | 17 ++++++++--------- target/alpha/cpu.c | 1 + target/arm/cpu.c | 1 + target/arm/tcg/cpu-v7m.c | 1 + target/avr/cpu.c | 1 + target/hexagon/cpu.c | 1 + target/hppa/cpu.c | 1 + target/i386/tcg/tcg-cpu.c | 1 + target/loongarch/cpu.c | 1 + target/m68k/cpu.c | 1 + target/microblaze/cpu.c | 1 + target/mips/cpu.c | 1 + target/openrisc/cpu.c | 1 + target/ppc/cpu_init.c | 1 + target/riscv/tcg/tcg-cpu.c | 1 + target/rx/cpu.c | 1 + target/s390x/cpu.c | 1 + target/sh4/cpu.c | 1 + target/sparc/cpu.c | 1 + target/tricore/cpu.c | 1 + target/xtensa/cpu.c | 1 + 44 files changed, 37 insertions(+), 31 deletions(-)
docs/devel/multi-thread-tcg.rst +1 -1
@@ -30,7 +30,7 @@ user-space thread. This is enabled by default for all FE/BE combinations where the host memory model is able to accommodate the guest (TCGCPUOps::guest_default_memory_order & ~TCG_TARGET_DEFAULT_MO is zero) and the guest has had the required work done to support this safely -(TARGET_SUPPORTS_MTTCG). +(TCGCPUOps::mttcg_supported). System emulation will fall back to the original round robin approach if:
configs/targets/aarch64-softmmu.mak +0 -1
@@ -1,6 +1,5 @@ TARGET_ARCH=aarch64 TARGET_BASE_ARCH=arm -TARGET_SUPPORTS_MTTCG=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml gdb-xml/aarch64-pauth.xml # needed by boot.c
configs/targets/alpha-softmmu.mak +0 -1
@@ -1,3 +1,2 @@ TARGET_ARCH=alpha -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=64
configs/targets/arm-softmmu.mak +0 -1
@@ -1,5 +1,4 @@ TARGET_ARCH=arm -TARGET_SUPPORTS_MTTCG=y TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml # needed by boot.c TARGET_NEED_FDT=y
configs/targets/hppa-softmmu.mak +0 -1
@@ -1,4 +1,3 @@ TARGET_ARCH=hppa TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=64
configs/targets/i386-softmmu.mak +0 -1
@@ -1,5 +1,4 @@ TARGET_ARCH=i386 -TARGET_SUPPORTS_MTTCG=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_KVM_HAVE_RESET_PARKED_VCPU=y TARGET_XML_FILES= gdb-xml/i386-32bit.xml
configs/targets/loongarch64-softmmu.mak +0 -1
@@ -1,7 +1,6 @@ TARGET_ARCH=loongarch64 TARGET_BASE_ARCH=loongarch TARGET_KVM_HAVE_GUEST_DEBUG=y -TARGET_SUPPORTS_MTTCG=y TARGET_XML_FILES= gdb-xml/loongarch-base32.xml gdb-xml/loongarch-base64.xml gdb-xml/loongarch-fpu.xml gdb-xml/loongarch-lsx.xml gdb-xml/loongarch-lasx.xml # all boards require libfdt TARGET_NEED_FDT=y
configs/targets/microblaze-softmmu.mak +0 -1
@@ -1,6 +1,5 @@ TARGET_ARCH=microblaze TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y # needed by boot.c TARGET_NEED_FDT=y TARGET_XML_FILES=gdb-xml/microblaze-core.xml gdb-xml/microblaze-stack-protect.xml
configs/targets/microblazeel-softmmu.mak +0 -1
@@ -1,5 +1,4 @@ TARGET_ARCH=microblaze -TARGET_SUPPORTS_MTTCG=y # needed by boot.c TARGET_NEED_FDT=y TARGET_XML_FILES=gdb-xml/microblaze-core.xml gdb-xml/microblaze-stack-protect.xml
configs/targets/mips-softmmu.mak +0 -1
@@ -1,4 +1,3 @@ TARGET_ARCH=mips TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=32
configs/targets/mipsel-softmmu.mak +0 -1
@@ -1,3 +1,2 @@ TARGET_ARCH=mips -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=32
configs/targets/or1k-softmmu.mak +0 -1
@@ -1,5 +1,4 @@ TARGET_ARCH=openrisc -TARGET_SUPPORTS_MTTCG=y TARGET_BIG_ENDIAN=y # needed by boot.c and all boards TARGET_NEED_FDT=y
configs/targets/ppc64-softmmu.mak +0 -1
@@ -1,7 +1,6 @@ TARGET_ARCH=ppc64 TARGET_BASE_ARCH=ppc TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_XML_FILES= gdb-xml/power64-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml gdb-xml/power-vsx.xml # all boards require libfdt
configs/targets/riscv32-softmmu.mak +0 -1
@@ -1,6 +1,5 @@ TARGET_ARCH=riscv32 TARGET_BASE_ARCH=riscv -TARGET_SUPPORTS_MTTCG=y TARGET_XML_FILES= gdb-xml/riscv-32bit-cpu.xml gdb-xml/riscv-32bit-fpu.xml gdb-xml/riscv-64bit-fpu.xml gdb-xml/riscv-32bit-virtual.xml # needed by boot.c TARGET_NEED_FDT=y
configs/targets/riscv64-softmmu.mak +0 -1
@@ -1,6 +1,5 @@ TARGET_ARCH=riscv64 TARGET_BASE_ARCH=riscv -TARGET_SUPPORTS_MTTCG=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_XML_FILES= gdb-xml/riscv-64bit-cpu.xml gdb-xml/riscv-32bit-fpu.xml gdb-xml/riscv-64bit-fpu.xml gdb-xml/riscv-64bit-virtual.xml gdb-xml/riscv-32bit-cpu.xml gdb-xml/riscv-32bit-virtual.xml # needed by boot.c
configs/targets/s390x-softmmu.mak +0 -1
@@ -1,6 +1,5 @@ TARGET_ARCH=s390x TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_XML_FILES= gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml gdb-xml/s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml gdb-xml/s390-virt.xml gdb-xml/s390-virt-kvm.xml gdb-xml/s390-gs.xml TARGET_LONG_BITS=64
configs/targets/sparc-softmmu.mak +0 -1
@@ -1,4 +1,3 @@ TARGET_ARCH=sparc TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=32
configs/targets/sparc64-softmmu.mak +0 -1
@@ -1,5 +1,4 @@ TARGET_ARCH=sparc64 TARGET_BASE_ARCH=sparc TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=64
configs/targets/x86_64-softmmu.mak +0 -1
@@ -1,6 +1,5 @@ TARGET_ARCH=x86_64 TARGET_BASE_ARCH=i386 -TARGET_SUPPORTS_MTTCG=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_KVM_HAVE_RESET_PARKED_VCPU=y TARGET_XML_FILES= gdb-xml/i386-64bit.xml
configs/targets/xtensa-softmmu.mak +0 -1
@@ -1,3 +1,2 @@ TARGET_ARCH=xtensa -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=32
configs/targets/xtensaeb-softmmu.mak +0 -1
@@ -1,4 +1,3 @@ TARGET_ARCH=xtensa TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=32
include/accel/tcg/cpu-ops.h +8 -0
@@ -19,6 +19,14 @@#include "tcg/tcg-mo.h" struct TCGCPUOps { +/** +* mttcg_supported: multi-threaded TCG is supported +* +* Target (TCG frontend) supports: +* - atomic instructions +* - memory ordering primitives (barriers) +*/ +bool mttcg_supported;/** * @guest_default_memory_order: default barrier that is required
include/exec/poison.h +0 -1
@@ -35,7 +35,6 @@#pragma GCC poison TARGET_HAS_BFLT#pragma GCC poison TARGET_NAME -#pragma GCC poison TARGET_SUPPORTS_MTTCG#pragma GCC poison TARGET_BIG_ENDIAN#pragma GCC poison TCG_GUEST_DEFAULT_MO#pragma GCC poison TARGET_HAS_PRECISE_SMC
accel/tcg/tcg-all.c +8 -9
@@ -41,8 +41,10 @@#include "hw/boards.h" #include "system/tcg.h" #endif +#include "accel/tcg/cpu-ops.h" #include "internal-common.h" #include "cpu-param.h" +#include "cpu.h" struct TCGState {
@@ -71,11 +73,8 @@ bool qemu_tcg_mttcg_enabled(void)static void mttcg_init (TCGState *s) { -#ifdef TARGET_SUPPORTS_MTTCG -bool mttcg_supported = true; -#else -bool mttcg_supported = false; -#endif +CPUClass *cc =CPU_CLASS (object_class_by_name (CPU_RESOLVING_TYPE )); +bool mttcg_supported = cc->tcg_ops->mttcg_supported;if (s->mttcg_enabled ==ON_OFF_AUTO_AUTO ) {/*
@@ -96,6 +95,10 @@ static void mttcg_init(TCGState *s) s->mttcg_enabled = mttcg_supported; } } +if (s->mttcg_enabled ==ON_OFF_AUTO_ON && !mttcg_supported) { +warn_report ("Guest not yet converted to MTTCG - " +"you may get unexpected results" ); + } mttcg_enabled = s->mttcg_enabled; }
@@ -162,10 +165,6 @@ static void tcg_set_thread(Object *obj, const char *value, Error **errp)if (icount_enabled ()) {error_setg (errp,"No MTTCG when icount is enabled" ); }else { -#ifndef TARGET_SUPPORTS_MTTCG -warn_report ("Guest not yet converted to MTTCG - " -"you may get unexpected results" ); -#endif s->mttcg_enabled =ON_OFF_AUTO_ON ; } }else if (strcmp (value,"single" ) ==0 ) {
target/alpha/cpu.c +1 -0
@@ -235,6 +235,7 @@ static const struct SysemuCPUOps alpha_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps alpha_tcg_ops = { + .mttcg_supported = true,/* Alpha processors have a weak memory model */ .guest_default_memory_order =0 ,
target/arm/cpu.c +1 -0
@@ -2671,6 +2671,7 @@ static const struct SysemuCPUOps arm_sysemu_ops = {#ifdef CONFIG_TCG static const TCGCPUOps arm_tcg_ops = { + .mttcg_supported = true,/* ARM processors have a weak memory model */ .guest_default_memory_order = 0,
target/arm/tcg/cpu-v7m.c +1 -0
@@ -232,6 +232,7 @@ static void cortex_m55_initfn(Object *obj) }static const TCGCPUOps arm_v7m_tcg_ops = { + .mttcg_supported = true,/* ARM processors have a weak memory model */ .guest_default_memory_order =0 ,
target/avr/cpu.c +1 -0
@@ -224,6 +224,7 @@ static const struct SysemuCPUOps avr_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps avr_tcg_ops = { + .mttcg_supported = false, .guest_default_memory_order =0 , .initialize = avr_cpu_tcg_init, .translate_code = avr_cpu_translate_code,
target/hexagon/cpu.c +1 -0
@@ -325,6 +325,7 @@ static void hexagon_cpu_init(Object *obj)#include "accel/tcg/cpu-ops.h" static const TCGCPUOps hexagon_tcg_ops = { + .mttcg_supported = false,/* MTTCG not yet supported: require strict ordering */ .guest_default_memory_order =TCG_MO_ALL , .initialize = hexagon_translate_init,
target/hppa/cpu.c +1 -0
@@ -253,6 +253,7 @@ static const struct SysemuCPUOps hppa_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps hppa_tcg_ops = { + .mttcg_supported = true,/* PA-RISC 1.x processors have a strong memory model. */ /* * ??? While we do not yet implement PA-RISC 2.0, those processors have
target/i386/tcg/tcg-cpu.c +1 -0
@@ -125,6 +125,7 @@ static bool x86_debug_check_breakpoint(CPUState *cs)#include "accel/tcg/cpu-ops.h" static const TCGCPUOps x86_tcg_ops = { + .mttcg_supported = true,/* * The x86 has a strong memory model with some store-after-load re-ordering */
target/loongarch/cpu.c +1 -0
@@ -864,6 +864,7 @@ static void loongarch_cpu_dump_state(CPUState *cs, FILE *f, int flags)#include "accel/tcg/cpu-ops.h" static const TCGCPUOps loongarch_tcg_ops = { + .mttcg_supported = true, .guest_default_memory_order =0 , .initialize = loongarch_translate_init,
target/m68k/cpu.c +1 -0
@@ -589,6 +589,7 @@ static const struct SysemuCPUOps m68k_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps m68k_tcg_ops = { + .mttcg_supported = false,/* MTTCG not yet supported: require strict ordering */ .guest_default_memory_order =TCG_MO_ALL ,
target/microblaze/cpu.c +1 -0
@@ -427,6 +427,7 @@ static const struct SysemuCPUOps mb_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps mb_tcg_ops = { + .mttcg_supported = true,/* MicroBlaze is always in-order. */ .guest_default_memory_order =TCG_MO_ALL ,
target/mips/cpu.c +1 -0
@@ -550,6 +550,7 @@ static const Property mips_cpu_properties[] = {#ifdef CONFIG_TCG #include "accel/tcg/cpu-ops.h" static const TCGCPUOps mips_tcg_ops = { + .mttcg_supported =TARGET_LONG_BITS ==32 , .guest_default_memory_order =0 , .initialize = mips_tcg_init,
target/openrisc/cpu.c +1 -0
@@ -243,6 +243,7 @@ static const struct SysemuCPUOps openrisc_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps openrisc_tcg_ops = { + .mttcg_supported = true, .guest_default_memory_order =0 , .initialize = openrisc_translate_init,
target/ppc/cpu_init.c +1 -0
@@ -7478,6 +7478,7 @@ static const struct SysemuCPUOps ppc_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps ppc_tcg_ops = { + .mttcg_supported =TARGET_LONG_BITS ==64 , .guest_default_memory_order =0 , .initialize = ppc_translate_init, .translate_code = ppc_translate_code,
target/riscv/tcg/tcg-cpu.c +1 -0
@@ -141,6 +141,7 @@ static void riscv_restore_state_to_opc(CPUState *cs, }static const TCGCPUOps riscv_tcg_ops = { + .mttcg_supported = true, .guest_default_memory_order =0 , .initialize = riscv_translate_init,
target/rx/cpu.c +1 -0
@@ -204,6 +204,7 @@ static const struct SysemuCPUOps rx_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps rx_tcg_ops = { + .mttcg_supported = false,/* MTTCG not yet supported: require strict ordering */ .guest_default_memory_order =TCG_MO_ALL ,
target/s390x/cpu.c +1 -0
@@ -345,6 +345,7 @@ void cpu_get_tb_cpu_state(CPUS390XState *env, vaddr *pc, }static const TCGCPUOps s390_tcg_ops = { + .mttcg_supported = true,/* * The z/Architecture has a strong memory model with some * store-after-load re-ordering.
target/sh4/cpu.c +1 -0
@@ -262,6 +262,7 @@ static const struct SysemuCPUOps sh4_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps superh_tcg_ops = { + .mttcg_supported = false,/* MTTCG not yet supported: require strict ordering */ .guest_default_memory_order =TCG_MO_ALL ,
target/sparc/cpu.c +1 -0
@@ -1001,6 +1001,7 @@ static const struct SysemuCPUOps sparc_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps sparc_tcg_ops = { + .mttcg_supported = true,/* * From Oracle SPARC Architecture 2015: *
target/tricore/cpu.c +1 -0
@@ -172,6 +172,7 @@ static const struct SysemuCPUOps tricore_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps tricore_tcg_ops = { + .mttcg_supported = false,/* MTTCG not yet supported: require strict ordering */ .guest_default_memory_order =TCG_MO_ALL , .initialize = tricore_tcg_init,
target/xtensa/cpu.c +1 -0
@@ -232,6 +232,7 @@ static const struct SysemuCPUOps xtensa_sysemu_ops = {#include "accel/tcg/cpu-ops.h" static const TCGCPUOps xtensa_tcg_ops = { + .mttcg_supported = true,/* Xtensa processors have a weak memory model */ .guest_default_memory_order =0 ,
Signature · 1 line
2.47.1
Re: [PATCH-for-10.1 v3 19/19] tcg: Convert TARGET_SUPPORTS_MTTCG to TCGCPUOps::mttcg_supported field
Quoted 13 lines · Philippe Mathieu-Daudé
Instead of having a compile-time
TARGET_SUPPORTS_MTTCGdefinition, have each target set the 'mttcg_supported' field in the TCGCPUOps structure.Since so far we only emulate one target architecture at a time,
tcg_init_machine()gets whether MTTCG is supported via the current CPU class (CPU_RESOLVING_TYPE).Since
TARGET_SUPPORTS_MTTCGisn't available anymore, instead of emiting a warning when the 'thread' property is set intcg_set_thread(), emit it intcg_init_machine()where it is consumed.
Quoted 4 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Anton Johansson <[email protected]>Reviewed-by Pierrick Bouvier <[email protected]>Reviewed-by Richard Henderson <[email protected]>
This doesn't work for i386 and riscv, which have both been "updated" to initialize cc->tcg_ops via ${arch}_tcg_cpu_accel_type_info ...
accel/tcg/tcg-all.c bool qemu_tcg_mttcg_enabled(void) · line 77
Quoted 9 lines
static void mttcg_init(TCGState *s) {accel/tcg/tcg-all.c +2
-5-#ifdef TARGET_SUPPORTS_MTTCG -bool mttcg_supported = true; -#else -bool mttcg_supported = false; -#endif +CPUClass *cc =CPU_CLASS (object_class_by_name (CPU_RESOLVING_TYPE )); +bool mttcg_supported = cc->tcg_ops->mttcg_supported;
... which has not yet been called, so NULL pointer dereference.
I'm not sure why the init of tcg_ops was moved from ${arch}_cpu_class_init. Probably it looked nice to remove the #ifdef CONFIG_TCG.
There's a definite ordering problem here, and I'm not sure how to fix it.
r~
Re: [PATCH-for-10.1 v3 19/19] tcg: Convert TARGET_SUPPORTS_MTTCG to TCGCPUOps::mttcg_supported field
Quoted 33 lines · Richard Henderson
Quoted 13 lines · Philippe Mathieu-Daudé
Instead of having a compile-time
TARGET_SUPPORTS_MTTCGdefinition, have each target set the 'mttcg_supported' field in the TCGCPUOps structure.Since so far we only emulate one target architecture at a time,
tcg_init_machine()gets whether MTTCG is supported via the current CPU class (CPU_RESOLVING_TYPE).Since
TARGET_SUPPORTS_MTTCGisn't available anymore, instead of emiting a warning when the 'thread' property is set intcg_set_thread(), emit it intcg_init_machine()where it is consumed.Quoted 4 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Anton Johansson <[email protected]>Reviewed-by Pierrick Bouvier <[email protected]>Reviewed-by Richard Henderson <[email protected]>This doesn't work for i386 and riscv, which have both been "updated" to initialize
cc->tcg_opsvia ${arch}_tcg_cpu_accel_type_info ...accel/tcg/tcg-all.c bool qemu_tcg_mttcg_enabled(void) · line 77
Quoted 9 lines
static void
mttcg_init(TCGState *s)
{accel/tcg/tcg-all.c +2
-5-#ifdef TARGET_SUPPORTS_MTTCG - bool mttcg_supported = true; -#else - bool mttcg_supported = false; -#endif + CPUClass *cc = CPU_CLASS(object_class_by_name(CPU_RESOLVING_TYPE)); + bool mttcg_supported = cc->tcg_ops->mttcg_supported;... which has not yet been called, so NULL pointer dereference.
Quoted 4 lines
I'm not sure why the init of
tcg_opswas moved from ${arch}_cpu_class_init. Probably it looked nice to remove the #ifdefCONFIG_TCG.There's a definite ordering problem here, and I'm not sure how to fix it.
Can you just drop this single patch? I'll see what needs to be done.
Thanks,
Phil.