From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 4/6] export new cpuid KVM_CAP Date: Tue, 27 Apr 2010 22:20:52 +0300 Message-ID: <4BD73914.8040209@redhat.com> References: <1272303988-21929-1-git-send-email-glommer@redhat.com> <1272303988-21929-2-git-send-email-glommer@redhat.com> <1272303988-21929-3-git-send-email-glommer@redhat.com> <1272303988-21929-4-git-send-email-glommer@redhat.com> <1272303988-21929-5-git-send-email-glommer@redhat.com> <4BD7291F.6010809@redhat.com> <20100427190901.GS16166@mothafucka.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Glauber Costa Return-path: In-Reply-To: <20100427190901.GS16166@mothafucka.localdomain> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 04/27/2010 10:09 PM, Glauber Costa wrote: > >> Hmm. We already have an API to get cpuid bits: >> KVM_GET_SUPPORTED_CPUID2. The nice thing about it is that it will >> mean -cpu host will work out of the box. >> > Ok, from what I understand, KVM_GET_CPUID2 gets a set of features, and tells > userspace which of them are available. Right? > No. KVM_GET_CPUID2 reads what was set by KVM_SET_CPUID, as modified by the guest executing the cpuid instruction. KVM_GET_SUPPORTED_CPUID tells userspace which bits are supported by the host cpu and kvm. > If this is the case, userspace could ask for 0xffffffff, and then we tell them > which of them are present. > > Does that make sense? > The API for KVM_GET_SUPPORTED_CPUID returns all cpuid leaves supported in one go, IIRC. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.