1
The following changes since commit bad76ac319556dab2497429d473b49a237672e1c:
1
Pretty small still, but there are two patches that ought
2
to get backported to stable, so no point in delaying.
2
3
3
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into staging (2019-10-25 14:17:08 +0100)
4
r~
5
6
The following changes since commit a5ba0a7e4e150d1350a041f0d0ef9ca6c8d7c307:
7
8
Merge tag 'pull-aspeed-20241211' of https://github.com/legoater/qemu into staging (2024-12-11 15:16:47 +0000)
4
9
5
are available in the Git repository at:
10
are available in the Git repository at:
6
11
7
https://github.com/rth7680/qemu.git tags/pull-tcg-20191025
12
https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20241212
8
13
9
for you to fetch changes up to 0ed1bfb046b740b70eed2cf3581e01768703b185:
14
for you to fetch changes up to 7ac87b14a92234b6a89b701b4043ad6cf8bdcccf:
10
15
11
translate-all: Remove tb_alloc (2019-10-25 10:15:25 -0400)
16
target/sparc: Use memcpy() and remove memcpy32() (2024-12-12 14:28:38 -0600)
12
17
13
----------------------------------------------------------------
18
----------------------------------------------------------------
14
Improvements for TARGET_PAGE_BITS_VARY
19
tcg: Reset free_temps before tcg_optimize
15
Fix for TCI ld16u_i64.
20
tcg/riscv: Fix StoreStore barrier generation
16
Fix for segv on icount execute from i/o memory.
21
include/exec: Introduce fpst alias in helper-head.h.inc
17
Two misc cleanups.
22
target/sparc: Use memcpy() and remove memcpy32()
18
23
19
----------------------------------------------------------------
24
----------------------------------------------------------------
20
Alex Bennée (1):
25
Philippe Mathieu-Daudé (1):
21
cputlb: ensure _cmmu helper functions follow the naming standard
26
target/sparc: Use memcpy() and remove memcpy32()
22
27
23
Clement Deschamps (1):
28
Richard Henderson (2):
24
translate-all: fix uninitialized tb->orig_tb
29
tcg: Reset free_temps before tcg_optimize
30
include/exec: Introduce fpst alias in helper-head.h.inc
25
31
26
Richard Henderson (8):
32
Roman Artemev (1):
27
exec: Split out variable page size support to exec-vary.c
33
tcg/riscv: Fix StoreStore barrier generation
28
configure: Detect compiler support for __attribute__((alias))
29
exec: Use const alias for TARGET_PAGE_BITS_VARY
30
exec: Restrict TARGET_PAGE_BITS_VARY assert to CONFIG_DEBUG_TCG
31
exec: Promote TARGET_PAGE_MASK to target_long
32
exec: Cache TARGET_PAGE_MASK for TARGET_PAGE_BITS_VARY
33
cputlb: Fix tlb_vaddr_to_host
34
translate-all: Remove tb_alloc
35
34
36
Stefan Weil (1):
35
include/tcg/tcg-temp-internal.h | 6 ++++++
37
tci: Add implementation for INDEX_op_ld16u_i64
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(-)
38
42
39
Wei Yang (1):
40
cpu: use ROUND_UP() to define xxx_PAGE_ALIGN
41
42
Makefile.target | 2 +-
43
include/exec/cpu-all.h | 33 +++++++++----
44
include/exec/cpu_ldst_template.h | 4 +-
45
include/qemu-common.h | 6 +++
46
tcg/tcg.h | 20 +++++---
47
accel/tcg/cputlb.c | 26 ++++++++--
48
accel/tcg/translate-all.c | 21 ++------
49
exec-vary.c | 102 +++++++++++++++++++++++++++++++++++++++
50
exec.c | 34 -------------
51
target/cris/translate_v10.inc.c | 3 +-
52
tcg/tci.c | 15 ++++++
53
configure | 19 ++++++++
54
12 files changed, 208 insertions(+), 77 deletions(-)
55
create mode 100644 exec-vary.c
56
diff view generated by jsdifflib
Deleted patch
1
From: Stefan Weil <sw@weilnetz.de>
2
1
3
This fixes "make check-tcg" on a Debian x86_64 host.
4
5
Signed-off-by: Stefan Weil <sw@weilnetz.de>
6
Tested-by: Thomas Huth <thuth@redhat.com>
7
Message-Id: <20190410194838.10123-1-sw@weilnetz.de>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
10
tcg/tci.c | 15 +++++++++++++++
11
1 file changed, 15 insertions(+)
12
13
diff --git a/tcg/tci.c b/tcg/tci.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/tcg/tci.c
16
+++ b/tcg/tci.c
17
@@ -XXX,XX +XXX,XX @@ static void tci_write_reg8(tcg_target_ulong *regs, TCGReg index, uint8_t value)
18
tci_write_reg(regs, index, value);
19
}
20
21
+static void
22
+tci_write_reg16(tcg_target_ulong *regs, TCGReg index, uint16_t value)
23
+{
24
+ tci_write_reg(regs, index, value);
25
+}
26
+
27
static void
28
tci_write_reg32(tcg_target_ulong *regs, TCGReg index, uint32_t value)
29
{
30
@@ -XXX,XX +XXX,XX @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
31
tci_write_reg8(regs, t0, *(uint8_t *)(t1 + t2));
32
break;
33
case INDEX_op_ld8s_i32:
34
+ TODO();
35
+ break;
36
case INDEX_op_ld16u_i32:
37
TODO();
38
break;
39
@@ -XXX,XX +XXX,XX @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
40
tci_write_reg8(regs, t0, *(uint8_t *)(t1 + t2));
41
break;
42
case INDEX_op_ld8s_i64:
43
+ TODO();
44
+ break;
45
case INDEX_op_ld16u_i64:
46
+ t0 = *tb_ptr++;
47
+ t1 = tci_read_r(regs, &tb_ptr);
48
+ t2 = tci_read_s32(&tb_ptr);
49
+ tci_write_reg16(regs, t0, *(uint16_t *)(t1 + t2));
50
+ break;
51
case INDEX_op_ld16s_i64:
52
TODO();
53
break;
54
--
55
2.17.1
56
57
diff view generated by jsdifflib
1
The next patch will play a trick with "const" that will
1
When allocating new temps during tcg_optmize, do not re-use
2
confuse the compiler about the uses of target_page_bits
2
any EBB temps that were used within the TB. We do not have
3
within exec.c. Moving everything to a new file prevents
3
any idea what span of the TB in which the temp was live.
4
this confusion.
5
4
6
No functional change so far.
5
Introduce tcg_temp_ebb_reset_freed and use before tcg_optimize,
6
as well as replacing the equivalent in plugin_gen_inject and
7
tcg_func_start.
7
8
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Cc: qemu-stable@nongnu.org
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
Fixes: fb04ab7ddd8 ("tcg/optimize: Lower TCG_COND_TST{EQ,NE} if unsupported")
10
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2711
12
Reported-by: wannacu <wannacu2049@gmail.com>
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
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>
12
---
16
---
13
Makefile.target | 2 +-
17
include/tcg/tcg-temp-internal.h | 6 ++++++
14
include/qemu-common.h | 6 +++++
18
accel/tcg/plugin-gen.c | 2 +-
15
exec-vary.c | 57 +++++++++++++++++++++++++++++++++++++++++++
19
tcg/tcg.c | 5 ++++-
16
exec.c | 34 --------------------------
20
3 files changed, 11 insertions(+), 2 deletions(-)
17
4 files changed, 64 insertions(+), 35 deletions(-)
18
create mode 100644 exec-vary.c
19
21
20
diff --git a/Makefile.target b/Makefile.target
22
diff --git a/include/tcg/tcg-temp-internal.h b/include/tcg/tcg-temp-internal.h
21
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
22
--- a/Makefile.target
24
--- a/include/tcg/tcg-temp-internal.h
23
+++ b/Makefile.target
25
+++ b/include/tcg/tcg-temp-internal.h
24
@@ -XXX,XX +XXX,XX @@ obj-y += trace/
26
@@ -XXX,XX +XXX,XX @@ TCGv_i64 tcg_temp_ebb_new_i64(void);
25
27
TCGv_ptr tcg_temp_ebb_new_ptr(void);
26
#########################################################
28
TCGv_i128 tcg_temp_ebb_new_i128(void);
27
# cpu emulator library
29
28
-obj-y += exec.o
30
+/* Forget all freed EBB temps, so that new allocations produce new temps. */
29
+obj-y += exec.o exec-vary.o
31
+static inline void tcg_temp_ebb_reset_freed(TCGContext *s)
30
obj-y += accel/
31
obj-$(CONFIG_TCG) += tcg/tcg.o tcg/tcg-op.o tcg/tcg-op-vec.o tcg/tcg-op-gvec.o
32
obj-$(CONFIG_TCG) += tcg/tcg-common.o tcg/optimize.o
33
diff --git a/include/qemu-common.h b/include/qemu-common.h
34
index XXXXXXX..XXXXXXX 100644
35
--- a/include/qemu-common.h
36
+++ b/include/qemu-common.h
37
@@ -XXX,XX +XXX,XX @@ void cpu_exec_step_atomic(CPUState *cpu);
38
*/
39
bool set_preferred_target_page_bits(int bits);
40
41
+/**
42
+ * finalize_target_page_bits:
43
+ * Commit the final value set by set_preferred_target_page_bits.
44
+ */
45
+void finalize_target_page_bits(void);
46
+
47
/**
48
* Sends a (part of) iovec down a socket, yielding when the socket is full, or
49
* Receives data into a (part of) iovec from a socket,
50
diff --git a/exec-vary.c b/exec-vary.c
51
new file mode 100644
52
index XXXXXXX..XXXXXXX
53
--- /dev/null
54
+++ b/exec-vary.c
55
@@ -XXX,XX +XXX,XX @@
56
+/*
57
+ * Variable page size handling
58
+ *
59
+ * Copyright (c) 2003 Fabrice Bellard
60
+ *
61
+ * This library is free software; you can redistribute it and/or
62
+ * modify it under the terms of the GNU Lesser General Public
63
+ * License as published by the Free Software Foundation; either
64
+ * version 2 of the License, or (at your option) any later version.
65
+ *
66
+ * This library is distributed in the hope that it will be useful,
67
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
68
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
69
+ * Lesser General Public License for more details.
70
+ *
71
+ * You should have received a copy of the GNU Lesser General Public
72
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
73
+ */
74
+
75
+#include "qemu/osdep.h"
76
+#include "qemu-common.h"
77
+#include "exec/exec-all.h"
78
+
79
+#ifdef TARGET_PAGE_BITS_VARY
80
+int target_page_bits;
81
+bool target_page_bits_decided;
82
+#endif
83
+
84
+bool set_preferred_target_page_bits(int bits)
85
+{
32
+{
86
+ /*
33
+ memset(s->free_temps, 0, sizeof(s->free_temps));
87
+ * The target page size is the lowest common denominator for all
88
+ * the CPUs in the system, so we can only make it smaller, never
89
+ * larger. And we can't make it smaller once we've committed to
90
+ * a particular size.
91
+ */
92
+#ifdef TARGET_PAGE_BITS_VARY
93
+ assert(bits >= TARGET_PAGE_BITS_MIN);
94
+ if (target_page_bits == 0 || target_page_bits > bits) {
95
+ if (target_page_bits_decided) {
96
+ return false;
97
+ }
98
+ target_page_bits = bits;
99
+ }
100
+#endif
101
+ return true;
102
+}
34
+}
103
+
35
+
104
+void finalize_target_page_bits(void)
36
#endif /* TCG_TEMP_FREE_H */
105
+{
37
diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c
106
+#ifdef TARGET_PAGE_BITS_VARY
107
+ if (target_page_bits == 0) {
108
+ target_page_bits = TARGET_PAGE_BITS_MIN;
109
+ }
110
+ target_page_bits_decided = true;
111
+#endif
112
+}
113
diff --git a/exec.c b/exec.c
114
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
115
--- a/exec.c
39
--- a/accel/tcg/plugin-gen.c
116
+++ b/exec.c
40
+++ b/accel/tcg/plugin-gen.c
117
@@ -XXX,XX +XXX,XX @@ AddressSpace address_space_memory;
41
@@ -XXX,XX +XXX,XX @@ static void plugin_gen_inject(struct qemu_plugin_tb *plugin_tb)
118
static MemoryRegion io_mem_unassigned;
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
}
119
#endif
65
#endif
120
66
121
-#ifdef TARGET_PAGE_BITS_VARY
67
+ /* Do not reuse any EBB that may be allocated within the TB. */
122
-int target_page_bits;
68
+ tcg_temp_ebb_reset_freed(s);
123
-bool target_page_bits_decided;
69
+
124
-#endif
70
tcg_optimize(s);
125
-
71
126
CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
72
reachable_code_pass(s);
127
128
/* current CPU in the current thread. It is only valid inside
129
@@ -XXX,XX +XXX,XX @@ int use_icount;
130
uintptr_t qemu_host_page_size;
131
intptr_t qemu_host_page_mask;
132
133
-bool set_preferred_target_page_bits(int bits)
134
-{
135
- /* The target page size is the lowest common denominator for all
136
- * the CPUs in the system, so we can only make it smaller, never
137
- * larger. And we can't make it smaller once we've committed to
138
- * a particular size.
139
- */
140
-#ifdef TARGET_PAGE_BITS_VARY
141
- assert(bits >= TARGET_PAGE_BITS_MIN);
142
- if (target_page_bits == 0 || target_page_bits > bits) {
143
- if (target_page_bits_decided) {
144
- return false;
145
- }
146
- target_page_bits = bits;
147
- }
148
-#endif
149
- return true;
150
-}
151
-
152
#if !defined(CONFIG_USER_ONLY)
153
154
-static void finalize_target_page_bits(void)
155
-{
156
-#ifdef TARGET_PAGE_BITS_VARY
157
- if (target_page_bits == 0) {
158
- target_page_bits = TARGET_PAGE_BITS_MIN;
159
- }
160
- target_page_bits_decided = true;
161
-#endif
162
-}
163
-
164
typedef struct PhysPageEntry PhysPageEntry;
165
166
struct PhysPageEntry {
167
--
73
--
168
2.17.1
74
2.43.0
169
75
170
76
diff view generated by jsdifflib
1
Using uintptr_t instead of target_ulong meant that, for 64-bit guest
1
From: Roman Artemev <roman.artemev@syntacore.com>
2
and 32-bit host, we truncated the guest address comparator and so may
3
not hit the tlb when we should.
4
2
5
Fixes: 4811e9095c0
3
On RISC-V to StoreStore barrier corresponds
6
Reviewed-by: David Hildenbrand <david@redhat.com>
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>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
---
13
---
9
accel/tcg/cputlb.c | 2 +-
14
tcg/riscv/tcg-target.c.inc | 2 +-
10
1 file changed, 1 insertion(+), 1 deletion(-)
15
1 file changed, 1 insertion(+), 1 deletion(-)
11
16
12
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
17
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
13
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
14
--- a/accel/tcg/cputlb.c
19
--- a/tcg/riscv/tcg-target.c.inc
15
+++ b/accel/tcg/cputlb.c
20
+++ b/tcg/riscv/tcg-target.c.inc
16
@@ -XXX,XX +XXX,XX @@ void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
21
@@ -XXX,XX +XXX,XX @@ static void tcg_out_mb(TCGContext *s, TCGArg a0)
17
MMUAccessType access_type, int mmu_idx)
22
insn |= 0x02100000;
18
{
23
}
19
CPUTLBEntry *entry = tlb_entry(env, mmu_idx, addr);
24
if (a0 & TCG_MO_ST_ST) {
20
- uintptr_t tlb_addr, page;
25
- insn |= 0x02200000;
21
+ target_ulong tlb_addr, page;
26
+ insn |= 0x01100000;
22
size_t elt_ofs;
27
}
23
28
tcg_out32(s, insn);
24
switch (access_type) {
29
}
25
--
30
--
26
2.17.1
31
2.43.0
27
28
diff view generated by jsdifflib
1
Since 2ac01d6dafab, this function does only two things: assert a
1
This allows targets to declare that the helper requires a
2
lock is held, and call tcg_tb_alloc. It is used exactly once,
2
float_status pointer and instead of a generic void pointer.
3
and its user has already done the assert.
4
3
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Reviewed-by: Clement Deschamps <clement.deschamps@greensocs.com>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
---
6
---
9
accel/tcg/translate-all.c | 20 ++------------------
7
include/exec/helper-head.h.inc | 3 +++
10
1 file changed, 2 insertions(+), 18 deletions(-)
8
1 file changed, 3 insertions(+)
11
9
12
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
10
diff --git a/include/exec/helper-head.h.inc b/include/exec/helper-head.h.inc
13
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
14
--- a/accel/tcg/translate-all.c
12
--- a/include/exec/helper-head.h.inc
15
+++ b/accel/tcg/translate-all.c
13
+++ b/include/exec/helper-head.h.inc
16
@@ -XXX,XX +XXX,XX @@ void tcg_exec_init(unsigned long tb_size)
14
@@ -XXX,XX +XXX,XX @@
17
#endif
15
#define dh_alias_ptr ptr
18
}
16
#define dh_alias_cptr ptr
19
17
#define dh_alias_env ptr
20
-/*
18
+#define dh_alias_fpst ptr
21
- * Allocate a new translation block. Flush the translation buffer if
19
#define dh_alias_void void
22
- * too many translation blocks or too much generated code.
20
#define dh_alias_noreturn noreturn
23
- */
21
#define dh_alias(t) glue(dh_alias_, t)
24
-static TranslationBlock *tb_alloc(target_ulong pc)
22
@@ -XXX,XX +XXX,XX @@
25
-{
23
#define dh_ctype_ptr void *
26
- TranslationBlock *tb;
24
#define dh_ctype_cptr const void *
27
-
25
#define dh_ctype_env CPUArchState *
28
- assert_memory_lock();
26
+#define dh_ctype_fpst float_status *
29
-
27
#define dh_ctype_void void
30
- tb = tcg_tb_alloc(tcg_ctx);
28
#define dh_ctype_noreturn G_NORETURN void
31
- if (unlikely(tb == NULL)) {
29
#define dh_ctype(t) dh_ctype_##t
32
- return NULL;
30
@@ -XXX,XX +XXX,XX @@
33
- }
31
#define dh_typecode_f64 dh_typecode_i64
34
- return tb;
32
#define dh_typecode_cptr dh_typecode_ptr
35
-}
33
#define dh_typecode_env dh_typecode_ptr
36
-
34
+#define dh_typecode_fpst dh_typecode_ptr
37
/* call with @p->lock held */
35
#define dh_typecode(t) dh_typecode_##t
38
static inline void invalidate_page_bitmap(PageDesc *p)
36
39
{
37
#define dh_callflag_i32 0
40
@@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu,
41
TCGProfile *prof = &tcg_ctx->prof;
42
int64_t ti;
43
#endif
44
+
45
assert_memory_lock();
46
47
phys_pc = get_page_addr_code(env, pc);
48
@@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu,
49
}
50
51
buffer_overflow:
52
- tb = tb_alloc(pc);
53
+ tb = tcg_tb_alloc(tcg_ctx);
54
if (unlikely(!tb)) {
55
/* flush must be done */
56
tb_flush(cpu);
57
--
38
--
58
2.17.1
39
2.43.0
59
40
60
41
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
We document this in docs/devel/load-stores.rst so lets follow it. The
3
Rather than manually copying each register, use
4
32 bit and 64 bit access functions have historically not included the
4
the libc memcpy(), which is well optimized nowadays.
5
sign so we leave those as is. We also introduce some signed helpers
6
which are used for loading immediate values in the translator.
7
5
8
Fixes: 282dffc8
6
Suggested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
7
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Message-Id: <20191021150910.23216-1-alex.bennee@linaro.org>
10
Message-ID: <20241205205418.67613-1-philmd@linaro.org>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
---
12
---
14
include/exec/cpu_ldst_template.h | 4 ++--
13
target/sparc/win_helper.c | 26 ++++++++------------------
15
tcg/tcg.h | 20 ++++++++++++++------
14
1 file changed, 8 insertions(+), 18 deletions(-)
16
accel/tcg/cputlb.c | 24 +++++++++++++++++++++---
17
target/cris/translate_v10.inc.c | 3 +--
18
4 files changed, 38 insertions(+), 13 deletions(-)
19
15
20
diff --git a/include/exec/cpu_ldst_template.h b/include/exec/cpu_ldst_template.h
16
diff --git a/target/sparc/win_helper.c b/target/sparc/win_helper.c
21
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
22
--- a/include/exec/cpu_ldst_template.h
18
--- a/target/sparc/win_helper.c
23
+++ b/include/exec/cpu_ldst_template.h
19
+++ b/target/sparc/win_helper.c
24
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@
25
#ifdef SOFTMMU_CODE_ACCESS
21
#include "exec/helper-proto.h"
26
#define ADDR_READ addr_code
22
#include "trace.h"
27
#define MMUSUFFIX _cmmu
23
28
-#define URETSUFFIX SUFFIX
24
-static inline void memcpy32(target_ulong *dst, const target_ulong *src)
29
-#define SRETSUFFIX SUFFIX
25
-{
30
+#define URETSUFFIX USUFFIX
26
- dst[0] = src[0];
31
+#define SRETSUFFIX glue(s, SUFFIX)
27
- dst[1] = src[1];
32
#else
28
- dst[2] = src[2];
33
#define ADDR_READ addr_read
29
- dst[3] = src[3];
34
#define MMUSUFFIX _mmu
30
- dst[4] = src[4];
35
diff --git a/tcg/tcg.h b/tcg/tcg.h
31
- dst[5] = src[5];
36
index XXXXXXX..XXXXXXX 100644
32
- dst[6] = src[6];
37
--- a/tcg/tcg.h
33
- dst[7] = src[7];
38
+++ b/tcg/tcg.h
34
-}
39
@@ -XXX,XX +XXX,XX @@ void helper_be_stl_mmu(CPUArchState *env, target_ulong addr, uint32_t val,
35
-
40
void helper_be_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val,
36
void cpu_set_cwp(CPUSPARCState *env, int new_cwp)
41
TCGMemOpIdx oi, uintptr_t retaddr);
37
{
42
38
/* put the modified wrap registers at their proper location */
43
-uint8_t helper_ret_ldb_cmmu(CPUArchState *env, target_ulong addr,
39
if (env->cwp == env->nwindows - 1) {
44
+uint8_t helper_ret_ldub_cmmu(CPUArchState *env, target_ulong addr,
40
- memcpy32(env->regbase, env->regbase + env->nwindows * 16);
45
TCGMemOpIdx oi, uintptr_t retaddr);
41
+ memcpy(env->regbase, env->regbase + env->nwindows * 16,
46
-uint16_t helper_le_ldw_cmmu(CPUArchState *env, target_ulong addr,
42
+ sizeof(env->gregs));
47
+int8_t helper_ret_ldsb_cmmu(CPUArchState *env, target_ulong addr,
43
}
48
TCGMemOpIdx oi, uintptr_t retaddr);
44
env->cwp = new_cwp;
49
+uint16_t helper_le_lduw_cmmu(CPUArchState *env, target_ulong addr,
45
50
+ TCGMemOpIdx oi, uintptr_t retaddr);
46
/* put the wrap registers at their temporary location */
51
+int16_t helper_le_ldsw_cmmu(CPUArchState *env, target_ulong addr,
47
if (new_cwp == env->nwindows - 1) {
52
+ TCGMemOpIdx oi, uintptr_t retaddr);
48
- memcpy32(env->regbase + env->nwindows * 16, env->regbase);
53
uint32_t helper_le_ldl_cmmu(CPUArchState *env, target_ulong addr,
49
+ memcpy(env->regbase + env->nwindows * 16, env->regbase,
54
TCGMemOpIdx oi, uintptr_t retaddr);
50
+ sizeof(env->gregs));
55
uint64_t helper_le_ldq_cmmu(CPUArchState *env, target_ulong addr,
51
}
56
TCGMemOpIdx oi, uintptr_t retaddr);
52
env->regwptr = env->regbase + (new_cwp * 16);
57
-uint16_t helper_be_ldw_cmmu(CPUArchState *env, target_ulong addr,
58
- TCGMemOpIdx oi, uintptr_t retaddr);
59
+uint16_t helper_be_lduw_cmmu(CPUArchState *env, target_ulong addr,
60
+ TCGMemOpIdx oi, uintptr_t retaddr);
61
+int16_t helper_be_ldsw_cmmu(CPUArchState *env, target_ulong addr,
62
+ TCGMemOpIdx oi, uintptr_t retaddr);
63
uint32_t helper_be_ldl_cmmu(CPUArchState *env, target_ulong addr,
64
TCGMemOpIdx oi, uintptr_t retaddr);
65
uint64_t helper_be_ldq_cmmu(CPUArchState *env, target_ulong addr,
66
@@ -XXX,XX +XXX,XX @@ uint64_t helper_be_ldq_cmmu(CPUArchState *env, target_ulong addr,
67
# define helper_ret_stw_mmu helper_be_stw_mmu
68
# define helper_ret_stl_mmu helper_be_stl_mmu
69
# define helper_ret_stq_mmu helper_be_stq_mmu
70
-# define helper_ret_ldw_cmmu helper_be_ldw_cmmu
71
+# define helper_ret_lduw_cmmu helper_be_lduw_cmmu
72
+# define helper_ret_ldsw_cmmu helper_be_ldsw_cmmu
73
# define helper_ret_ldl_cmmu helper_be_ldl_cmmu
74
# define helper_ret_ldq_cmmu helper_be_ldq_cmmu
75
#else
76
@@ -XXX,XX +XXX,XX @@ uint64_t helper_be_ldq_cmmu(CPUArchState *env, target_ulong addr,
77
# define helper_ret_stw_mmu helper_le_stw_mmu
78
# define helper_ret_stl_mmu helper_le_stl_mmu
79
# define helper_ret_stq_mmu helper_le_stq_mmu
80
-# define helper_ret_ldw_cmmu helper_le_ldw_cmmu
81
+# define helper_ret_lduw_cmmu helper_le_lduw_cmmu
82
+# define helper_ret_ldsw_cmmu helper_le_ldsw_cmmu
83
# define helper_ret_ldl_cmmu helper_le_ldl_cmmu
84
# define helper_ret_ldq_cmmu helper_le_ldq_cmmu
85
#endif
86
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
87
index XXXXXXX..XXXXXXX 100644
88
--- a/accel/tcg/cputlb.c
89
+++ b/accel/tcg/cputlb.c
90
@@ -XXX,XX +XXX,XX @@ static uint64_t full_ldub_cmmu(CPUArchState *env, target_ulong addr,
91
return load_helper(env, addr, oi, retaddr, MO_8, true, full_ldub_cmmu);
92
}
53
}
93
54
@@ -XXX,XX +XXX,XX @@ void cpu_gl_switch_gregs(CPUSPARCState *env, uint32_t new_gl)
94
-uint8_t helper_ret_ldb_cmmu(CPUArchState *env, target_ulong addr,
55
dst = get_gl_gregset(env, env->gl);
95
+uint8_t helper_ret_ldub_cmmu(CPUArchState *env, target_ulong addr,
56
96
TCGMemOpIdx oi, uintptr_t retaddr)
57
if (src != dst) {
97
{
58
- memcpy32(dst, env->gregs);
98
return full_ldub_cmmu(env, addr, oi, retaddr);
59
- memcpy32(env->gregs, src);
60
+ memcpy(dst, env->gregs, sizeof(env->gregs));
61
+ memcpy(env->gregs, src, sizeof(env->gregs));
62
}
99
}
63
}
100
64
101
+int8_t helper_ret_ldsb_cmmu(CPUArchState *env, target_ulong addr,
65
@@ -XXX,XX +XXX,XX @@ void cpu_change_pstate(CPUSPARCState *env, uint32_t new_pstate)
102
+ TCGMemOpIdx oi, uintptr_t retaddr)
66
/* Switch global register bank */
103
+{
67
src = get_gregset(env, new_pstate_regs);
104
+ return (int8_t) full_ldub_cmmu(env, addr, oi, retaddr);
68
dst = get_gregset(env, pstate_regs);
105
+}
69
- memcpy32(dst, env->gregs);
106
+
70
- memcpy32(env->gregs, src);
107
static uint64_t full_le_lduw_cmmu(CPUArchState *env, target_ulong addr,
71
+ memcpy(dst, env->gregs, sizeof(env->gregs));
108
TCGMemOpIdx oi, uintptr_t retaddr)
72
+ memcpy(env->gregs, src, sizeof(env->gregs));
109
{
73
} else {
110
@@ -XXX,XX +XXX,XX @@ static uint64_t full_le_lduw_cmmu(CPUArchState *env, target_ulong addr,
74
trace_win_helper_no_switch_pstate(new_pstate_regs);
111
full_le_lduw_cmmu);
75
}
112
}
113
114
-uint16_t helper_le_ldw_cmmu(CPUArchState *env, target_ulong addr,
115
+uint16_t helper_le_lduw_cmmu(CPUArchState *env, target_ulong addr,
116
TCGMemOpIdx oi, uintptr_t retaddr)
117
{
118
return full_le_lduw_cmmu(env, addr, oi, retaddr);
119
}
120
121
+int16_t helper_le_ldsw_cmmu(CPUArchState *env, target_ulong addr,
122
+ TCGMemOpIdx oi, uintptr_t retaddr)
123
+{
124
+ return (int16_t) full_le_lduw_cmmu(env, addr, oi, retaddr);
125
+}
126
+
127
static uint64_t full_be_lduw_cmmu(CPUArchState *env, target_ulong addr,
128
TCGMemOpIdx oi, uintptr_t retaddr)
129
{
130
@@ -XXX,XX +XXX,XX @@ static uint64_t full_be_lduw_cmmu(CPUArchState *env, target_ulong addr,
131
full_be_lduw_cmmu);
132
}
133
134
-uint16_t helper_be_ldw_cmmu(CPUArchState *env, target_ulong addr,
135
+uint16_t helper_be_lduw_cmmu(CPUArchState *env, target_ulong addr,
136
TCGMemOpIdx oi, uintptr_t retaddr)
137
{
138
return full_be_lduw_cmmu(env, addr, oi, retaddr);
139
}
140
141
+int16_t helper_be_ldsw_cmmu(CPUArchState *env, target_ulong addr,
142
+ TCGMemOpIdx oi, uintptr_t retaddr)
143
+{
144
+ return (int16_t) full_be_lduw_cmmu(env, addr, oi, retaddr);
145
+}
146
+
147
static uint64_t full_le_ldul_cmmu(CPUArchState *env, target_ulong addr,
148
TCGMemOpIdx oi, uintptr_t retaddr)
149
{
150
diff --git a/target/cris/translate_v10.inc.c b/target/cris/translate_v10.inc.c
151
index XXXXXXX..XXXXXXX 100644
152
--- a/target/cris/translate_v10.inc.c
153
+++ b/target/cris/translate_v10.inc.c
154
@@ -XXX,XX +XXX,XX @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc)
155
case CRISV10_IND_BCC_M:
156
157
cris_cc_mask(dc, 0);
158
- imm = cpu_ldsw_code(env, dc->pc + 2);
159
- simm = (int16_t)imm;
160
+ simm = cpu_ldsw_code(env, dc->pc + 2);
161
simm += 4;
162
163
LOG_DIS("bcc_m: b%s %x\n", cc_name(dc->cond), dc->pc + simm);
164
--
76
--
165
2.17.1
77
2.43.0
166
78
167
79
diff view generated by jsdifflib
Deleted patch
1
From: Wei Yang <richardw.yang@linux.intel.com>
2
1
3
Use ROUND_UP() to define, which is a little bit easy to read.
4
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
7
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
8
Reviewed-by: Juan Quintela <quintela@redhat.com>
9
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
10
Message-Id: <20191013021145.16011-2-richardw.yang@linux.intel.com>
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
---
13
include/exec/cpu-all.h | 7 +++----
14
1 file changed, 3 insertions(+), 4 deletions(-)
15
16
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/include/exec/cpu-all.h
19
+++ b/include/exec/cpu-all.h
20
@@ -XXX,XX +XXX,XX @@ extern int target_page_bits;
21
22
#define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS)
23
#define TARGET_PAGE_MASK ~(TARGET_PAGE_SIZE - 1)
24
-#define TARGET_PAGE_ALIGN(addr) (((addr) + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK)
25
+#define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE)
26
27
/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
28
* when intptr_t is 32-bit and we are aligning a long long.
29
@@ -XXX,XX +XXX,XX @@ extern int target_page_bits;
30
extern uintptr_t qemu_host_page_size;
31
extern intptr_t qemu_host_page_mask;
32
33
-#define HOST_PAGE_ALIGN(addr) (((addr) + qemu_host_page_size - 1) & qemu_host_page_mask)
34
-#define REAL_HOST_PAGE_ALIGN(addr) (((addr) + qemu_real_host_page_size - 1) & \
35
- qemu_real_host_page_mask)
36
+#define HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_host_page_size)
37
+#define REAL_HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_real_host_page_size)
38
39
/* same as PROT_xxx */
40
#define PAGE_READ 0x0001
41
--
42
2.17.1
43
44
diff view generated by jsdifflib
Deleted patch
1
Such support is present almost everywhere, except for Xcode 9.
2
It is added in Xcode 10, but travis uses xcode9 by default,
3
so we should support it for a while yet.
4
1
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
---
8
configure | 19 +++++++++++++++++++
9
1 file changed, 19 insertions(+)
10
11
diff --git a/configure b/configure
12
index XXXXXXX..XXXXXXX 100755
13
--- a/configure
14
+++ b/configure
15
@@ -XXX,XX +XXX,XX @@ if compile_prog "" "" ; then
16
vector16=yes
17
fi
18
19
+########################################
20
+# See if __attribute__((alias)) is supported.
21
+# This false for Xcode 9, but has been remedied for Xcode 10.
22
+# Unfortunately, travis uses Xcode 9 by default.
23
+
24
+attralias=no
25
+cat > $TMPC << EOF
26
+int x = 1;
27
+extern const int y __attribute__((alias("x")));
28
+int main(void) { return 0; }
29
+EOF
30
+if compile_prog "" "" ; then
31
+ attralias=yes
32
+fi
33
+
34
########################################
35
# check if getauxval is available.
36
37
@@ -XXX,XX +XXX,XX @@ if test "$vector16" = "yes" ; then
38
echo "CONFIG_VECTOR16=y" >> $config_host_mak
39
fi
40
41
+if test "$attralias" = "yes" ; then
42
+ echo "CONFIG_ATTRIBUTE_ALIAS=y" >> $config_host_mak
43
+fi
44
+
45
if test "$getauxval" = "yes" ; then
46
echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
47
fi
48
--
49
2.17.1
50
51
diff view generated by jsdifflib
Deleted patch
1
Using a variable that is declared "const" for this tells the
2
compiler that it may read the value once and assume that it
3
does not change across function calls.
4
1
5
For target_page_size, this means we have only one assert per
6
function, and one read of the variable.
7
8
This reduces the size of qemu-system-aarch64 by 8k.
9
10
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
11
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
---
14
include/exec/cpu-all.h | 14 +++++++---
15
exec-vary.c | 60 ++++++++++++++++++++++++++++++++++++------
16
2 files changed, 62 insertions(+), 12 deletions(-)
17
18
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/include/exec/cpu-all.h
21
+++ b/include/exec/cpu-all.h
22
@@ -XXX,XX +XXX,XX @@ static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val
23
/* page related stuff */
24
25
#ifdef TARGET_PAGE_BITS_VARY
26
-extern bool target_page_bits_decided;
27
-extern int target_page_bits;
28
-#define TARGET_PAGE_BITS ({ assert(target_page_bits_decided); \
29
- target_page_bits; })
30
+typedef struct {
31
+ bool decided;
32
+ int bits;
33
+} TargetPageBits;
34
+# if defined(CONFIG_ATTRIBUTE_ALIAS) || !defined(IN_EXEC_VARY)
35
+extern const TargetPageBits target_page;
36
+#else
37
+extern TargetPageBits target_page;
38
+# endif
39
+#define TARGET_PAGE_BITS (assert(target_page.decided), target_page.bits)
40
#else
41
#define TARGET_PAGE_BITS_MIN TARGET_PAGE_BITS
42
#endif
43
diff --git a/exec-vary.c b/exec-vary.c
44
index XXXXXXX..XXXXXXX 100644
45
--- a/exec-vary.c
46
+++ b/exec-vary.c
47
@@ -XXX,XX +XXX,XX @@
48
49
#include "qemu/osdep.h"
50
#include "qemu-common.h"
51
+
52
+#define IN_EXEC_VARY 1
53
+
54
#include "exec/exec-all.h"
55
56
#ifdef TARGET_PAGE_BITS_VARY
57
-int target_page_bits;
58
-bool target_page_bits_decided;
59
+# ifdef CONFIG_ATTRIBUTE_ALIAS
60
+/*
61
+ * We want to declare the "target_page" variable as const, which tells
62
+ * the compiler that it can cache any value that it reads across calls.
63
+ * This avoids multiple assertions and multiple reads within any one user.
64
+ *
65
+ * This works because we initialize the target_page data very early, in a
66
+ * location far removed from the functions that require the final results.
67
+ *
68
+ * This also requires that we have a non-constant symbol by which we can
69
+ * perform the actual initialization, and which forces the data to be
70
+ * allocated within writable memory. Thus "init_target_page", and we use
71
+ * that symbol exclusively in the two functions that initialize this value.
72
+ *
73
+ * The "target_page" symbol is created as an alias of "init_target_page".
74
+ */
75
+static TargetPageBits init_target_page;
76
+
77
+/*
78
+ * Note that this is *not* a redundant decl, this is the definition of
79
+ * the "target_page" symbol. The syntax for this definition requires
80
+ * the use of the extern keyword. This seems to be a GCC bug in
81
+ * either the syntax for the alias attribute or in -Wredundant-decls.
82
+ *
83
+ * See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91765
84
+ */
85
+# pragma GCC diagnostic push
86
+# pragma GCC diagnostic ignored "-Wredundant-decls"
87
+
88
+extern const TargetPageBits target_page
89
+ __attribute__((alias("init_target_page")));
90
+
91
+# pragma GCC diagnostic pop
92
+# else
93
+/*
94
+ * When aliases are not supported then we force two different declarations,
95
+ * by way of suppressing the header declaration with IN_EXEC_VARY.
96
+ * We assume that on such an old compiler, LTO cannot be used, and so the
97
+ * compiler cannot not detect the mismatched declarations, and all is well.
98
+ */
99
+TargetPageBits target_page;
100
+# define init_target_page target_page
101
+# endif
102
#endif
103
104
bool set_preferred_target_page_bits(int bits)
105
@@ -XXX,XX +XXX,XX @@ bool set_preferred_target_page_bits(int bits)
106
*/
107
#ifdef TARGET_PAGE_BITS_VARY
108
assert(bits >= TARGET_PAGE_BITS_MIN);
109
- if (target_page_bits == 0 || target_page_bits > bits) {
110
- if (target_page_bits_decided) {
111
+ if (init_target_page.bits == 0 || init_target_page.bits > bits) {
112
+ if (init_target_page.decided) {
113
return false;
114
}
115
- target_page_bits = bits;
116
+ init_target_page.bits = bits;
117
}
118
#endif
119
return true;
120
@@ -XXX,XX +XXX,XX @@ bool set_preferred_target_page_bits(int bits)
121
void finalize_target_page_bits(void)
122
{
123
#ifdef TARGET_PAGE_BITS_VARY
124
- if (target_page_bits == 0) {
125
- target_page_bits = TARGET_PAGE_BITS_MIN;
126
+ if (init_target_page.bits == 0) {
127
+ init_target_page.bits = TARGET_PAGE_BITS_MIN;
128
}
129
- target_page_bits_decided = true;
130
+ init_target_page.decided = true;
131
#endif
132
}
133
--
134
2.17.1
135
136
diff view generated by jsdifflib
Deleted patch
1
This reduces the size of a release build by about 10k.
2
Noticably, within the tlb miss helpers.
3
1
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
---
9
include/exec/cpu-all.h | 6 +++++-
10
1 file changed, 5 insertions(+), 1 deletion(-)
11
12
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
13
index XXXXXXX..XXXXXXX 100644
14
--- a/include/exec/cpu-all.h
15
+++ b/include/exec/cpu-all.h
16
@@ -XXX,XX +XXX,XX @@ extern const TargetPageBits target_page;
17
#else
18
extern TargetPageBits target_page;
19
# endif
20
-#define TARGET_PAGE_BITS (assert(target_page.decided), target_page.bits)
21
+# ifdef CONFIG_DEBUG_TCG
22
+# define TARGET_PAGE_BITS (assert(target_page.decided), target_page.bits)
23
+# else
24
+# define TARGET_PAGE_BITS target_page.bits
25
+# endif
26
#else
27
#define TARGET_PAGE_BITS_MIN TARGET_PAGE_BITS
28
#endif
29
--
30
2.17.1
31
32
diff view generated by jsdifflib
Deleted patch
1
There are some uint64_t uses that expect TARGET_PAGE_MASK to
2
extend for a 32-bit, so this must continue to be a signed type.
3
Define based on TARGET_PAGE_BITS not TARGET_PAGE_SIZE; this
4
will make a following patch more clear.
5
1
6
This should not have a functional effect so far.
7
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
---
12
include/exec/cpu-all.h | 2 +-
13
1 file changed, 1 insertion(+), 1 deletion(-)
14
15
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
16
index XXXXXXX..XXXXXXX 100644
17
--- a/include/exec/cpu-all.h
18
+++ b/include/exec/cpu-all.h
19
@@ -XXX,XX +XXX,XX @@ extern TargetPageBits target_page;
20
#endif
21
22
#define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS)
23
-#define TARGET_PAGE_MASK ~(TARGET_PAGE_SIZE - 1)
24
+#define TARGET_PAGE_MASK ((target_long)-1 << TARGET_PAGE_BITS)
25
#define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE)
26
27
/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
28
--
29
2.17.1
30
31
diff view generated by jsdifflib
Deleted patch
1
This eliminates a set of runtime shifts. It turns out that we
2
require TARGET_PAGE_MASK more often than TARGET_PAGE_SIZE, so
3
redefine TARGET_PAGE_SIZE based on TARGET_PAGE_MASK instead of
4
the other way around.
5
1
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Reviewed-by: David Hildenbrand <david@redhat.com>
8
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
---
11
include/exec/cpu-all.h | 8 ++++++--
12
exec-vary.c | 1 +
13
2 files changed, 7 insertions(+), 2 deletions(-)
14
15
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
16
index XXXXXXX..XXXXXXX 100644
17
--- a/include/exec/cpu-all.h
18
+++ b/include/exec/cpu-all.h
19
@@ -XXX,XX +XXX,XX @@ static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val
20
typedef struct {
21
bool decided;
22
int bits;
23
+ target_long mask;
24
} TargetPageBits;
25
# if defined(CONFIG_ATTRIBUTE_ALIAS) || !defined(IN_EXEC_VARY)
26
extern const TargetPageBits target_page;
27
@@ -XXX,XX +XXX,XX @@ extern TargetPageBits target_page;
28
# endif
29
# ifdef CONFIG_DEBUG_TCG
30
# define TARGET_PAGE_BITS (assert(target_page.decided), target_page.bits)
31
+# define TARGET_PAGE_MASK (assert(target_page.decided), target_page.mask)
32
# else
33
# define TARGET_PAGE_BITS target_page.bits
34
+# define TARGET_PAGE_MASK target_page.mask
35
# endif
36
+# define TARGET_PAGE_SIZE (-(int)TARGET_PAGE_MASK)
37
#else
38
#define TARGET_PAGE_BITS_MIN TARGET_PAGE_BITS
39
+#define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS)
40
+#define TARGET_PAGE_MASK ((target_long)-1 << TARGET_PAGE_BITS)
41
#endif
42
43
-#define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS)
44
-#define TARGET_PAGE_MASK ((target_long)-1 << TARGET_PAGE_BITS)
45
#define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE)
46
47
/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
48
diff --git a/exec-vary.c b/exec-vary.c
49
index XXXXXXX..XXXXXXX 100644
50
--- a/exec-vary.c
51
+++ b/exec-vary.c
52
@@ -XXX,XX +XXX,XX @@ void finalize_target_page_bits(void)
53
init_target_page.bits = TARGET_PAGE_BITS_MIN;
54
}
55
init_target_page.decided = true;
56
+ init_target_page.mask = (target_long)-1 << init_target_page.bits;
57
#endif
58
}
59
--
60
2.17.1
61
62
diff view generated by jsdifflib
Deleted patch
1
From: Clement Deschamps <clement.deschamps@greensocs.com>
2
1
3
This fixes a segmentation fault in icount mode when executing
4
from an IO region.
5
6
TB is marked as CF_NOCACHE but tb->orig_tb is not initialized
7
(equals previous value in code_gen_buffer).
8
9
The issue happens in cpu_io_recompile() when it tries to invalidate orig_tb.
10
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Signed-off-by: Clement Deschamps <clement.deschamps@greensocs.com>
13
Message-Id: <20191022140016.918371-1-clement.deschamps@greensocs.com>
14
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
15
---
16
accel/tcg/translate-all.c | 1 +
17
1 file changed, 1 insertion(+)
18
19
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/accel/tcg/translate-all.c
22
+++ b/accel/tcg/translate-all.c
23
@@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu,
24
tb->cs_base = cs_base;
25
tb->flags = flags;
26
tb->cflags = cflags;
27
+ tb->orig_tb = NULL;
28
tb->trace_vcpu_dstate = *cpu->trace_dstate;
29
tcg_ctx->tb_cflags = cflags;
30
tb_overflow:
31
--
32
2.17.1
33
34
diff view generated by jsdifflib