From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Nadav Har'El" Subject: [PATCH 27/29] nVMX: Add VMX to list of supported cpuid features Date: Thu, 27 Jan 2011 10:43:41 +0200 Message-ID: <201101270843.p0R8hfvZ002757@rice.haifa.ibm.com> References: <1296116987-nyh@il.ibm.com> Cc: gleb@redhat.com, avi@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mtagate6.uk.ibm.com ([194.196.100.166]:56297 "EHLO mtagate6.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751963Ab1A0Inp (ORCPT ); Thu, 27 Jan 2011 03:43:45 -0500 Received: from d06nrmr1507.portsmouth.uk.ibm.com (d06nrmr1507.portsmouth.uk.ibm.com [9.149.38.233]) by mtagate6.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p0R8hifD013588 for ; Thu, 27 Jan 2011 08:43:44 GMT Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p0R8hlQJ1642708 for ; Thu, 27 Jan 2011 08:43:47 GMT Received: from d06av08.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p0R8hhfJ027403 for ; Thu, 27 Jan 2011 08:43:44 GMT Sender: kvm-owner@vger.kernel.org List-ID: If the "nested" module option is enabled, add the "VMX" CPU feature to the list of CPU features KVM advertises with the KVM_GET_SUPPORTED_CPUID ioctl. Qemu uses this ioctl, and intersects KVM's list with its own list of desired cpu features (depending on the -cpu option given to qemu) to determine the final list of features presented to the guest. Signed-off-by: Nadav Har'El --- arch/x86/kvm/vmx.c | 2 ++ 1 file changed, 2 insertions(+) --- .before/arch/x86/kvm/vmx.c 2011-01-26 18:06:06.000000000 +0200 +++ .after/arch/x86/kvm/vmx.c 2011-01-26 18:06:06.000000000 +0200 @@ -6015,6 +6015,8 @@ static void vmx_cpuid_update(struct kvm_ static void vmx_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) { + if (func == 1 && nested) + entry->ecx |= bit(X86_FEATURE_VMX); } /*