diff options
author | Like Xu <like.xu@linux.intel.com> | 2019-05-19 04:54:21 +0800 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2019-07-05 17:07:36 -0300 |
commit | 5cc8767d05708f590eea926a2f7a2c1a80021fa7 (patch) | |
tree | 98da97b39d3ec270eea31f88f9bd367cb8eadd3c /cpus.c | |
parent | a0628599fa72524a1f59bbaa7410e6825a8feb3f (diff) | |
download | qemu-5cc8767d05708f590eea926a2f7a2c1a80021fa7.zip qemu-5cc8767d05708f590eea926a2f7a2c1a80021fa7.tar.gz qemu-5cc8767d05708f590eea926a2f7a2c1a80021fa7.tar.bz2 |
general: Replace global smp variables with smp machine properties
Basically, the context could get the MachineState reference via call
chains or unrecommended qdev_get_machine() in !CONFIG_USER_ONLY mode.
A local variable of the same name would be introduced in the declaration
phase out of less effort OR replace it on the spot if it's only used
once in the context. No semantic changes.
Signed-off-by: Like Xu <like.xu@linux.intel.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20190518205428.90532-4-like.xu@linux.intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'cpus.c')
-rw-r--r-- | cpus.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -54,6 +54,7 @@ #include "tcg.h" #include "hw/nmi.h" #include "sysemu/replay.h" +#include "hw/boards.h" #ifdef CONFIG_LINUX @@ -2075,8 +2076,10 @@ static void qemu_dummy_start_vcpu(CPUState *cpu) void qemu_init_vcpu(CPUState *cpu) { - cpu->nr_cores = smp_cores; - cpu->nr_threads = smp_threads; + MachineState *ms = MACHINE(qdev_get_machine()); + + cpu->nr_cores = ms->smp.cores; + cpu->nr_threads = ms->smp.threads; cpu->stopped = true; cpu->random_seed = qemu_guest_random_seed_thread_part1(); |