1 | Pretty small still, but there are two patches that ought | 1 | For v2, drop the PAGE_EXEC patch that appeared to cause |
---|---|---|---|
2 | to get backported to stable, so no point in delaying. | 2 | problems during Peter's testing. |
3 | |||
3 | 4 | ||
4 | r~ | 5 | r~ |
5 | 6 | ||
6 | The following changes since commit a5ba0a7e4e150d1350a041f0d0ef9ca6c8d7c307: | ||
7 | 7 | ||
8 | Merge tag 'pull-aspeed-20241211' of https://github.com/legoater/qemu into staging (2024-12-11 15:16:47 +0000) | 8 | The following changes since commit f34edbc760b0f689deddd175fc08732ecb46665f: |
9 | |||
10 | Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2019-07-08-1' into staging (2019-07-08 17:40:05 +0100) | ||
9 | 11 | ||
10 | are available in the Git repository at: | 12 | are available in the Git repository at: |
11 | 13 | ||
12 | https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20241212 | 14 | https://github.com/rth7680/qemu.git tags/pull-tcg-20190709 |
13 | 15 | ||
14 | for you to fetch changes up to 7ac87b14a92234b6a89b701b4043ad6cf8bdcccf: | 16 | for you to fetch changes up to 11978f6f58f1d3d66429f7ff897524f693d823ce: |
15 | 17 | ||
16 | target/sparc: Use memcpy() and remove memcpy32() (2024-12-12 14:28:38 -0600) | 18 | tcg: Fix expansion of INDEX_op_not_vec (2019-07-09 08:26:11 +0200) |
17 | 19 | ||
18 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
19 | tcg: Reset free_temps before tcg_optimize | 21 | Minor gvec fix for as-yet uncommitted altivec host. |
20 | tcg/riscv: Fix StoreStore barrier generation | 22 | Build fix for riscv host. |
21 | include/exec: Introduce fpst alias in helper-head.h.inc | ||
22 | target/sparc: Use memcpy() and remove memcpy32() | ||
23 | 23 | ||
24 | ---------------------------------------------------------------- | 24 | ---------------------------------------------------------------- |
25 | Philippe Mathieu-Daudé (1): | 25 | Alistair Francis (1): |
26 | target/sparc: Use memcpy() and remove memcpy32() | 26 | tcg/riscv: Fix RISC-VH host build failure |
27 | 27 | ||
28 | Richard Henderson (2): | 28 | Richard Henderson (1): |
29 | tcg: Reset free_temps before tcg_optimize | 29 | tcg: Fix expansion of INDEX_op_not_vec |
30 | include/exec: Introduce fpst alias in helper-head.h.inc | ||
31 | 30 | ||
32 | Roman Artemev (1): | 31 | tcg/riscv/tcg-target.inc.c | 4 ++-- |
33 | tcg/riscv: Fix StoreStore barrier generation | 32 | tcg/tcg-op-vec.c | 6 ++++++ |
33 | 2 files changed, 8 insertions(+), 2 deletions(-) | ||
34 | 34 | ||
35 | include/tcg/tcg-temp-internal.h | 6 ++++++ | ||
36 | accel/tcg/plugin-gen.c | 2 +- | ||
37 | target/sparc/win_helper.c | 26 ++++++++------------------ | ||
38 | tcg/tcg.c | 5 ++++- | ||
39 | include/exec/helper-head.h.inc | 3 +++ | ||
40 | tcg/riscv/tcg-target.c.inc | 2 +- | ||
41 | 6 files changed, 23 insertions(+), 21 deletions(-) | ||
42 | diff view generated by jsdifflib |
1 | When allocating new temps during tcg_optmize, do not re-use | 1 | Check page flags before letting an invalid pc cause a SIGSEGV. |
---|---|---|---|
2 | any EBB temps that were used within the TB. We do not have | ||
3 | any idea what span of the TB in which the temp was live. | ||
4 | 2 | ||
5 | Introduce tcg_temp_ebb_reset_freed and use before tcg_optimize, | 3 | Prepare for eventially validating PROT_EXEC. The current wrinkle being |
6 | as well as replacing the equivalent in plugin_gen_inject and | 4 | that we have a problem with our implementation of signals. We should |
7 | tcg_func_start. | 5 | be using a vdso like the kernel, but we instead put the trampoline on |
6 | the stack. In the meantime, let PROT_READ match PROT_EXEC. | ||
8 | 7 | ||
9 | Cc: qemu-stable@nongnu.org | 8 | Fixes: https://bugs.launchpad.net/qemu/+bug/1832353 |
10 | Fixes: fb04ab7ddd8 ("tcg/optimize: Lower TCG_COND_TST{EQ,NE} if unsupported") | ||
11 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2711 | ||
12 | Reported-by: wannacu <wannacu2049@gmail.com> | ||
13 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
14 | Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> | ||
15 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
16 | --- | 10 | --- |
17 | include/tcg/tcg-temp-internal.h | 6 ++++++ | 11 | include/exec/cpu-all.h | 1 + |
18 | accel/tcg/plugin-gen.c | 2 +- | 12 | include/exec/cpu_ldst_useronly_template.h | 8 +++++-- |
19 | tcg/tcg.c | 5 ++++- | 13 | accel/tcg/translate-all.c | 29 +++++++++++++++++++++++ |
20 | 3 files changed, 11 insertions(+), 2 deletions(-) | 14 | 3 files changed, 36 insertions(+), 2 deletions(-) |
21 | 15 | ||
22 | diff --git a/include/tcg/tcg-temp-internal.h b/include/tcg/tcg-temp-internal.h | 16 | diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h |
23 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/include/tcg/tcg-temp-internal.h | 18 | --- a/include/exec/cpu-all.h |
25 | +++ b/include/tcg/tcg-temp-internal.h | 19 | +++ b/include/exec/cpu-all.h |
26 | @@ -XXX,XX +XXX,XX @@ TCGv_i64 tcg_temp_ebb_new_i64(void); | 20 | @@ -XXX,XX +XXX,XX @@ int walk_memory_regions(void *, walk_memory_regions_fn); |
27 | TCGv_ptr tcg_temp_ebb_new_ptr(void); | 21 | int page_get_flags(target_ulong address); |
28 | TCGv_i128 tcg_temp_ebb_new_i128(void); | 22 | void page_set_flags(target_ulong start, target_ulong end, int flags); |
29 | 23 | int page_check_range(target_ulong start, target_ulong len, int flags); | |
30 | +/* Forget all freed EBB temps, so that new allocations produce new temps. */ | 24 | +void validate_exec_access(CPUArchState *env, target_ulong s, target_ulong l); |
31 | +static inline void tcg_temp_ebb_reset_freed(TCGContext *s) | 25 | #endif |
26 | |||
27 | CPUArchState *cpu_copy(CPUArchState *env); | ||
28 | diff --git a/include/exec/cpu_ldst_useronly_template.h b/include/exec/cpu_ldst_useronly_template.h | ||
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/include/exec/cpu_ldst_useronly_template.h | ||
31 | +++ b/include/exec/cpu_ldst_useronly_template.h | ||
32 | @@ -XXX,XX +XXX,XX @@ | ||
33 | static inline RES_TYPE | ||
34 | glue(glue(cpu_ld, USUFFIX), MEMSUFFIX)(CPUArchState *env, abi_ptr ptr) | ||
35 | { | ||
36 | -#if !defined(CODE_ACCESS) | ||
37 | +#ifdef CODE_ACCESS | ||
38 | + validate_exec_access(env, ptr, DATA_SIZE); | ||
39 | +#else | ||
40 | trace_guest_mem_before_exec( | ||
41 | env_cpu(env), ptr, | ||
42 | trace_mem_build_info(SHIFT, false, MO_TE, false)); | ||
43 | @@ -XXX,XX +XXX,XX @@ glue(glue(glue(cpu_ld, USUFFIX), MEMSUFFIX), _ra)(CPUArchState *env, | ||
44 | static inline int | ||
45 | glue(glue(cpu_lds, SUFFIX), MEMSUFFIX)(CPUArchState *env, abi_ptr ptr) | ||
46 | { | ||
47 | -#if !defined(CODE_ACCESS) | ||
48 | +#ifdef CODE_ACCESS | ||
49 | + validate_exec_access(env, ptr, DATA_SIZE); | ||
50 | +#else | ||
51 | trace_guest_mem_before_exec( | ||
52 | env_cpu(env), ptr, | ||
53 | trace_mem_build_info(SHIFT, true, MO_TE, false)); | ||
54 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c | ||
55 | index XXXXXXX..XXXXXXX 100644 | ||
56 | --- a/accel/tcg/translate-all.c | ||
57 | +++ b/accel/tcg/translate-all.c | ||
58 | @@ -XXX,XX +XXX,XX @@ int page_check_range(target_ulong start, target_ulong len, int flags) | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | + /* | ||
63 | + * FIXME: We place the signal trampoline on the stack, | ||
64 | + * even when the guest expects that to be in the vdso. | ||
65 | + * Until we fix that, allow execute on any readable page. | ||
66 | + */ | ||
67 | + if ((flags & PAGE_EXEC) && !(p->flags & (PAGE_EXEC | PAGE_READ))) { | ||
68 | + return -1; | ||
69 | + } | ||
70 | } | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | +/* | ||
75 | + * Called for each code read, longjmp out to issue SIGSEGV if the page(s) | ||
76 | + * do not have execute access. | ||
77 | + */ | ||
78 | +void validate_exec_access(CPUArchState *env, | ||
79 | + target_ulong ptr, target_ulong len) | ||
32 | +{ | 80 | +{ |
33 | + memset(s->free_temps, 0, sizeof(s->free_temps)); | 81 | + if (page_check_range(ptr, len, PAGE_EXEC) < 0) { |
82 | + CPUState *cs = env_cpu(env); | ||
83 | + CPUClass *cc = CPU_GET_CLASS(cs); | ||
84 | + | ||
85 | + /* Like tb_gen_code, release the memory lock before cpu_loop_exit. */ | ||
86 | + assert_memory_lock(); | ||
87 | + mmap_unlock(); | ||
88 | + | ||
89 | + /* This is user-only. The target must raise an exception. */ | ||
90 | + cc->tlb_fill(cs, ptr, 0, MMU_INST_FETCH, MMU_USER_IDX, false, 0); | ||
91 | + g_assert_not_reached(); | ||
92 | + } | ||
34 | +} | 93 | +} |
35 | + | 94 | + |
36 | #endif /* TCG_TEMP_FREE_H */ | 95 | /* called from signal handler: invalidate the code and unprotect the |
37 | diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c | 96 | * page. Return 0 if the fault was not handled, 1 if it was handled, |
38 | index XXXXXXX..XXXXXXX 100644 | 97 | * and 2 if it was handled but the caller must cause the TB to be |
39 | --- a/accel/tcg/plugin-gen.c | ||
40 | +++ b/accel/tcg/plugin-gen.c | ||
41 | @@ -XXX,XX +XXX,XX @@ static void plugin_gen_inject(struct qemu_plugin_tb *plugin_tb) | ||
42 | * that might be live within the existing opcode stream. | ||
43 | * The simplest solution is to release them all and create new. | ||
44 | */ | ||
45 | - memset(tcg_ctx->free_temps, 0, sizeof(tcg_ctx->free_temps)); | ||
46 | + tcg_temp_ebb_reset_freed(tcg_ctx); | ||
47 | |||
48 | QTAILQ_FOREACH_SAFE(op, &tcg_ctx->ops, link, next) { | ||
49 | switch (op->opc) { | ||
50 | diff --git a/tcg/tcg.c b/tcg/tcg.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/tcg/tcg.c | ||
53 | +++ b/tcg/tcg.c | ||
54 | @@ -XXX,XX +XXX,XX @@ void tcg_func_start(TCGContext *s) | ||
55 | s->nb_temps = s->nb_globals; | ||
56 | |||
57 | /* No temps have been previously allocated for size or locality. */ | ||
58 | - memset(s->free_temps, 0, sizeof(s->free_temps)); | ||
59 | + tcg_temp_ebb_reset_freed(s); | ||
60 | |||
61 | /* No constant temps have been previously allocated. */ | ||
62 | for (int i = 0; i < TCG_TYPE_COUNT; ++i) { | ||
63 | @@ -XXX,XX +XXX,XX @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb, uint64_t pc_start) | ||
64 | } | ||
65 | #endif | ||
66 | |||
67 | + /* Do not reuse any EBB that may be allocated within the TB. */ | ||
68 | + tcg_temp_ebb_reset_freed(s); | ||
69 | + | ||
70 | tcg_optimize(s); | ||
71 | |||
72 | reachable_code_pass(s); | ||
73 | -- | 98 | -- |
74 | 2.43.0 | 99 | 2.17.1 |
75 | 100 | ||
76 | 101 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Alistair Francis <alistair.francis@wdc.com> | ||
1 | 2 | ||
3 | Commit 269bd5d8 "cpu: Move the softmmu tlb to CPUNegativeOffsetState' | ||
4 | broke the RISC-V host build as there are two variables that are used but | ||
5 | not defined. | ||
6 | |||
7 | This patch renames the undefined variables mask_off and table_off to the | ||
8 | existing (but unused) mask_ofs and table_ofs variables. | ||
9 | |||
10 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
11 | Message-Id: <79729cc88ca509e08b5c4aa0aa8a52847af70c0f.1561039316.git.alistair.francis@wdc.com> | ||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | --- | ||
14 | tcg/riscv/tcg-target.inc.c | 4 ++-- | ||
15 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
16 | |||
17 | diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/tcg/riscv/tcg-target.inc.c | ||
20 | +++ b/tcg/riscv/tcg-target.inc.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_tlb_load(TCGContext *s, TCGReg addrl, | ||
22 | int table_ofs = fast_ofs + offsetof(CPUTLBDescFast, table); | ||
23 | TCGReg mask_base = TCG_AREG0, table_base = TCG_AREG0; | ||
24 | |||
25 | - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP0, mask_base, mask_off); | ||
26 | - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, table_base, table_off); | ||
27 | + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP0, mask_base, mask_ofs); | ||
28 | + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, table_base, table_ofs); | ||
29 | |||
30 | tcg_out_opc_imm(s, OPC_SRLI, TCG_REG_TMP2, addrl, | ||
31 | TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS); | ||
32 | -- | ||
33 | 2.17.1 | ||
34 | |||
35 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | 1 | From: Alistair Francis <alistair.francis@wdc.com> |
---|---|---|---|
2 | 2 | ||
3 | Rather than manually copying each register, use | 3 | Commit 269bd5d8 "cpu: Move the softmmu tlb to CPUNegativeOffsetState' |
4 | the libc memcpy(), which is well optimized nowadays. | 4 | broke the RISC-V host build as there are two variables that are used but |
5 | not defined. | ||
5 | 6 | ||
6 | Suggested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> | 7 | This patch renames the undefined variables mask_off and table_off to the |
7 | Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> | 8 | existing (but unused) mask_ofs and table_ofs variables. |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | |
9 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | 10 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> |
10 | Message-ID: <20241205205418.67613-1-philmd@linaro.org> | 11 | Message-Id: <79729cc88ca509e08b5c4aa0aa8a52847af70c0f.1561039316.git.alistair.francis@wdc.com> |
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
12 | --- | 13 | --- |
13 | target/sparc/win_helper.c | 26 ++++++++------------------ | 14 | tcg/riscv/tcg-target.inc.c | 4 ++-- |
14 | 1 file changed, 8 insertions(+), 18 deletions(-) | 15 | 1 file changed, 2 insertions(+), 2 deletions(-) |
15 | 16 | ||
16 | diff --git a/target/sparc/win_helper.c b/target/sparc/win_helper.c | 17 | diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c |
17 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/sparc/win_helper.c | 19 | --- a/tcg/riscv/tcg-target.inc.c |
19 | +++ b/target/sparc/win_helper.c | 20 | +++ b/tcg/riscv/tcg-target.inc.c |
20 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_tlb_load(TCGContext *s, TCGReg addrl, |
21 | #include "exec/helper-proto.h" | 22 | int table_ofs = fast_ofs + offsetof(CPUTLBDescFast, table); |
22 | #include "trace.h" | 23 | TCGReg mask_base = TCG_AREG0, table_base = TCG_AREG0; |
23 | 24 | ||
24 | -static inline void memcpy32(target_ulong *dst, const target_ulong *src) | 25 | - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP0, mask_base, mask_off); |
25 | -{ | 26 | - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, table_base, table_off); |
26 | - dst[0] = src[0]; | 27 | + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP0, mask_base, mask_ofs); |
27 | - dst[1] = src[1]; | 28 | + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP1, table_base, table_ofs); |
28 | - dst[2] = src[2]; | 29 | |
29 | - dst[3] = src[3]; | 30 | tcg_out_opc_imm(s, OPC_SRLI, TCG_REG_TMP2, addrl, |
30 | - dst[4] = src[4]; | 31 | TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS); |
31 | - dst[5] = src[5]; | ||
32 | - dst[6] = src[6]; | ||
33 | - dst[7] = src[7]; | ||
34 | -} | ||
35 | - | ||
36 | void cpu_set_cwp(CPUSPARCState *env, int new_cwp) | ||
37 | { | ||
38 | /* put the modified wrap registers at their proper location */ | ||
39 | if (env->cwp == env->nwindows - 1) { | ||
40 | - memcpy32(env->regbase, env->regbase + env->nwindows * 16); | ||
41 | + memcpy(env->regbase, env->regbase + env->nwindows * 16, | ||
42 | + sizeof(env->gregs)); | ||
43 | } | ||
44 | env->cwp = new_cwp; | ||
45 | |||
46 | /* put the wrap registers at their temporary location */ | ||
47 | if (new_cwp == env->nwindows - 1) { | ||
48 | - memcpy32(env->regbase + env->nwindows * 16, env->regbase); | ||
49 | + memcpy(env->regbase + env->nwindows * 16, env->regbase, | ||
50 | + sizeof(env->gregs)); | ||
51 | } | ||
52 | env->regwptr = env->regbase + (new_cwp * 16); | ||
53 | } | ||
54 | @@ -XXX,XX +XXX,XX @@ void cpu_gl_switch_gregs(CPUSPARCState *env, uint32_t new_gl) | ||
55 | dst = get_gl_gregset(env, env->gl); | ||
56 | |||
57 | if (src != dst) { | ||
58 | - memcpy32(dst, env->gregs); | ||
59 | - memcpy32(env->gregs, src); | ||
60 | + memcpy(dst, env->gregs, sizeof(env->gregs)); | ||
61 | + memcpy(env->gregs, src, sizeof(env->gregs)); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | @@ -XXX,XX +XXX,XX @@ void cpu_change_pstate(CPUSPARCState *env, uint32_t new_pstate) | ||
66 | /* Switch global register bank */ | ||
67 | src = get_gregset(env, new_pstate_regs); | ||
68 | dst = get_gregset(env, pstate_regs); | ||
69 | - memcpy32(dst, env->gregs); | ||
70 | - memcpy32(env->gregs, src); | ||
71 | + memcpy(dst, env->gregs, sizeof(env->gregs)); | ||
72 | + memcpy(env->gregs, src, sizeof(env->gregs)); | ||
73 | } else { | ||
74 | trace_win_helper_no_switch_pstate(new_pstate_regs); | ||
75 | } | ||
76 | -- | 32 | -- |
77 | 2.43.0 | 33 | 2.17.1 |
78 | 34 | ||
79 | 35 | diff view generated by jsdifflib |
1 | This allows targets to declare that the helper requires a | 1 | This operation can always be emitted, even if we need to |
---|---|---|---|
2 | float_status pointer and instead of a generic void pointer. | 2 | fall back to xor. Adjust the assertions to match. |
3 | 3 | ||
4 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | --- | 5 | --- |
7 | include/exec/helper-head.h.inc | 3 +++ | 6 | tcg/tcg-op-vec.c | 6 ++++++ |
8 | 1 file changed, 3 insertions(+) | 7 | 1 file changed, 6 insertions(+) |
9 | 8 | ||
10 | diff --git a/include/exec/helper-head.h.inc b/include/exec/helper-head.h.inc | 9 | diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c |
11 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/include/exec/helper-head.h.inc | 11 | --- a/tcg/tcg-op-vec.c |
13 | +++ b/include/exec/helper-head.h.inc | 12 | +++ b/tcg/tcg-op-vec.c |
14 | @@ -XXX,XX +XXX,XX @@ | 13 | @@ -XXX,XX +XXX,XX @@ bool tcg_can_emit_vecop_list(const TCGOpcode *list, |
15 | #define dh_alias_ptr ptr | 14 | case INDEX_op_bitsel_vec: |
16 | #define dh_alias_cptr ptr | 15 | /* These opcodes are mandatory and should not be listed. */ |
17 | #define dh_alias_env ptr | 16 | g_assert_not_reached(); |
18 | +#define dh_alias_fpst ptr | 17 | + case INDEX_op_not_vec: |
19 | #define dh_alias_void void | 18 | + /* These opcodes have generic expansions using the above. */ |
20 | #define dh_alias_noreturn noreturn | 19 | + g_assert_not_reached(); |
21 | #define dh_alias(t) glue(dh_alias_, t) | 20 | default: |
22 | @@ -XXX,XX +XXX,XX @@ | 21 | break; |
23 | #define dh_ctype_ptr void * | 22 | } |
24 | #define dh_ctype_cptr const void * | 23 | @@ -XXX,XX +XXX,XX @@ static bool do_op2(unsigned vece, TCGv_vec r, TCGv_vec a, TCGOpcode opc) |
25 | #define dh_ctype_env CPUArchState * | 24 | |
26 | +#define dh_ctype_fpst float_status * | 25 | void tcg_gen_not_vec(unsigned vece, TCGv_vec r, TCGv_vec a) |
27 | #define dh_ctype_void void | 26 | { |
28 | #define dh_ctype_noreturn G_NORETURN void | 27 | + const TCGOpcode *hold_list = tcg_swap_vecop_list(NULL); |
29 | #define dh_ctype(t) dh_ctype_##t | 28 | + |
30 | @@ -XXX,XX +XXX,XX @@ | 29 | if (!TCG_TARGET_HAS_not_vec || !do_op2(vece, r, a, INDEX_op_not_vec)) { |
31 | #define dh_typecode_f64 dh_typecode_i64 | 30 | TCGv_vec t = tcg_const_ones_vec_matching(r); |
32 | #define dh_typecode_cptr dh_typecode_ptr | 31 | tcg_gen_xor_vec(0, r, a, t); |
33 | #define dh_typecode_env dh_typecode_ptr | 32 | tcg_temp_free_vec(t); |
34 | +#define dh_typecode_fpst dh_typecode_ptr | 33 | } |
35 | #define dh_typecode(t) dh_typecode_##t | 34 | + tcg_swap_vecop_list(hold_list); |
36 | 35 | } | |
37 | #define dh_callflag_i32 0 | 36 | |
37 | void tcg_gen_neg_vec(unsigned vece, TCGv_vec r, TCGv_vec a) | ||
38 | -- | 38 | -- |
39 | 2.43.0 | 39 | 2.17.1 |
40 | 40 | ||
41 | 41 | diff view generated by jsdifflib |
1 | From: Roman Artemev <roman.artemev@syntacore.com> | 1 | This operation can always be emitted, even if we need to |
---|---|---|---|
2 | fall back to xor. Adjust the assertions to match. | ||
2 | 3 | ||
3 | On RISC-V to StoreStore barrier corresponds | ||
4 | `fence w, w` not `fence r, r` | ||
5 | |||
6 | Cc: qemu-stable@nongnu.org | ||
7 | Fixes: efbea94c76b ("tcg/riscv: Add slowpath load and store instructions") | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Signed-off-by: Denis Tomashev <denis.tomashev@syntacore.com> | ||
10 | Signed-off-by: Roman Artemev <roman.artemev@syntacore.com> | ||
11 | Message-ID: <e2f2131e294a49e79959d4fa9ec02cf4@syntacore.com> | ||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
13 | --- | 5 | --- |
14 | tcg/riscv/tcg-target.c.inc | 2 +- | 6 | tcg/tcg-op-vec.c | 6 ++++++ |
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | 7 | 1 file changed, 6 insertions(+) |
16 | 8 | ||
17 | diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc | 9 | diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c |
18 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/tcg/riscv/tcg-target.c.inc | 11 | --- a/tcg/tcg-op-vec.c |
20 | +++ b/tcg/riscv/tcg-target.c.inc | 12 | +++ b/tcg/tcg-op-vec.c |
21 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_mb(TCGContext *s, TCGArg a0) | 13 | @@ -XXX,XX +XXX,XX @@ bool tcg_can_emit_vecop_list(const TCGOpcode *list, |
22 | insn |= 0x02100000; | 14 | case INDEX_op_bitsel_vec: |
15 | /* These opcodes are mandatory and should not be listed. */ | ||
16 | g_assert_not_reached(); | ||
17 | + case INDEX_op_not_vec: | ||
18 | + /* These opcodes have generic expansions using the above. */ | ||
19 | + g_assert_not_reached(); | ||
20 | default: | ||
21 | break; | ||
22 | } | ||
23 | @@ -XXX,XX +XXX,XX @@ static bool do_op2(unsigned vece, TCGv_vec r, TCGv_vec a, TCGOpcode opc) | ||
24 | |||
25 | void tcg_gen_not_vec(unsigned vece, TCGv_vec r, TCGv_vec a) | ||
26 | { | ||
27 | + const TCGOpcode *hold_list = tcg_swap_vecop_list(NULL); | ||
28 | + | ||
29 | if (!TCG_TARGET_HAS_not_vec || !do_op2(vece, r, a, INDEX_op_not_vec)) { | ||
30 | TCGv_vec t = tcg_const_ones_vec_matching(r); | ||
31 | tcg_gen_xor_vec(0, r, a, t); | ||
32 | tcg_temp_free_vec(t); | ||
23 | } | 33 | } |
24 | if (a0 & TCG_MO_ST_ST) { | 34 | + tcg_swap_vecop_list(hold_list); |
25 | - insn |= 0x02200000; | ||
26 | + insn |= 0x01100000; | ||
27 | } | ||
28 | tcg_out32(s, insn); | ||
29 | } | 35 | } |
36 | |||
37 | void tcg_gen_neg_vec(unsigned vece, TCGv_vec r, TCGv_vec a) | ||
30 | -- | 38 | -- |
31 | 2.43.0 | 39 | 2.17.1 |
40 | |||
41 | diff view generated by jsdifflib |