Re: [PATCH 2/24] Add VMX and SVM to list of supported cpuid features

2010-06-15 Thread Nadav Har'El
On Mon, Jun 14, 2010, Avi Kivity wrote about Re: [PATCH 2/24] Add VMX and SVM 
to list of supported cpuid features:
  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) |

 
 You can use kvm_x86_ops-set_supported_cpuid() to alter features.

You're right, that's indeed much cleaner! Thanks.
This also prevents me from needing the nested parameter in x86.c (which I
don't have now that I've moved it to vmx.c).

The fixed patch:

---
Subject: [PATCH 2/24] Add VMX and SVM to list of supported cpuid features

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.

Signed-off-by: Nadav Har'El n...@il.ibm.com
---
--- .before/arch/x86/kvm/vmx.c  2010-06-15 17:20:01.0 +0300
+++ .after/arch/x86/kvm/vmx.c   2010-06-15 17:20:01.0 +0300
@@ -4236,6 +4236,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);
 }
 
 static struct kvm_x86_ops vmx_x86_ops = {

-- 
Nadav Har'El|  Tuesday, Jun 15 2010, 3 Tammuz 5770
n...@math.technion.ac.il |-
Phone +972-523-790466, ICQ 13349191 |Time is the best teacher. Unfortunately
http://nadav.harel.org.il   |it kills all its students.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/24] Add VMX and SVM to list of supported cpuid features

2010-06-14 Thread Avi Kivity

On 06/13/2010 03:23 PM, Nadav Har'El wrote:

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'Eln...@il.ibm.com
---
--- .before/arch/x86/kvm/x86.c  2010-06-13 15:01:28.0 +0300
+++ .after/arch/x86/kvm/x86.c   2010-06-13 15:01:28.0 +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) |
   


You can use kvm_x86_ops-set_supported_cpuid() to alter features.


@@ -1931,7 +1931,8 @@ static void do_cpuid_ent(struct kvm_cpui
0 /* Reserved, XSAVE, OSXSAVE */;
/* cpuid 0x8001.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 */;
   


Good idea, but let's leave it out of the nvmx patches.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html