All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] KVM: VMX: Add capability report of Intel hardware
@ 2008-06-19 10:44 Yang, Sheng
  2008-06-20  3:26 ` Yang, Sheng
  0 siblings, 1 reply; 2+ messages in thread
From: Yang, Sheng @ 2008-06-19 10:44 UTC (permalink / raw)
  To: kvm

[-- Attachment #1: Type: text/plain, Size: 2404 bytes --]

From 5b4842db131758b2edf8cdaf28f5f3d3557ed766 Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang@intel.com>
Date: Thu, 19 Jun 2008 18:41:43 +0800
Subject: [PATCH] KVM: VMX: Add capability report of Intel hardware


Signed-off-by: Sheng Yang <sheng.yang@intel.com>
---
 arch/x86/kvm/vmx.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 0fbbf6d..8b207b3 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -119,6 +119,9 @@ struct vmx_capability {
 	u32 vpid;
 } vmx_capability;

+#define VMX_FEATURE_MAX_LEN	256
+static char vmx_feature_string[VMX_FEATURE_MAX_LEN] = "VMX: ";
+
 #define VMX_SEGMENT_FIELD(seg)					\
 	[VCPU_SREG_##seg] = {                                   \
 		.selector = GUEST_##seg##_SELECTOR,		\
@@ -1237,6 +1240,22 @@ static __init int alloc_kvm_area(void)
 	return 0;
 }

+static __init void build_feature_report(void)
+{
+	if (cpu_has_vmx_msr_bitmap())
+		strlcat(vmx_feature_string,
+			"msr_bitmap ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_virtual_nmis())
+		strlcat(vmx_feature_string, "vnmi ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_tpr_shadow())
+		strlcat(vmx_feature_string,
+			"flexpriority ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_ept())
+		strlcat(vmx_feature_string, "ept ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_vpid())
+		strlcat(vmx_feature_string, "vpid ", VMX_FEATURE_MAX_LEN);
+}
+
 static __init int hardware_setup(void)
 {
 	if (setup_vmcs_config(&vmcs_config) < 0)
@@ -1245,6 +1264,8 @@ static __init int hardware_setup(void)
 	if (boot_cpu_has(X86_FEATURE_NX))
 		kvm_enable_efer_bits(EFER_NX);

+	build_feature_report();
+
 	return alloc_kvm_area();
 }

@@ -3235,6 +3256,11 @@ static struct kvm_x86_ops vmx_x86_ops = {
 	.get_tdp_level = get_ept_level,
 };

+static int vmx_feature_show(char *page)
+{
+	return sprintf(page, "%s\n", vmx_feature_string);
+}
+
 static int __init vmx_init(void)
 {
 	void *va;
@@ -3293,6 +3319,8 @@ static int __init vmx_init(void)

 	ept_sync_global();

+	kvm_register_hw_feature_report(vmx_feature_show);
+
 	return 0;

 out2:
@@ -3310,6 +3338,8 @@ static void __exit vmx_exit(void)
 	__free_page(vmx_io_bitmap_b);
 	__free_page(vmx_io_bitmap_a);

+	kvm_unregister_hw_feature_report();
+
 	kvm_exit();
 }

--
1.5.5


[-- Attachment #2: 0003-KVM-VMX-Add-capability-report-of-Intel-hardware.patch --]
[-- Type: text/x-diff, Size: 2415 bytes --]

From 5b4842db131758b2edf8cdaf28f5f3d3557ed766 Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang@intel.com>
Date: Thu, 19 Jun 2008 18:41:43 +0800
Subject: [PATCH] KVM: VMX: Add capability report of Intel hardware


Signed-off-by: Sheng Yang <sheng.yang@intel.com>
---
 arch/x86/kvm/vmx.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 0fbbf6d..8b207b3 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -119,6 +119,9 @@ struct vmx_capability {
 	u32 vpid;
 } vmx_capability;
 
+#define VMX_FEATURE_MAX_LEN	256
+static char vmx_feature_string[VMX_FEATURE_MAX_LEN] = "VMX: ";
+
 #define VMX_SEGMENT_FIELD(seg)					\
 	[VCPU_SREG_##seg] = {                                   \
 		.selector = GUEST_##seg##_SELECTOR,		\
@@ -1237,6 +1240,22 @@ static __init int alloc_kvm_area(void)
 	return 0;
 }
 
+static __init void build_feature_report(void)
+{
+	if (cpu_has_vmx_msr_bitmap())
+		strlcat(vmx_feature_string,
+			"msr_bitmap ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_virtual_nmis())
+		strlcat(vmx_feature_string, "vnmi ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_tpr_shadow())
+		strlcat(vmx_feature_string,
+			"flexpriority ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_ept())
+		strlcat(vmx_feature_string, "ept ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_vpid())
+		strlcat(vmx_feature_string, "vpid ", VMX_FEATURE_MAX_LEN);
+}
+
 static __init int hardware_setup(void)
 {
 	if (setup_vmcs_config(&vmcs_config) < 0)
@@ -1245,6 +1264,8 @@ static __init int hardware_setup(void)
 	if (boot_cpu_has(X86_FEATURE_NX))
 		kvm_enable_efer_bits(EFER_NX);
 
+	build_feature_report();
+
 	return alloc_kvm_area();
 }
 
@@ -3235,6 +3256,11 @@ static struct kvm_x86_ops vmx_x86_ops = {
 	.get_tdp_level = get_ept_level,
 };
 
+static int vmx_feature_show(char *page)
+{
+	return sprintf(page, "%s\n", vmx_feature_string);
+}
+
 static int __init vmx_init(void)
 {
 	void *va;
@@ -3293,6 +3319,8 @@ static int __init vmx_init(void)
 
 	ept_sync_global();
 
+	kvm_register_hw_feature_report(vmx_feature_show);
+
 	return 0;
 
 out2:
@@ -3310,6 +3338,8 @@ static void __exit vmx_exit(void)
 	__free_page(vmx_io_bitmap_b);
 	__free_page(vmx_io_bitmap_a);
 
+	kvm_unregister_hw_feature_report();
+
 	kvm_exit();
 }
 
-- 
1.5.5


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

* Re: [PATCH 3/4] KVM: VMX: Add capability report of Intel hardware
  2008-06-19 10:44 [PATCH 3/4] KVM: VMX: Add capability report of Intel hardware Yang, Sheng
@ 2008-06-20  3:26 ` Yang, Sheng
  0 siblings, 0 replies; 2+ messages in thread
