@@ -1445,6 +1445,7 @@ void kvm_arch_hardware_disable(void);
int kvm_arch_hardware_setup(void *opaque);
void kvm_arch_hardware_unsetup(void);
int kvm_arch_check_processor_compat(void);
+int kvm_arch_check_processor_compat_all(void);
int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu);
int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);
@@ -96,6 +96,24 @@ int __weak kvm_arch_del_vm(int usage_count)
return 0;
}
+static void check_processor_compat(void *rtn)
+{
+ *(int *)rtn = kvm_arch_check_processor_compat();
+}
+
+int __weak kvm_arch_check_processor_compat_all(void)
+{
+ int cpu;
+ int r;
+
+ for_each_online_cpu(cpu) {
+ smp_call_function_single(cpu, check_processor_compat, &r, 1);
+ if (r < 0)
+ return r;
+ }
+ return 0;
+}
+
int __weak kvm_arch_online_cpu(unsigned int cpu, int usage_count)
{
int ret;
@@ -5752,11 +5752,6 @@ void kvm_unregister_perf_callbacks(void)
}
#endif
-static void check_processor_compat(void *rtn)
-{
- *(int *)rtn = kvm_arch_check_processor_compat();
-}
-
int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
struct module *module)
{
@@ -5782,11 +5777,9 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
if (r < 0)
goto out_free_1;
- for_each_online_cpu(cpu) {
- smp_call_function_single(cpu, check_processor_compat, &r, 1);
- if (r < 0)
- goto out_free_2;
- }
+ r = kvm_arch_check_processor_compat_all();
+ if (r < 0)
+ goto out_free_2;
r = cpuhp_setup_state_nocalls(CPUHP_AP_KVM_ONLINE, "kvm/cpu:online",
kvm_online_cpu, kvm_offline_cpu);