KVM: Add kvm_x86_ops get_tdp_level()
PATCH 3/8 KVM: Add kvm_x86_ops get_tdp_level()
From 143c1240c5e5391f4e108aedfeb4491e6347d04e Mon Sep 17 00:00:00 2001
From: Sheng Yang <[email protected]>
Date: Fri, 25 Apr 2008 10:20:22 +0800
Subject: [PATCH 3/8] KVM: Add kvm_x86_ops get_tdp_level()
The function get_tdp_level() provided the number of tdp level for EPT and NPT rather than the NPT specific macro.
--- arch/x86/kvm/mmu.h | 6 ------ arch/x86/kvm/svm.c | 10 ++++++++++ arch/x86/kvm/vmx.c | 6 ++++++ arch/x86/kvm/vmx.h | 1 + include/asm-x86/kvm_host.h | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-)
arch/x86/kvm/mmu.h +0 -6
@@ -3,12 +3,6 @@#include <linux/kvm_host.h> -#ifdef CONFIG_X86_64 -#define TDP_ROOT_LEVEL PT64_ROOT_LEVEL -#else -#define TDP_ROOT_LEVEL PT32E_ROOT_LEVEL -#endif -#define PT64_PT_BITS 9#define PT64_ENT_PER_PAGE (1 << PT64_PT_BITS)#define PT32_PT_BITS 10
arch/x86/kvm/svm.c +10 -0
@@ -1863,6 +1863,15 @@ static bool svm_cpu_has_accelerated_tpr(void)return false; } +static int get_npt_level (void ) +{ +#ifdef CONFIG_X86_64 +return PT64_ROOT_LEVEL ; +#else +return PT32E_ROOT_LEVEL ; +#endif +} +static struct kvm_x86_ops svm_x86_ops = { .cpu_has_kvm_support = has_svm, .disabled_by_bios = is_disabled,
@@ -1920,6 +1929,7 @@ static struct kvm_x86_ops svm_x86_ops = { .inject_pending_vectors = do_interrupt_requests, .set_tss_addr = svm_set_tss_addr, + .get_tdp_level = get_npt_level, };static int __init svm_init (void )
arch/x86/kvm/vmx.c +0 -0
@@ -2788,6 +2788,11 @@ static void __init vmx_check_processor_compat(void
*rtn)
}
}
+static int get_ept_level(void)
+{
+ return VMX_EPT_DEFAULT_GAW + 1;
+}
+
static struct kvm_x86_ops vmx_x86_ops = {
.cpu_has_kvm_support = cpu_has_kvm_support, .disabled_by_bios = vmx_disabled_by_bios,
@@ -2844,6 +2849,7 @@ static struct kvm_x86_ops vmx_x86_ops = {
.inject_pending_vectors = do_interrupt_requests,
.set_tss_addr = vmx_set_tss_addr,
+ .get_tdp_level = get_ept_level,
};
static int __init vmx_init(void)
arch/x86/kvm/vmx.h +1 -0
@@ -351,5 +351,6 @@ enum vmcs_field {#define VMX_EPT_EXTENT_INDIVIDUAL_BIT (1ull << 24)#define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25)#define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26) +#define VMX_EPT_DEFAULT_GAW 3#endif
include/asm-x86/kvm_host.h +1 -1
@@ -422,8 +422,8 @@ struct kvm_x86_ops { struct kvm_run *run);int (*set_tss_addr)(struct kvm *kvm,unsigned int addr); +int (*get_tdp_level)(void ); }; -extern struct kvm_x86_ops *kvm_x86_ops;int kvm_mmu_module_init (void );
--
1.5.4.5
From 143c1240c5e5391f4e108aedfeb4491e6347d04e Mon Sep 17 00:00:00 2001
From: Sheng Yang <[email protected]>
Date: Fri, 25 Apr 2008 10:20:22 +0800
Subject: [PATCH 3/8] KVM: Add kvm_x86_ops get_tdp_level()
The function get_tdp_level() provided the number of tdp level for EPT and NPT rather than the NPT specific macro.
--- arch/x86/kvm/mmu.h | 6 ------ arch/x86/kvm/svm.c | 10 ++++++++++ arch/x86/kvm/vmx.c | 6 ++++++ arch/x86/kvm/vmx.h | 1 + include/asm-x86/kvm_host.h | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-)
arch/x86/kvm/mmu.h +0 -6
@@ -3,12 +3,6 @@#include <linux/kvm_host.h> -#ifdef CONFIG_X86_64 -#define TDP_ROOT_LEVEL PT64_ROOT_LEVEL -#else -#define TDP_ROOT_LEVEL PT32E_ROOT_LEVEL -#endif -#define PT64_PT_BITS 9#define PT64_ENT_PER_PAGE (1 << PT64_PT_BITS)#define PT32_PT_BITS 10
arch/x86/kvm/svm.c +10 -0
@@ -1863,6 +1863,15 @@ static bool svm_cpu_has_accelerated_tpr(void)return false; } +static int get_npt_level (void ) +{ +#ifdef CONFIG_X86_64 +return PT64_ROOT_LEVEL ; +#else +return PT32E_ROOT_LEVEL ; +#endif +} +static struct kvm_x86_ops svm_x86_ops = { .cpu_has_kvm_support = has_svm, .disabled_by_bios = is_disabled,
@@ -1920,6 +1929,7 @@ static struct kvm_x86_ops svm_x86_ops = { .inject_pending_vectors = do_interrupt_requests, .set_tss_addr = svm_set_tss_addr, + .get_tdp_level = get_npt_level, };static int __init svm_init (void )
arch/x86/kvm/vmx.c +6 -0
@@ -2788,6 +2788,11 @@ static void __init vmx_check_processor_compat(void *rtn) } } +static int get_ept_level (void ) +{ +return VMX_EPT_DEFAULT_GAW +1 ; +} +static struct kvm_x86_ops vmx_x86_ops = { .cpu_has_kvm_support = cpu_has_kvm_support, .disabled_by_bios = vmx_disabled_by_bios,
@@ -2844,6 +2849,7 @@ static struct kvm_x86_ops vmx_x86_ops = { .inject_pending_vectors = do_interrupt_requests, .set_tss_addr = vmx_set_tss_addr, + .get_tdp_level = get_ept_level, };static int __init vmx_init (void )
arch/x86/kvm/vmx.h +1 -0
@@ -351,5 +351,6 @@ enum vmcs_field {#define VMX_EPT_EXTENT_INDIVIDUAL_BIT (1ull << 24)#define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25)#define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26) +#define VMX_EPT_DEFAULT_GAW 3#endif
include/asm-x86/kvm_host.h +1 -1
@@ -422,8 +422,8 @@ struct kvm_x86_ops { struct kvm_run *run);int (*set_tss_addr)(struct kvm *kvm,unsigned int addr); +int (*get_tdp_level)(void ); }; -extern struct kvm_x86_ops *kvm_x86_ops;int kvm_mmu_module_init (void );
Signature · 1 line
1.5.4.5
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel