public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 46/46] KVM: report 1GB page support to userspace
Date: Sun, 23 Aug 2009 14:56:45 +0300	[thread overview]
Message-ID: <1251028605-31977-47-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1251028605-31977-1-git-send-email-avi@redhat.com>

From: Joerg Roedel <joerg.roedel@amd.com>

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>
---
 arch/x86/include/asm/kvm_host.h |    2 ++
 arch/x86/kvm/svm.c              |    6 ++++++
 arch/x86/kvm/vmx.c              |    6 ++++++
 arch/x86/kvm/x86.c              |    3 ++-
 4 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 3315efa..b17d845 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -528,6 +528,8 @@ 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);
+
 	const struct trace_print_flags *exit_reasons_str;
 };
 
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 92fc0da..10e718d 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[] = {
 	{ -1, NULL }
 };
 
+static bool svm_gb_page_enable(void)
+{
+	return true;
+}
+
 static struct kvm_x86_ops svm_x86_ops = {
 	.cpu_has_kvm_support = has_svm,
 	.disabled_by_bios = is_disabled,
@@ -2817,6 +2822,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,
 };
 
 static int __init svm_init(void)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index c5aaa1b..32e6d20 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[] = {
 	{ -1, NULL }
 };
 
+static bool vmx_gb_page_enable(void)
+{
+	return false;
+}
+
 static struct kvm_x86_ops vmx_x86_ops = {
 	.cpu_has_kvm_support = cpu_has_kvm_support,
 	.disabled_by_bios = vmx_disabled_by_bios,
@@ -3969,6 +3974,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,
 };
 
 static int __init vmx_init(void)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index d1bcc59..b407d3c 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,
 			 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_lm = F(LM);
 #else
@@ -1468,7 +1469,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 		F(MTRR) | F(PGE) | F(MCA) | F(CMOV) |
 		F(PAT) | F(PSE36) | 0 /* Reserved */ |
 		f_nx | 0 /* Reserved */ | F(MMXEXT) | F(MMX) |
-		F(FXSR) | F(FXSR_OPT) | 0 /* GBPAGES */ | 0 /* RDTSCP */ |
+		F(FXSR) | F(FXSR_OPT) | f_gbpages | 0 /* RDTSCP */ |
 		0 /* Reserved */ | f_lm | F(3DNOWEXT) | F(3DNOW);
 	/* cpuid 1.ecx */
 	const u32 kvm_supported_word4_x86_features =
-- 
1.6.4.1


      parent reply	other threads:[~2009-08-23 11:57 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-23 11:55 [PATCH 00/46] KVM updates for 2.6.32 merge window (3/4) Avi Kivity
2009-08-23 11:56 ` [PATCH 01/46] KVM: Trace irq level and source id Avi Kivity
2009-08-23 11:56 ` [PATCH 02/46] KVM: Ignore PCI ECS I/O enablement Avi Kivity
2009-08-23 11:56 ` [PATCH 03/46] KVM: Trace mmio Avi Kivity
2009-08-23 11:56 ` [PATCH 04/46] KVM: Trace apic registers using their symbolic names Avi Kivity
2009-08-23 11:56 ` [PATCH 05/46] KVM: Add Directed EOI support to APIC emulation Avi Kivity
2009-08-23 11:56 ` [PATCH 06/46] KVM: x2apic interface to lapic Avi Kivity
2009-08-23 11:56 ` [PATCH 07/46] KVM: Use temporary variable to shorten lines Avi Kivity
2009-08-23 11:56 ` [PATCH 08/46] KVM: Fix apic_mmio_write return for unaligned write Avi Kivity
2009-08-23 11:56 ` [PATCH 09/46] KVM: handle AMD microcode MSR Avi Kivity
2009-08-23 11:56 ` [PATCH 10/46] Revert "KVM: x86: check for cr3 validity in ioctl_set_sregs" Avi Kivity
2009-08-23 11:56 ` [PATCH 11/46] KVM: MMU: Trace guest pagetable walker Avi Kivity
2009-08-23 11:56 ` [PATCH 12/46] KVM: Document basic API Avi Kivity
2009-08-23 11:56 ` [PATCH 13/46] KVM: Trace shadow page lifecycle Avi Kivity
2009-08-23 11:56 ` [PATCH 14/46] KVM: fix MMIO_CONF_BASE MSR access Avi Kivity
2009-08-23 11:56 ` [PATCH 15/46] KVM: ignore msi request if !level Avi Kivity
2009-08-23 11:56 ` [PATCH 16/46] KVM: Add trace points in irqchip code Avi Kivity
2009-08-23 11:56 ` [PATCH 17/46] KVM: No need to kick cpu if not in a guest mode Avi Kivity
2009-08-23 11:56 ` [PATCH 18/46] KVM: Always report x2apic as supported feature Avi Kivity
2009-08-23 11:56 ` [PATCH 19/46] KVM: PIT support for HPET legacy mode Avi Kivity
2009-08-23 11:56 ` [PATCH 20/46] KVM: add module parameters documentation Avi Kivity
2009-08-23 11:56 ` [PATCH 21/46] KVM: make io_bus interface more robust Avi Kivity
2009-08-23 11:56 ` [PATCH 22/46] KVM: add ioeventfd support Avi Kivity
2009-08-23 11:56 ` [PATCH 23/46] KVM: MMU: Fix MMU_DEBUG compile breakage Avi Kivity
2009-08-23 11:56 ` [PATCH 24/46] KVM: Move exception handling to the same place as other events Avi Kivity
2009-08-23 11:56 ` [PATCH 25/46] KVM: Move kvm_cpu_get_interrupt() declaration to x86 code Avi Kivity
2009-08-23 11:56 ` [PATCH 26/46] KVM: Reduce runnability interface with arch support code Avi Kivity
2009-08-23 11:56 ` [PATCH 27/46] KVM: silence lapic kernel messages that can be triggered by a guest Avi Kivity
2009-08-23 11:56 ` [PATCH 28/46] KVM: Discard unnecessary kvm_mmu_flush_tlb() in kvm_mmu_load() Avi Kivity
2009-08-23 11:56 ` [PATCH 29/46] KVM: MMU: fix missing locking in alloc_mmu_pages Avi Kivity
2009-08-23 11:56 ` [PATCH 30/46] KVM: s390: remove unused structs Avi Kivity
2009-08-23 11:56 ` [PATCH 31/46] KVM: x86: use get_desc_base() and get_desc_limit() Avi Kivity
2009-08-23 11:56 ` [PATCH 32/46] KVM: x86: use kvm_get_gdt() and kvm_read_ldt() Avi Kivity
2009-08-23 11:56 ` [PATCH 33/46] KVM: VMX: Introduce KVM_SET_IDENTITY_MAP_ADDR ioctl Avi Kivity
2009-08-23 11:56 ` [PATCH 34/46] KVM: PIT: Unregister ack notifier callback when freeing Avi Kivity
2009-08-23 11:56 ` [PATCH 35/46] KVM: Drop obsolete cpu_get/put in make_all_cpus_request Avi Kivity
2009-08-23 11:56 ` [PATCH 36/46] KVM: VMX: Avoid to return ENOTSUPP to userland Avi Kivity
2009-08-23 11:56 ` [PATCH 37/46] KVM: Align cr8 threshold when userspace changes cr8 Avi Kivity
2009-08-23 11:56 ` [PATCH 38/46] KVM: limit lapic periodic timer frequency Avi Kivity
2009-08-23 11:56 ` [PATCH 39/46] KVM: fix kvm_init() error handling Avi Kivity
2009-08-23 11:56 ` [PATCH 40/46] KVM: MMU: make rmap code aware of mapping levels Avi Kivity
2009-08-23 11:56 ` [PATCH 41/46] KVM: MMU: rename is_largepage_backed to mapping_level Avi Kivity
2009-08-23 11:56 ` [PATCH 42/46] KVM: MMU: make direct mapping paths aware of mapping levels Avi Kivity
2009-08-23 11:56 ` [PATCH 43/46] KVM: MMU: make page walker " Avi Kivity
2009-08-23 11:56 ` [PATCH 44/46] KVM: MMU: shadow support for 1gb pages Avi Kivity
2009-08-23 11:56 ` [PATCH 45/46] KVM: MMU: enable gbpages by increasing nr of pagesizes Avi Kivity
2009-08-23 11:56 ` Avi Kivity [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1251028605-31977-47-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox