Skip to content

Commit fbe7919

Browse files
committed
Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-tcg-20210613' into staging
Clean up code_gen_buffer allocation. Add tcg_remove_ops_after. Fix tcg_constant_* documentation. Improve TB chaining documentation. Fix float32_exp2. Fix arm tcg_out_op function signature. # gpg: Signature made Mon 14 Jun 2021 02:12:35 BST # gpg: using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F # gpg: issuer "[email protected]" # gpg: Good signature from "Richard Henderson <[email protected]>" [full] # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A 05C0 64DF 38E8 AF7E 215F * remotes/rth-gitlab/tags/pull-tcg-20210613: (34 commits) docs/devel: Explain in more detail the TB chaining mechanisms softfloat: Fix tp init in float32_exp2 tcg/arm: Fix tcg_out_op function signature tcg: Fix documentation for tcg_constant_* vs tcg_temp_free_* tcg: Introduce tcg_remove_ops_after tcg: Move tcg_init_ctx and tcg_ctx from accel/tcg/ tcg: When allocating for !splitwx, begin with PROT_NONE tcg: Merge buffer protection and guard page protection tcg: Round the tb_size default from qemu_get_host_physmem util/osdep: Add qemu_mprotect_rw tcg: Sink qemu_madvise call to common code tcg: Return the map protection from alloc_code_gen_buffer tcg: Allocate code_gen_buffer into struct tcg_region_state tcg: Move in_code_gen_buffer and tests to region.c tcg: Tidy split_cross_256mb tcg: Tidy tcg_n_regions tcg: Rename region.start to region.after_prologue tcg: Replace region.end with region.total_size tcg: Move MAX_CODE_GEN_BUFFER_SIZE to tcg-target.h tcg: Introduce tcg_max_ctxs ... Signed-off-by: Peter Maydell <[email protected]>
2 parents 894fc4f + a5a8b84 commit fbe7919

27 files changed

+1268
-1092
lines changed

accel/tcg/internal.h

+2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc,
1616
int cflags);
1717

1818
void QEMU_NORETURN cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
19+
void page_init(void);
20+
void tb_htable_init(void);
1921

2022
#endif /* ACCEL_TCG_INTERNAL_H */

accel/tcg/tcg-all.c

+22-10
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
#include "qemu/error-report.h"
3333
#include "qemu/accel.h"
3434
#include "qapi/qapi-builtin-visit.h"
35+
#include "qemu/units.h"
36+
#if !defined(CONFIG_USER_ONLY)
37+
#include "hw/boards.h"
38+
#endif
39+
#include "internal.h"
3540

3641
struct TCGState {
3742
AccelState parent_obj;
@@ -105,22 +110,29 @@ static void tcg_accel_instance_init(Object *obj)
105110

106111
bool mttcg_enabled;
107112

108-
static int tcg_init(MachineState *ms)
113+
static int tcg_init_machine(MachineState *ms)
109114
{
110115
TCGState *s = TCG_STATE(current_accel());
116+
#ifdef CONFIG_USER_ONLY
117+
unsigned max_cpus = 1;
118+
#else
119+
unsigned max_cpus = ms->smp.max_cpus;
120+
#endif
111121

112-
tcg_exec_init(s->tb_size * 1024 * 1024, s->splitwx_enabled);
122+
tcg_allowed = true;
113123
mttcg_enabled = s->mttcg_enabled;
114124

125+
page_init();
126+
tb_htable_init();
127+
tcg_init(s->tb_size * MiB, s->splitwx_enabled, max_cpus);
128+
129+
#if defined(CONFIG_SOFTMMU)
115130
/*
116-
* Initialize TCG regions only for softmmu.
117-
*
118-
* This needs to be done later for user mode, because the prologue
119-
* generation needs to be delayed so that GUEST_BASE is already set.
131+
* There's no guest base to take into account, so go ahead and
132+
* initialize the prologue now.
120133
*/
121-
#ifndef CONFIG_USER_ONLY
122-
tcg_region_init();
123-
#endif /* !CONFIG_USER_ONLY */
134+
tcg_prologue_init(tcg_ctx);
135+
#endif
124136

125137
return 0;
126138
}
@@ -200,7 +212,7 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data)
200212
{
201213
AccelClass *ac = ACCEL_CLASS(oc);
202214
ac->name = "tcg";
203-
ac->init_machine = tcg_init;
215+
ac->init_machine = tcg_init_machine;
204216
ac->allowed = &tcg_allowed;
205217

206218
object_class_property_add_str(oc, "thread",

0 commit comments

Comments
 (0)