ARM: KVM: iterate over all CPUs for CPU compatibility check
kvm_target_cpus() checks the compatibility of the used CPU with KVM, which is currently limited to ARM Cortex-A15 cores. However by calling it only once on any random CPU it assumes that all cores are the same, which is not necessarily the case (for example in Big.Little). [ I cut some of the commit message and changed the formatting of the code slightly to pass checkpatch and look more like the rest of the kvm/arm init code - Christoffer ] Signed-off-by: Andre Przywara <andre.przywara@linaro.org> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
This commit is contained in:
parent
df75921738
commit
d4e071ce6a
|
@ -947,21 +947,30 @@ out_err:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void check_kvm_target_cpu(void *ret)
|
||||||
|
{
|
||||||
|
*(int *)ret = kvm_target_cpu();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize Hyp-mode and memory mappings on all CPUs.
|
* Initialize Hyp-mode and memory mappings on all CPUs.
|
||||||
*/
|
*/
|
||||||
int kvm_arch_init(void *opaque)
|
int kvm_arch_init(void *opaque)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
int ret, cpu;
|
||||||
|
|
||||||
if (!is_hyp_mode_available()) {
|
if (!is_hyp_mode_available()) {
|
||||||
kvm_err("HYP mode not available\n");
|
kvm_err("HYP mode not available\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kvm_target_cpu() < 0) {
|
for_each_online_cpu(cpu) {
|
||||||
kvm_err("Target CPU not supported!\n");
|
smp_call_function_single(cpu, check_kvm_target_cpu, &ret, 1);
|
||||||
return -ENODEV;
|
if (ret < 0) {
|
||||||
|
kvm_err("Error, CPU %d not supported!\n", cpu);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = init_hyp_mode();
|
err = init_hyp_mode();
|
||||||
|
|
Loading…
Reference in New Issue