aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-04-10 16:58:56 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-04-10 16:58:56 +0100
commit555249a59e9cdd6b58da103aba5cf3a2d45c899f (patch)
treefb7fa2d4f6759c8b62cb3016b1b83f567f57d104 /hw
parent836b36af9340c42d5a6642070d99944329e388bc (diff)
parent0b47ec4b95ad1952e55e639711d442f8ec6e1345 (diff)
downloadqemu-555249a59e9cdd6b58da103aba5cf3a2d45c899f.zip
qemu-555249a59e9cdd6b58da103aba5cf3a2d45c899f.tar.gz
qemu-555249a59e9cdd6b58da103aba5cf3a2d45c899f.tar.bz2
Merge remote-tracking branch 'remotes/ehabkost-gl/tags/x86-next-pull-request' into staging
x86 and CPU bug fixes for 6.0-rc3 * Add missing features to EPYC-Rome CPU model (Babu Moger) * Fix crash with "-device ...-cpu-core,help" (Greg Kurz) # gpg: Signature made Fri 09 Apr 2021 21:20:18 BST # gpg: using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6 # gpg: issuer "ehabkost@redhat.com" # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full] # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost-gl/tags/x86-next-pull-request: cpu/core: Fix "help" of CPU core device types i386: Add missing cpu feature bits in EPYC-Rome model Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/cpu/core.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hw/cpu/core.c b/hw/cpu/core.c
index 92d3b2f..9876075 100644
--- a/hw/cpu/core.c
+++ b/hw/cpu/core.c
@@ -66,10 +66,16 @@ static void core_prop_set_nr_threads(Object *obj, Visitor *v, const char *name,
static void cpu_core_instance_init(Object *obj)
{
- MachineState *ms = MACHINE(qdev_get_machine());
CPUCore *core = CPU_CORE(obj);
- core->nr_threads = ms->smp.threads;
+ /*
+ * Only '-device something-cpu-core,help' can get us there before
+ * the machine has been created. We don't care to set nr_threads
+ * in this case since it isn't used afterwards.
+ */
+ if (current_machine) {
+ core->nr_threads = current_machine->smp.threads;
+ }
}
static void cpu_core_class_init(ObjectClass *oc, void *data)