[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/13] i386: run accel_cpu_instance_init as post_init
From: |
Paolo Bonzini |
Subject: |
[PULL 10/13] i386: run accel_cpu_instance_init as post_init |
Date: |
Fri, 4 Jun 2021 17:17:42 +0200 |
From: Claudio Fontana <cfontana@suse.de>
This fixes host and max cpu initialization, by running the accel cpu
initialization only after all instance init functions are called for all
X86 cpu subclasses.
The bug this is fixing is related to the "max" and "host" i386 cpu
subclasses, which set cpu->max_features, which is then used at cpu
realization time.
In order to properly split the accel-specific max features code that
needs to be executed at cpu instance initialization time,
we cannot call the accel cpu initialization at the end of the x86 base
class initialization, or we will have no way to specialize
"max features" cpu behavior, overriding the "max" cpu class defaults,
and checking for the "max features" flag itself.
This patch moves the accel-specific cpu instance initialization to after
all x86 cpu instance code has been executed, including subclasses,
so that proper initialization of cpu "host" and "max" can be restored.
Fixes: f5cc5a5c ("i386: split cpu accelerators from cpu.c,"...)
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Claudio Fontana <cfontana@suse.de>
Message-Id: <20210603123001.17843-3-cfontana@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/cpu.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 9c47daa409..a9fe1662d3 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6401,6 +6401,11 @@ static void
x86_cpu_register_feature_bit_props(X86CPUClass *xcc,
x86_cpu_register_bit_prop(xcc, name, w, bitnr);
}
+static void x86_cpu_post_initfn(Object *obj)
+{
+ accel_cpu_instance_init(CPU(obj));
+}
+
static void x86_cpu_initfn(Object *obj)
{
X86CPU *cpu = X86_CPU(obj);
@@ -6452,9 +6457,6 @@ static void x86_cpu_initfn(Object *obj)
if (xcc->model) {
x86_cpu_load_model(cpu, xcc->model);
}
-
- /* if required, do accelerator-specific cpu initializations */
- accel_cpu_instance_init(CPU(obj));
}
static int64_t x86_cpu_get_arch_id(CPUState *cs)
@@ -6799,6 +6801,8 @@ static const TypeInfo x86_cpu_type_info = {
.parent = TYPE_CPU,
.instance_size = sizeof(X86CPU),
.instance_init = x86_cpu_initfn,
+ .instance_post_init = x86_cpu_post_initfn,
+
.abstract = true,
.class_size = sizeof(X86CPUClass),
.class_init = x86_cpu_common_class_init,
--
2.31.1
- [PULL 01/13] meson: allow optional dependencies for block modules, (continued)
- [PULL 01/13] meson: allow optional dependencies for block modules, Paolo Bonzini, 2021/06/04
- [PULL 03/13] oslib-posix: Remove OpenBSD workaround for fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure, Paolo Bonzini, 2021/06/04
- [PULL 04/13] target/i386: tcg: fix segment register offsets for 16-bit TSS, Paolo Bonzini, 2021/06/04
- [PULL 05/13] target/i386: tcg: fix loading of registers from 16-bit TSS, Paolo Bonzini, 2021/06/04
- [PULL 08/13] tests/qtest/virtio-scsi-test: add unmap large LBA with 4k blocks test, Paolo Bonzini, 2021/06/04
- [PULL 07/13] target/i386: Fix decode of cr8, Paolo Bonzini, 2021/06/04
- [PULL 06/13] target/i386: tcg: fix switching from 16-bit to 32-bit tasks or vice versa, Paolo Bonzini, 2021/06/04
- [PULL 09/13] i386: reorder call to cpu_exec_realizefn, Paolo Bonzini, 2021/06/04
- [PULL 12/13] vl: plumb keyval-based options into -readconfig, Paolo Bonzini, 2021/06/04
- [PULL 10/13] i386: run accel_cpu_instance_init as post_init,
Paolo Bonzini <=
- [PULL 11/13] qemu-config: parse configuration files to a QDict, Paolo Bonzini, 2021/06/04
- [PULL 13/13] vl: plug -object back into -readconfig, Paolo Bonzini, 2021/06/04
- Re: [PULL 00/13] Misc bugfix patches for 2021-06-04, Peter Maydell, 2021/06/05