aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorSheng Yang <sheng@linux.intel.com>2010-01-05 06:02:27 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 10:35:46 -0500
commit17cc393596823f4bbab81e68a9e23e7beadbcfca (patch)
tree7c5ffc52ebeab12dac3308a8a1aecffee37cb734 /arch/x86
parentc9c5417455b0c2e3c164883354b5480e5aee3b36 (diff)
KVM: x86: Rename gb_page_enable() to get_lpage_level() in kvm_x86_ops
Then the callback can provide the maximum supported large page level, which is more flexible. Also move the gb page support into x86_64 specific. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/kvm_host.h2
-rw-r--r--arch/x86/kvm/svm.c6
-rw-r--r--arch/x86/kvm/vmx.c6
-rw-r--r--arch/x86/kvm/x86.c4
4 files changed, 10 insertions, 8 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 741b8972a3a5..a4de557ad733 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -528,7 +528,7 @@ struct kvm_x86_ops {
528 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr); 528 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);
529 int (*get_tdp_level)(void); 529 int (*get_tdp_level)(void);
530 u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio); 530 u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio);
531 bool (*gb_page_enable)(void); 531 int (*get_lpage_level)(void);
532 bool (*rdtscp_supported)(void); 532 bool (*rdtscp_supported)(void);
533 533
534 const struct trace_print_flags *exit_reasons_str; 534 const struct trace_print_flags *exit_reasons_str;
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index b373ae6fb974..cf64fc026e3e 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2911,9 +2911,9 @@ static const struct trace_print_flags svm_exit_reasons_str[] = {
2911 { -1, NULL } 2911 { -1, NULL }
2912}; 2912};
2913 2913
2914static bool svm_gb_page_enable(void) 2914static int svm_get_lpage_level(void)
2915{ 2915{
2916 return true; 2916 return PT_PDPE_LEVEL;
2917} 2917}
2918 2918
2919static bool svm_rdtscp_supported(void) 2919static bool svm_rdtscp_supported(void)
@@ -2986,7 +2986,7 @@ static struct kvm_x86_ops svm_x86_ops = {
2986 .get_mt_mask = svm_get_mt_mask, 2986 .get_mt_mask = svm_get_mt_mask,
2987 2987
2988 .exit_reasons_str = svm_exit_reasons_str, 2988 .exit_reasons_str = svm_exit_reasons_str,
2989 .gb_page_enable = svm_gb_page_enable, 2989 .get_lpage_level = svm_get_lpage_level,
2990 2990
2991 .cpuid_update = svm_cpuid_update, 2991 .cpuid_update = svm_cpuid_update,
2992 2992
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index f4486f460278..0fd0892553ec 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -4036,9 +4036,9 @@ static const struct trace_print_flags vmx_exit_reasons_str[] = {
4036 4036
4037#undef _ER 4037#undef _ER
4038 4038
4039static bool vmx_gb_page_enable(void) 4039static int vmx_get_lpage_level(void)
4040{ 4040{
4041 return false; 4041 return PT_DIRECTORY_LEVEL;
4042} 4042}
4043 4043
4044static inline u32 bit(int bitno) 4044static inline u32 bit(int bitno)
@@ -4131,7 +4131,7 @@ static struct kvm_x86_ops vmx_x86_ops = {
4131 .get_mt_mask = vmx_get_mt_mask, 4131 .get_mt_mask = vmx_get_mt_mask,
4132 4132
4133 .exit_reasons_str = vmx_exit_reasons_str, 4133 .exit_reasons_str = vmx_exit_reasons_str,
4134 .gb_page_enable = vmx_gb_page_enable, 4134 .get_lpage_level = vmx_get_lpage_level,
4135 4135
4136 .cpuid_update = vmx_cpuid_update, 4136 .cpuid_update = vmx_cpuid_update,
4137 4137
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index aff3479867a8..c990424d86d0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1641,10 +1641,12 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
1641 u32 index, int *nent, int maxnent) 1641 u32 index, int *nent, int maxnent)
1642{ 1642{
1643 unsigned f_nx = is_efer_nx() ? F(NX) : 0; 1643 unsigned f_nx = is_efer_nx() ? F(NX) : 0;
1644 unsigned f_gbpages = kvm_x86_ops->gb_page_enable() ? F(GBPAGES) : 0;
1645#ifdef CONFIG_X86_64 1644#ifdef CONFIG_X86_64
1645 unsigned f_gbpages = (kvm_x86_ops->get_lpage_level() == PT_PDPE_LEVEL)
1646 ? F(GBPAGES) : 0;
1646 unsigned f_lm = F(LM); 1647 unsigned f_lm = F(LM);
1647#else 1648#else
1649 unsigned f_gbpages = 0;
1648 unsigned f_lm = 0; 1650 unsigned f_lm = 0;
1649#endif 1651#endif
1650 unsigned f_rdtscp = kvm_x86_ops->rdtscp_supported() ? F(RDTSCP) : 0; 1652 unsigned f_rdtscp = kvm_x86_ops->rdtscp_supported() ? F(RDTSCP) : 0;