kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 3/4] Mask function7 ebx against host capability word9
@ 2011-05-30 15:17 Yang, Wei Y
  2011-06-01  8:57 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Yang, Wei Y @ 2011-05-30 15:17 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm@vger.kernel.org

This patch masks CPUID leaf 7 ebx against host capability word9.

 Signed-off-by: Yang, Wei <wei.y.yang@intel.com>
 Signed-off-by: Shan, Haitao <haitao.shan@intel.com>
 Signed-off-by: Li, Xin <xin.li@intel.com>

---
 arch/x86/kvm/x86.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 91bfc40..d650438 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2353,6 +2353,10 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 		F(ACE2) | F(ACE2_EN) | F(PHE) | F(PHE_EN) |
 		F(PMM) | F(PMM_EN);

+	/* cpuid 7.0.ebx */
+	const u32 kvm_supported_word9_x86_features =
+		F(SMEP);
+
 	/* all calls to cpuid_count() should be made on the same cpu */
 	get_cpu();
 	do_cpuid_1_ent(entry, function, index);
@@ -2387,7 +2391,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 		}
 		break;
 	}
-	/* function 4 and 0xb have additional index. */
+	/* function 4 has additional index. */
 	case 4: {
 		int i, cache_type;

@@ -2404,6 +2408,15 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 		}
 		break;
 	}
+	case 7: {
+		/* Mask ebx against host capbability word 9 */
+		if (index == 0) {
+			entry->ebx &= kvm_supported_word9_x86_features;
+			cpuid_mask(&entry->edx, 9);
+		}
+		break;
+	}
+	/* function 0xb has additional index. */
 	case 0xb: {
 		int i, level_type;

--
1.7.4.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v6 3/4] Mask function7 ebx against host capability word9
  2011-05-30 15:17 [PATCH v6 3/4] Mask function7 ebx against host capability word9 Yang, Wei Y
@ 2011-06-01  8:57 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2011-06-01  8:57 UTC (permalink / raw)
  To: Yang, Wei Y; +Cc: kvm@vger.kernel.org

On 05/30/2011 06:17 PM, Yang, Wei Y wrote:
> This patch masks CPUID leaf 7 ebx against host capability word9.

> @@ -2404,6 +2408,15 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
>   		}
>   		break;
>   	}
> +	case 7: {
> +		/* Mask ebx against host capbability word 9 */
> +		if (index == 0) {
> +			entry->ebx&= kvm_supported_word9_x86_features;
> +			cpuid_mask(&entry->edx, 9);
> +		}
> +		break;
> +	}
> +	/* function 0xb has additional index. */

I see that function 7 also depends on ecx, so it should set 
KVM_CPUID_FLAG_SIGNIFCANT_INDEX.

We should mask off ecx != 0 and all the reserved words, since we don't 
support the features in them.

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-01  8:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-30 15:17 [PATCH v6 3/4] Mask function7 ebx against host capability word9 Yang, Wei Y
2011-06-01  8:57 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).