From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: VMX: check match table Date: Wed, 27 Sep 2017 14:36:03 +0200 Message-ID: <498ed7dc-41b2-a075-cdce-e63a80842d39@redhat.com> References: <20170926042540.10100-1-nick.desaulniers@gmail.com> <20170926171219.ulnknakiohm2whpd@x> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: kay@vrfy.org, avi@redhat.com, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, kvm@vger.kernel.org To: Josh Triplett , Nick Desaulniers Return-path: In-Reply-To: <20170926171219.ulnknakiohm2whpd@x> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 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; >> --