On 26/09/2017 19:12, Josh Triplett wrote:
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index 6970249c09fc..e1a00b130935 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -12074,7 +12074,12 @@ static struct kvm_x86_ops vmx_x86_ops 
>> __ro_after_init = {
>>  
>>  static int __init vmx_init(void)
>>  {
>> -    int r = kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx),
>> +    int r;
>> +
>> +    if (!x86_match_cpu(vmx_cpu_id))
>> +            return -ENODEV;
> Does this make any other checks redundant and removable?

It would make sense to place it in cpu_has_kvm_support instead, and the
same in svm.c's has_svm.

But there's a lot of pointless indirection to clean up there...

Paolo

>> +
>> +    r = kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx),
>>                       __alignof__(struct vcpu_vmx), THIS_MODULE);
>>      if (r)
>>              return r;
>> -- 


Reply via email to