From: Yang, Sheng @ 2008-06-20  3:26 UTC (permalink / raw)
  To: kvm

[-- Attachment #1: Type: text/plain, Size: 2694 bytes --]

Updated the patch, tell part TPR shadow from FlexPriority. Some hardware 
support CR8 accelerating but not FlexPriority...

---------
From 5c787ce9d8fc7791d795a64b7c73b9cc4849a459 Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang@intel.com>
Date: Fri, 20 Jun 2008 11:24:46 +0800
Subject: [PATCH] KVM: VMX: Add capability report of Intel hardware


Signed-off-by: Sheng Yang <sheng.yang@intel.com>
---
 arch/x86/kvm/vmx.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 0fbbf6d..61826e3 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -119,6 +119,9 @@ struct vmx_capability {
 	u32 vpid;
 } vmx_capability;

+#define VMX_FEATURE_MAX_LEN	256
+static char vmx_feature_string[VMX_FEATURE_MAX_LEN] = "VMX: ";
+
 #define VMX_SEGMENT_FIELD(seg)					\
 	[VCPU_SREG_##seg] = {                                   \
 		.selector = GUEST_##seg##_SELECTOR,		\
@@ -1237,6 +1240,25 @@ static __init int alloc_kvm_area(void)
 	return 0;
 }

+static __init void build_feature_report(void)
+{
+	if (cpu_has_vmx_msr_bitmap())
+		strlcat(vmx_feature_string,
+			"msr_bitmap ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_virtual_nmis())
+		strlcat(vmx_feature_string, "vnmi ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_tpr_shadow())
+		strlcat(vmx_feature_string,
+			"tpr_shadow ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_tpr_shadow() && cpu_has_vmx_virtualize_apic_accesses())
+		strlcat(vmx_feature_string,
+			"flexpriority ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_ept())
+		strlcat(vmx_feature_string, "ept ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_vpid())
+		strlcat(vmx_feature_string, "vpid ", VMX_FEATURE_MAX_LEN);
+}
+
 static __init int hardware_setup(void)
 {
 	if (setup_vmcs_config(&vmcs_config) < 0)
@@ -1245,6 +1267,8 @@ static __init int hardware_setup(void)
 	if (boot_cpu_has(X86_FEATURE_NX))
 		kvm_enable_efer_bits(EFER_NX);

+	build_feature_report();
+
 	return alloc_kvm_area();
 }

@@ -3235,6 +3259,11 @@ static struct kvm_x86_ops vmx_x86_ops = {
 	.get_tdp_level = get_ept_level,
 };

+static int vmx_feature_show(char *page)
+{
+	return sprintf(page, "%s\n", vmx_feature_string);
+}
+
 static int __init vmx_init(void)
 {
 	void *va;
@@ -3293,6 +3322,8 @@ static int __init vmx_init(void)

 	ept_sync_global();

+	kvm_register_hw_feature_report(vmx_feature_show);
+
 	return 0;

 out2:
@@ -3310,6 +3341,8 @@ static void __exit vmx_exit(void)
 	__free_page(vmx_io_bitmap_b);
 	__free_page(vmx_io_bitmap_a);

+	kvm_unregister_hw_feature_report();
+
 	kvm_exit();
 }

--
1.5.5


[-- Attachment #2: 0003-KVM-VMX-Add-capability-report-of-Intel-hardware.patch --]
[-- Type: text/x-diff, Size: 2567 bytes --]

From 5c787ce9d8fc7791d795a64b7c73b9cc4849a459 Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang@intel.com>
Date: Fri, 20 Jun 2008 11:24:46 +0800
Subject: [PATCH] KVM: VMX: Add capability report of Intel hardware


Signed-off-by: Sheng Yang <sheng.yang@intel.com>
---
 arch/x86/kvm/vmx.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 0fbbf6d..61826e3 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -119,6 +119,9 @@ struct vmx_capability {
 	u32 vpid;
 } vmx_capability;
 
+#define VMX_FEATURE_MAX_LEN	256
+static char vmx_feature_string[VMX_FEATURE_MAX_LEN] = "VMX: ";
+
 #define VMX_SEGMENT_FIELD(seg)					\
 	[VCPU_SREG_##seg] = {                                   \
 		.selector = GUEST_##seg##_SELECTOR,		\
@@ -1237,6 +1240,25 @@ static __init int alloc_kvm_area(void)
 	return 0;
 }
 
+static __init void build_feature_report(void)
+{
+	if (cpu_has_vmx_msr_bitmap())
+		strlcat(vmx_feature_string,
+			"msr_bitmap ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_virtual_nmis())
+		strlcat(vmx_feature_string, "vnmi ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_tpr_shadow())
+		strlcat(vmx_feature_string,
+			"tpr_shadow ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_tpr_shadow() && cpu_has_vmx_virtualize_apic_accesses())
+		strlcat(vmx_feature_string,
+			"flexpriority ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_ept())
+		strlcat(vmx_feature_string, "ept ", VMX_FEATURE_MAX_LEN);
+	if (cpu_has_vmx_vpid())
+		strlcat(vmx_feature_string, "vpid ", VMX_FEATURE_MAX_LEN);
+}
+
 static __init int hardware_setup(void)
 {
 	if (setup_vmcs_config(&vmcs_config) < 0)
@@ -1245,6 +1267,8 @@ static __init int hardware_setup(void)
 	if (boot_cpu_has(X86_FEATURE_NX))
 		kvm_enable_efer_bits(EFER_NX);
 
+	build_feature_report();
+
 	return alloc_kvm_area();
 }
 
@@ -3235,6 +3259,11 @@ static struct kvm_x86_ops vmx_x86_ops = {
 	.get_tdp_level = get_ept_level,
 };
 
+static int vmx_feature_show(char *page)
+{
+	return sprintf(page, "%s\n", vmx_feature_string);
+}
+
 static int __init vmx_init(void)
 {
 	void *va;
@@ -3293,6 +3322,8 @@ static int __init vmx_init(void)
 
 	ept_sync_global();
 
+	kvm_register_hw_feature_report(vmx_feature_show);
+
 	return 0;
 
 out2:
@@ -3310,6 +3341,8 @@ static void __exit vmx_exit(void)
 	__free_page(vmx_io_bitmap_b);
 	__free_page(vmx_io_bitmap_a);
 
+	kvm_unregister_hw_feature_report();
+
 	kvm_exit();
 }
 
-- 
1.5.5


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

end of thread, other threads:[~2008-06-20  3:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-19 10:44 [PATCH 3/4] KVM: VMX: Add capability report of Intel hardware Yang, Sheng
2008-06-20  3:26 ` Yang, Sheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.