mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
i386: reorder call to cpu_exec_realizefn
i386 realizefn code is sensitive to ordering, and recent commits aimed at refactoring it, splitting accelerator-specific code, broke assumptions which need to be fixed. We need to: * process hyper-v enlightements first, as they assume features not to be expanded * only then, expand features * after expanding features, attempt to check them and modify them in the accel-specific realizefn code called by cpu_exec_realizefn(). * after the framework has been called via cpu_exec_realizefn, the code can check for what has or hasn't been set by accel-specific code, or extend its results, ie: - check and evenually set code_urev default - modify cpu->mwait after potentially being set from host CPUID. - finally check for phys_bits assuming all user and accel-specific adjustments have already been taken into account. Fixes:f5cc5a5c
("i386: split cpu accelerators from cpu.c"...) Fixes:30565f10
("cpu: call AccelCPUClass::cpu_realizefn in"...) Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: Vitaly Kuznetsov <vkuznets@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Claudio Fontana <cfontana@suse.de> Message-Id: <20210603123001.17843-2-cfontana@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
6b731a96aa
commit
662175b91f
2 changed files with 61 additions and 30 deletions
|
@ -26,10 +26,18 @@ static bool kvm_cpu_realizefn(CPUState *cs, Error **errp)
|
|||
/*
|
||||
* The realize order is important, since x86_cpu_realize() checks if
|
||||
* nothing else has been set by the user (or by accelerators) in
|
||||
* cpu->ucode_rev and cpu->phys_bits.
|
||||
* cpu->ucode_rev and cpu->phys_bits, and updates the CPUID results in
|
||||
* mwait.ecx.
|
||||
* This accel realization code also assumes cpu features are already expanded.
|
||||
*
|
||||
* realize order:
|
||||
* kvm_cpu -> host_cpu -> x86_cpu
|
||||
*
|
||||
* x86_cpu_realize():
|
||||
* -> x86_cpu_expand_features()
|
||||
* -> cpu_exec_realizefn():
|
||||
* -> accel_cpu_realizefn()
|
||||
* kvm_cpu_realizefn() -> host_cpu_realizefn()
|
||||
* -> check/update ucode_rev, phys_bits, mwait
|
||||
*/
|
||||
if (cpu->max_features) {
|
||||
if (enable_cpu_pm && kvm_has_waitpkg()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue