aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2009-07-27 10:30:48 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:33:19 -0400
commit344f414fa0f16254dd07195d4cd11b2f92931d3d (patch)
tree53ddc04108934f945898ac16160353c3bf04af9c /arch/x86/kvm
parent04326caacff2b162d359c15a2edf634448897d1a (diff)
KVM: report 1GB page support to userspace
If userspace knows that the kernel part supports 1GB pages it can enable the corresponding cpuid bit so that guests actually use GB pages. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/svm.c6
-rw-r--r--arch/x86/kvm/vmx.c6
-rw-r--r--arch/x86/kvm/x86.c3
3 files changed, 14 insertions, 1 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 92fc0dab505d..10e718db990b 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2754,6 +2754,11 @@ static const struct trace_print_flags svm_exit_reasons_str[] = {
2754 { -1, NULL } 2754 { -1, NULL }
2755}; 2755};
2756 2756
2757static bool svm_gb_page_enable(void)
2758{
2759 return true;
2760}
2761
2757static struct kvm_x86_ops svm_x86_ops = { 2762static struct kvm_x86_ops svm_x86_ops = {
2758 .cpu_has_kvm_support = has_svm, 2763 .cpu_has_kvm_support = has_svm,
2759 .disabled_by_bios = is_disabled, 2764 .disabled_by_bios = is_disabled,
@@ -2817,6 +2822,7 @@ static struct kvm_x86_ops svm_x86_ops = {
2817 .get_mt_mask = svm_get_mt_mask, 2822 .get_mt_mask = svm_get_mt_mask,
2818 2823
2819 .exit_reasons_str = svm_exit_reasons_str, 2824 .exit_reasons_str = svm_exit_reasons_str,
2825 .gb_page_enable = svm_gb_page_enable,
2820}; 2826};
2821 2827
2822static int __init svm_init(void) 2828static int __init svm_init(void)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index c5aaa1b5fdbe..32e6d2031ba2 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3908,6 +3908,11 @@ static const struct trace_print_flags vmx_exit_reasons_str[] = {
3908 { -1, NULL } 3908 { -1, NULL }
3909}; 3909};
3910 3910
3911static bool vmx_gb_page_enable(void)
3912{
3913 return false;
3914}
3915
3911static struct kvm_x86_ops vmx_x86_ops = { 3916static struct kvm_x86_ops vmx_x86_ops = {
3912 .cpu_has_kvm_support = cpu_has_kvm_support, 3917 .cpu_has_kvm_support = cpu_has_kvm_support,
3913 .disabled_by_bios = vmx_disabled_by_bios, 3918 .disabled_by_bios = vmx_disabled_by_bios,
@@ -3969,6 +3974,7 @@ static struct kvm_x86_ops vmx_x86_ops = {
3969 .get_mt_mask = vmx_get_mt_mask, 3974 .get_mt_mask = vmx_get_mt_mask,
3970 3975
3971 .exit_reasons_str = vmx_exit_reasons_str, 3976 .exit_reasons_str = vmx_exit_reasons_str,
3977 .gb_page_enable = vmx_gb_page_enable,
3972}; 3978};
3973 3979
3974static int __init vmx_init(void) 3980static int __init vmx_init(void)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 69de7248083f..fa525d511d92 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1444,6 +1444,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
1444 u32 index, int *nent, int maxnent) 1444 u32 index, int *nent, int maxnent)
1445{ 1445{
1446 unsigned f_nx = is_efer_nx() ? F(NX) : 0; 1446 unsigned f_nx = is_efer_nx() ? F(NX) : 0;
1447 unsigned f_gbpages = kvm_x86_ops->gb_page_enable() ? F(GBPAGES) : 0;
1447#ifdef CONFIG_X86_64 1448#ifdef CONFIG_X86_64
1448 unsigned f_lm = F(LM); 1449 unsigned f_lm = F(LM);
1449#else 1450#else
@@ -1468,7 +1469,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
1468 F(MTRR) | F(PGE) | F(MCA) | F(CMOV) | 1469 F(MTRR) | F(PGE) | F(MCA) | F(CMOV) |
1469 F(PAT) | F(PSE36) | 0 /* Reserved */ | 1470 F(PAT) | F(PSE36) | 0 /* Reserved */ |
1470 f_nx | 0 /* Reserved */ | F(MMXEXT) | F(MMX) | 1471 f_nx | 0 /* Reserved */ | F(MMXEXT) | F(MMX) |
1471 F(FXSR) | F(FXSR_OPT) | 0 /* GBPAGES */ | 0 /* RDTSCP */ | 1472 F(FXSR) | F(FXSR_OPT) | f_gbpages | 0 /* RDTSCP */ |
1472 0 /* Reserved */ | f_lm | F(3DNOWEXT) | F(3DNOW); 1473 0 /* Reserved */ | f_lm | F(3DNOWEXT) | F(3DNOW);
1473 /* cpuid 1.ecx */ 1474 /* cpuid 1.ecx */
1474 const u32 kvm_supported_word4_x86_features = 1475 const u32 kvm_supported_word4_x86_features =