From: Bandan Das Subject: Re: [PATCH 1/2] kvm: make vendor_intel a generic function Date: Tue, 04 Jun 2013 12:10:19 -0400 Message-ID: References: <1369863613-14781-1-git-send-email-bsd@redhat.com> <1369863613-14781-2-git-send-email-bsd@redhat.com> <51A6E5F5.8010605@redhat.com> <20130530060738.GA28405@redhat.com> <51A6F260.4060409@redhat.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Gleb Natapov , kvm@vger.kernel.org, Marcelo Tosatti To: Paolo Bonzini Return-path: Received: from mx1.redhat.com ([209.132.183.28]:28605 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756599Ab3FDQKX (ORCPT ); Tue, 4 Jun 2013 12:10:23 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r54GAK7D003795 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 4 Jun 2013 12:10:20 -0400 In-Reply-To: <51A6F260.4060409@redhat.com> (Paolo Bonzini's message of "Thu, 30 May 2013 08:32:00 +0200") Sender: kvm-owner@vger.kernel.org List-ID: Paolo Bonzini writes: > Il 30/05/2013 08:07, Gleb Natapov ha scritto: >>> > Unfortunately, this is not acceptable. The emulator is not supposed to >>> > know about the vcpu. Everything has to go through the context; in >>> > principle, the emulator should be usable outside of KVM. >>> > >>> > I would just duplicate the code in kvm_guest_vcpu_model (perhaps you can >>> > rename it to kvm_cpuid_get_intel_model or something like that; having >>> > both "guest" and "vcpu" in the name is a pleonasm :)). >> >> I thought having inline function that gets &eax, &ebx, &ecx, &edx as a >> parameter and returns a vendor. > > That could work too. Bandan, whatever looks nicer to you. :) OK, I posted a v2. I changed vendor_intel() to just do the checking and the call to cpuid happens outside the function now through whatever method is appropriate. As a cleanup work, I think there should be a corresponding vendor_amd() too for the AMD related checks that happen in emulate.c. I will send a separate change for it. Bandan > Paolo