aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kvm/arm.c
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@linaro.org>2013-04-17 06:52:01 -0400
committerChristoffer Dall <cdall@cs.columbia.edu>2013-04-29 01:23:23 -0400
commitd4e071ce6acf8d5eddb7615a953193a8b0ad7c38 (patch)
tree13dd45233d5d1cf0a579629128ab8aa386552456 /arch/arm/kvm/arm.c
parentdf759217386fcff9c5e45547d1578270fd592a1b (diff)
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>
Diffstat (limited to 'arch/arm/kvm/arm.c')
-rw-r--r--arch/arm/kvm/arm.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 089c0a40514c..5bc99b452b04 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -947,21 +947,30 @@ out_err:
947 return err; 947 return err;
948} 948}
949 949
950static void check_kvm_target_cpu(void *ret)
951{
952 *(int *)ret = kvm_target_cpu();
953}
954
950/** 955/**
951 * Initialize Hyp-mode and memory mappings on all CPUs. 956 * Initialize Hyp-mode and memory mappings on all CPUs.
952 */ 957 */
953int kvm_arch_init(void *opaque) 958int kvm_arch_init(void *opaque)
954{ 959{
955 int err; 960 int err;
961 int ret, cpu;
956 962
957 if (!is_hyp_mode_available()) { 963 if (!is_hyp_mode_available()) {
958 kvm_err("HYP mode not available\n"); 964 kvm_err("HYP mode not available\n");
959 return -ENODEV; 965 return -ENODEV;
960 } 966 }
961 967
962 if (kvm_target_cpu() < 0) { 968 for_each_online_cpu(cpu) {
963 kvm_err("Target CPU not supported!\n"); 969 smp_call_function_single(cpu, check_kvm_target_cpu, &ret, 1);
964 return -ENODEV; 970 if (ret < 0) {
971 kvm_err("Error, CPU %d not supported!\n", cpu);
972 return -ENODEV;
973 }
965 } 974 }
966 975
967 err = init_hyp_mode(); 976 err = init_hyp_mode();