qemu/target
Peter Maydell c4487d76d5 target/arm: Query host CPU features on-demand at instance init
Currently we query the host CPU features in the class init function
for the TYPE_ARM_HOST_CPU class, so that we can later copy them
from the class object into the instance object in the object
instance init function. This is awkward for implementing "-cpu max",
which should work like "-cpu host" for KVM but like "cpu with all
implemented features" for TCG.

Move the place where we store the information about the host CPU from
a class object to static variables in kvm.c, and then in the instance
init function call a new kvm_arm_set_cpu_features_from_host()
function which will query the host kernel if necessary and then
fill in the CPU instance fields.

This allows us to drop the special class struct and class init
function for TYPE_ARM_HOST_CPU entirely.

We can't delay the probe until realize, because the ARM
instance_post_init hook needs to look at the feature bits we
set, so we need to do it in the initfn. This is safe because
the probing doesn't affect the actual VM state (it creates a
separate scratch VM to do its testing), but the probe might fail.
Because we can't report errors in retrieving the host features
in the initfn, we check this belatedly in the realize function
(the intervening code will be able to cope with the relevant
fields in the CPU structure being zero).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20180308130626.12393-2-peter.maydell@linaro.org
2018-03-09 17:09:44 +00:00
..
alpha target/*/cpu.h: remove softfloat.h 2018-02-21 10:20:24 +00:00
arm target/arm: Query host CPU features on-demand at instance init 2018-03-09 17:09:44 +00:00
cris qdev: use device_class_set_parent_realize/unrealize/reset() 2018-02-05 13:54:38 +01:00
hppa target/*/cpu.h: remove softfloat.h 2018-02-21 10:20:24 +00:00
i386 WHPX improve interrupt notification registration 2018-03-06 14:01:29 +01:00
lm32 qdev: use device_class_set_parent_realize/unrealize/reset() 2018-02-05 13:54:38 +01:00
m68k target/m68k: add fscale, fgetman and fgetexp 2018-03-04 17:27:59 +01:00
microblaze target/*/cpu.h: remove softfloat.h 2018-02-21 10:20:24 +00:00
mips qdev: use device_class_set_parent_realize/unrealize/reset() 2018-02-05 13:54:38 +01:00
moxie target/*/cpu.h: remove softfloat.h 2018-02-21 10:20:24 +00:00
nios2 target/*/cpu.h: remove softfloat.h 2018-02-21 10:20:24 +00:00
openrisc target/*/cpu.h: remove softfloat.h 2018-02-21 10:20:24 +00:00
ppc PowerPC: Add TS bits into msr_mask 2018-03-06 13:16:29 +11:00
riscv RISC-V Build Infrastructure 2018-03-07 08:30:28 +13:00
s390x target/s390x: Remove leading underscores from #defines 2018-03-08 15:49:23 +01:00
sh4 target/*/cpu.h: remove softfloat.h 2018-02-21 10:20:24 +00:00
sparc sparc: fix leon3 casa instruction when MMU is disabled 2018-03-08 07:22:03 +00:00
tilegx qdev: use device_class_set_parent_realize/unrealize/reset() 2018-02-05 13:54:38 +01:00
tricore tricore: renamed masking of PIE 2018-03-02 11:46:36 +01:00
unicore32 ui/curses: build as module 2018-03-05 08:44:11 +01:00
xtensa target/*/cpu.h: remove softfloat.h 2018-02-21 10:20:24 +00:00