From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Nadav Har'El" Subject: [PATCH 2/24] Add VMX and SVM to list of supported cpuid features Date: Sun, 13 Jun 2010 15:23:35 +0300 Message-ID: <201006131223.o5DCNZeM012879@rice.haifa.ibm.com> References: <1276431753-nyh@il.ibm.com> Cc: kvm@vger.kernel.org To: avi@redhat.com Return-path: Received: from mtagate1.de.ibm.com ([195.212.17.161]:44296 "EHLO mtagate1.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752059Ab0FMMXl (ORCPT ); Sun, 13 Jun 2010 08:23:41 -0400 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate1.de.ibm.com (8.13.1/8.13.1) with ESMTP id o5DCNcfr016780 for ; Sun, 13 Jun 2010 12:23:38 GMT Received: from d12av04.megacenter.de.ibm.com (d12av04.megacenter.de.ibm.com [9.149.165.229]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o5DCNbW81183852 for ; Sun, 13 Jun 2010 14:23:37 +0200 Received: from d12av04.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av04.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o5DCNbiC016736 for ; Sun, 13 Jun 2010 14:23:37 +0200 Sender: kvm-owner@vger.kernel.org List-ID: Add the "VMX" CPU feature to the list of CPU featuress KVM advertises with the KVM_GET_SUPPORTED_CPUID ioctl (unless the "nested" module option is off). 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. This patch also does the same for SVM: KVM now advertises it supports SVM, unless the "nested" module option is off. Signed-off-by: Nadav Har'El --- --- .before/arch/x86/kvm/x86.c 2010-06-13 15:01:28.000000000 +0300 +++ .after/arch/x86/kvm/x86.c 2010-06-13 15:01:28.000000000 +0300 @@ -1923,7 +1923,7 @@ static void do_cpuid_ent(struct kvm_cpui /* cpuid 1.ecx */ const u32 kvm_supported_word4_x86_features = F(XMM3) | 0 /* Reserved, DTES64, MONITOR */ | - 0 /* DS-CPL, VMX, SMX, EST */ | + 0 /* DS-CPL */ | (nested ? F(VMX) : 0) | 0 /* SMX, EST */ | 0 /* TM2 */ | F(SSSE3) | 0 /* CNXT-ID */ | 0 /* Reserved */ | 0 /* Reserved */ | F(CX16) | 0 /* xTPR Update, PDCM */ | 0 /* Reserved, DCA */ | F(XMM4_1) | @@ -1931,7 +1931,8 @@ static void do_cpuid_ent(struct kvm_cpui 0 /* Reserved, XSAVE, OSXSAVE */; /* cpuid 0x80000001.ecx */ const u32 kvm_supported_word6_x86_features = - F(LAHF_LM) | F(CMP_LEGACY) | F(SVM) | 0 /* ExtApicSpace */ | + F(LAHF_LM) | F(CMP_LEGACY) | (nested ? F(SVM) : 0) | + 0 /* ExtApicSpace */ | F(CR8_LEGACY) | F(ABM) | F(SSE4A) | F(MISALIGNSSE) | F(3DNOWPREFETCH) | 0 /* OSVW */ | 0 /* IBS */ | F(SSE5) | 0 /* SKINIT */ | 0 /* WDT */;