]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: x86: Rename gb_page_enable() to get_lpage_level() in kvm_x86_ops
authorSheng Yang <sheng@linux.intel.com>
Tue, 5 Jan 2010 11:02:27 +0000 (19:02 +0800)
committerMarcelo Tosatti <mtosatti@redhat.com>
Wed, 6 Jan 2010 09:59:55 +0000 (07:59 -0200)
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>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/svm.c
arch/x86/kvm/vmx.c
arch/x86/kvm/x86.c

index 741b8972a3a55e94b1b18ed5ac5ee06449225fa0..a4de557ad733c2441a63db55d9a1a3c1d515a3f8 100644 (file)
@@ -528,7 +528,7 @@ struct kvm_x86_ops {
        int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);
        int (*get_tdp_level)(void);
        u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio);
-       bool (*gb_page_enable)(void);
+       int (*get_lpage_level)(void);
        bool (*rdtscp_supported)(void);
 
        const struct trace_print_flags *exit_reasons_str;
index b373ae6fb97447e7e2e954283112d0885b47f0b5..cf64fc026e3ef2a55af10857950abc893b8eb751 100644 (file)
@@ -2911,9 +2911,9 @@ static const struct trace_print_flags svm_exit_reasons_str[] = {
        { -1, NULL }
 };
 
-static bool svm_gb_page_enable(void)
+static int svm_get_lpage_level(void)
 {
-       return true;
+       return PT_PDPE_LEVEL;
 }
 
 static bool svm_rdtscp_supported(void)
@@ -2986,7 +2986,7 @@ static struct kvm_x86_ops svm_x86_ops = {
        .get_mt_mask = svm_get_mt_mask,
 
        .exit_reasons_str = svm_exit_reasons_str,
-       .gb_page_enable = svm_gb_page_enable,
+       .get_lpage_level = svm_get_lpage_level,
 
        .cpuid_update = svm_cpuid_update,
 
index 455984acf72463e68a24d7a2a118ea10a165fc13..7733235a2c3ed0311b425972dd1beedb3fc62a79 100644 (file)
@@ -4035,9 +4035,9 @@ static const struct trace_print_flags vmx_exit_reasons_str[] = {
 
 #undef _ER
 
-static bool vmx_gb_page_enable(void)
+static int vmx_get_lpage_level(void)
 {
-       return false;
+       return PT_DIRECTORY_LEVEL;
 }
 
 static inline u32 bit(int bitno)
@@ -4130,7 +4130,7 @@ static struct kvm_x86_ops vmx_x86_ops = {
        .get_mt_mask = vmx_get_mt_mask,
 
        .exit_reasons_str = vmx_exit_reasons_str,
-       .gb_page_enable = vmx_gb_page_enable,
+       .get_lpage_level = vmx_get_lpage_level,
 
        .cpuid_update = vmx_cpuid_update,
 
index adc8597e1cad6b192f0f465186528fbac3cd271a..6811e5e4f13d874509be2b678773ce0e5b666066 100644 (file)
@@ -1642,10 +1642,12 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
                         u32 index, int *nent, int maxnent)
 {
        unsigned f_nx = is_efer_nx() ? F(NX) : 0;
-       unsigned f_gbpages = kvm_x86_ops->gb_page_enable() ? F(GBPAGES) : 0;
 #ifdef CONFIG_X86_64
+       unsigned f_gbpages = (kvm_x86_ops->get_lpage_level() == PT_PDPE_LEVEL)
+                               ? F(GBPAGES) : 0;
        unsigned f_lm = F(LM);
 #else
+       unsigned f_gbpages = 0;
        unsigned f_lm = 0;
 #endif
        unsigned f_rdtscp = kvm_x86_ops->rdtscp_supported() ? F(RDTSCP) : 0;