On 26 January 2018 at 14:29, Philippe Mathieu-Daudé <f4...@amsat.org> wrote: > Hi Peter, > > On 12/07/2017 03:14 PM, Peter Maydell wrote: >> Add support for "-cpu max" for ARM guests. This CPU type behaves >> like "-cpu host" when KVM is enabled, and like a system CPU with >> the maximum possible feature set otherwise. (Note that this means >> it won't be migratable across versions, as we will likely add >> features to it in future.) >> >> Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> >> ---
>> +#ifndef TARGET_AARCH64 >> +/* -cpu max: if KVM is enabled, like -cpu host (best possible with this >> host); >> + * otherwise, a CPU with as many features enabled as our emulation supports. >> + * The version of '-cpu max' for qemu-system-aarch64 is defined in cpu64.c; >> + * this only needs to handle 32 bits. >> + */ >> +static void arm_max_initfn(Object *obj) >> +{ >> + ARMCPU *cpu = ARM_CPU(obj); >> + >> + if (kvm_enabled()) { >> + kvm_arm_set_cpu_features_from_host(cpu); >> + } else { >> + cortex_a15_initfn(obj);> + /* In future we might add feature >> bits here even if the >> + * real-world A15 doesn't implement them. >> + */ > > Why not use arm_any_initfn() here? That function (and the 'any' cpu) are deliberately only included in the linux-user binaries, not the system-emulation binaries. (Also arm_any_initfn() only initializes userspace-visible stuff, it doesn't provide ID register values etc for kernel-visible things.) > Actually what seems cleaner is to move "any" features here, and kill the > "any" cpu, using "max" for this purpose. We can't kill 'any', that would break back-compatibility of command lines. thanks -- PMM