|
32 | 32 | #include "qemu/error-report.h"
|
33 | 33 | #include "qemu/accel.h"
|
34 | 34 | #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" |
35 | 40 |
|
36 | 41 | struct TCGState {
|
37 | 42 | AccelState parent_obj;
|
@@ -105,22 +110,29 @@ static void tcg_accel_instance_init(Object *obj)
|
105 | 110 |
|
106 | 111 | bool mttcg_enabled;
|
107 | 112 |
|
108 |
| -static int tcg_init(MachineState *ms) |
| 113 | +static int tcg_init_machine(MachineState *ms) |
109 | 114 | {
|
110 | 115 | 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 |
111 | 121 |
|
112 |
| - tcg_exec_init(s->tb_size * 1024 * 1024, s->splitwx_enabled); |
| 122 | + tcg_allowed = true; |
113 | 123 | mttcg_enabled = s->mttcg_enabled;
|
114 | 124 |
|
| 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) |
115 | 130 | /*
|
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. |
120 | 133 | */
|
121 |
| -#ifndef CONFIG_USER_ONLY |
122 |
| - tcg_region_init(); |
123 |
| -#endif /* !CONFIG_USER_ONLY */ |
| 134 | + tcg_prologue_init(tcg_ctx); |
| 135 | +#endif |
124 | 136 |
|
125 | 137 | return 0;
|
126 | 138 | }
|
@@ -200,7 +212,7 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data)
|
200 | 212 | {
|
201 | 213 | AccelClass *ac = ACCEL_CLASS(oc);
|
202 | 214 | ac->name = "tcg";
|
203 |
| - ac->init_machine = tcg_init; |
| 215 | + ac->init_machine = tcg_init_machine; |
204 | 216 | ac->allowed = &tcg_allowed;
|
205 | 217 |
|
206 | 218 | object_class_property_add_str(oc, "thread",
|
|
0 commit comments