diff options
| author | Alex Bennée <alex.bennee@linaro.org> | 2024-05-30 20:42:47 +0100 |
|---|---|---|
| committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2024-06-04 10:02:39 +0200 |
| commit | a4c2735f35b8b2bca5784ff9bf754a99b654c9a8 (patch) | |
| tree | 5eac56cd5d5602122b8289d128f0ff12597da082 /hw/core/cpu-common.c | |
| parent | b8a208ccf51013a88eb410a7820a4951834a913f (diff) | |
| download | focaccia-qemu-a4c2735f35b8b2bca5784ff9bf754a99b654c9a8.tar.gz focaccia-qemu-a4c2735f35b8b2bca5784ff9bf754a99b654c9a8.zip | |
cpu: move Qemu[Thread|Cond] setup into common code
Aside from the round robin threads this is all common code. By moving the halt_cond setup we also no longer need hacks to work around the race between QOM object creation and thread creation. It is a little ugly to free stuff up for the round robin thread but better it deal with its own specialises than making the other accelerators jump through hoops. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-ID: <20240530194250.1801701-3-alex.bennee@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'hw/core/cpu-common.c')
| -rw-r--r-- | hw/core/cpu-common.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 0f0a247f56..6cfc01593a 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -261,6 +261,11 @@ static void cpu_common_initfn(Object *obj) cpu->nr_threads = 1; cpu->cflags_next_tb = -1; + /* allocate storage for thread info, initialise condition variables */ + cpu->thread = g_new0(QemuThread, 1); + cpu->halt_cond = g_new0(QemuCond, 1); + qemu_cond_init(cpu->halt_cond); + qemu_mutex_init(&cpu->work_mutex); qemu_lockcnt_init(&cpu->in_ioctl_lock); QSIMPLEQ_INIT(&cpu->work_list); |