From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M3qXR-0005St-EG for qemu-devel@nongnu.org; Tue, 12 May 2009 07:52:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M3qXN-0005Px-TS for qemu-devel@nongnu.org; Tue, 12 May 2009 07:52:49 -0400 Received: from [199.232.76.173] (port=36984 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M3qXN-0005Pp-N8 for qemu-devel@nongnu.org; Tue, 12 May 2009 07:52:45 -0400 Received: from mx2.redhat.com ([66.187.237.31]:52648) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M3qXN-0005FK-4J for qemu-devel@nongnu.org; Tue, 12 May 2009 07:52:45 -0400 Subject: Re: [Qemu-devel] [PATCH 4/4] kvm: Trim cpu features not supported by kvm From: Mark McLoughlin In-Reply-To: <1241359444-8538-5-git-send-email-avi@redhat.com> References: <1241359444-8538-1-git-send-email-avi@redhat.com> <1241359444-8538-5-git-send-email-avi@redhat.com> Content-Type: text/plain Date: Tue, 12 May 2009 12:52:34 +0100 Message-Id: <1242129154.18544.13.camel@blaa> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Reply-To: Mark McLoughlin List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org On Sun, 2009-05-03 at 17:04 +0300, Avi Kivity wrote: > Remove cpu features that are not supported by kvm from the cpuid features > reported to the guest. > > Signed-off-by: Avi Kivity .... > @@ -1699,5 +1714,20 @@ CPUX86State *cpu_x86_init(const char *cpu_model) > > qemu_init_vcpu(env); > > + if (kvm_enabled()) { > + kvm_trim_features(&env->cpuid_features, > + kvm_arch_get_supported_cpuid(env, 1, R_EDX), > + feature_name); This isn't work in qemu.git because the features are only queried from qemu_init_vcpu() (see kvm_arch_init_vcpu()) The obvious fix is to move qemu_init_vcpu() after the feature trimming, but that requires us to split env->kvm_state initialization out of kvm_init_vcpu() Also, it works in qemu-kvm.git, but only because actually call kvm_qemu_init_env() twice - once before feature trimming and once after. Cheers, Mark.