From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org
Subject: [PATCH 5/8] KVM: Move cr0/cr4/efer related helpers to x86.h
Date: Thu, 21 Jan 2010 15:31:49 +0200 [thread overview]
Message-ID: <1264080712-3981-6-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1264080712-3981-1-git-send-email-avi@redhat.com>
They have more general scope than the mmu.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
arch/x86/kvm/emulate.c | 1 -
arch/x86/kvm/mmu.c | 1 +
arch/x86/kvm/mmu.h | 24 ------------------------
arch/x86/kvm/x86.h | 24 ++++++++++++++++++++++++
4 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index e46f276..a2adec8 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -33,7 +33,6 @@
#include <asm/kvm_emulate.h>
#include "x86.h"
-#include "mmu.h" /* for is_long_mode() */
/*
* Opcode effective-address decode tables.
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index ff2b2e8..6f7158f 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -18,6 +18,7 @@
*/
#include "mmu.h"
+#include "x86.h"
#include "kvm_cache_regs.h"
#include <linux/kvm_host.h>
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index 599159f..61ef5a6 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -58,30 +58,6 @@ static inline int kvm_mmu_reload(struct kvm_vcpu *vcpu)
return kvm_mmu_load(vcpu);
}
-static inline int is_long_mode(struct kvm_vcpu *vcpu)
-{
-#ifdef CONFIG_X86_64
- return vcpu->arch.shadow_efer & EFER_LMA;
-#else
- return 0;
-#endif
-}
-
-static inline int is_pae(struct kvm_vcpu *vcpu)
-{
- return kvm_read_cr4_bits(vcpu, X86_CR4_PAE);
-}
-
-static inline int is_pse(struct kvm_vcpu *vcpu)
-{
- return kvm_read_cr4_bits(vcpu, X86_CR4_PSE);
-}
-
-static inline int is_paging(struct kvm_vcpu *vcpu)
-{
- return kvm_read_cr0_bits(vcpu, X86_CR0_PG);
-}
-
static inline int is_present_gpte(unsigned long pte)
{
return pte & PT_PRESENT_MASK;
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index f783d8f..2dc24a7 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -41,4 +41,28 @@ static inline bool is_protmode(struct kvm_vcpu *vcpu)
return kvm_read_cr0_bits(vcpu, X86_CR0_PE);
}
+static inline int is_long_mode(struct kvm_vcpu *vcpu)
+{
+#ifdef CONFIG_X86_64
+ return vcpu->arch.shadow_efer & EFER_LMA;
+#else
+ return 0;
+#endif
+}
+
+static inline int is_pae(struct kvm_vcpu *vcpu)
+{
+ return kvm_read_cr4_bits(vcpu, X86_CR4_PAE);
+}
+
+static inline int is_pse(struct kvm_vcpu *vcpu)
+{
+ return kvm_read_cr4_bits(vcpu, X86_CR4_PSE);
+}
+
+static inline int is_paging(struct kvm_vcpu *vcpu)
+{
+ return kvm_read_cr0_bits(vcpu, X86_CR0_PG);
+}
+
#endif
--
1.6.5.3
next prev parent reply other threads:[~2010-01-21 13:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-21 13:31 [PATCH 0/8] cr0/cr4/efer/fpu miscellaneous bits Avi Kivity
2010-01-21 13:31 ` [PATCH 1/8] KVM: Allow kvm_load_guest_fpu() even when !vcpu->fpu_active Avi Kivity
2010-01-21 13:31 ` [PATCH 2/8] KVM: Drop kvm_{load,put}_guest_fpu() exports Avi Kivity
2010-01-21 13:31 ` [PATCH 3/8] KVM: Activate fpu on clts Avi Kivity
2010-01-23 18:56 ` Marcelo Tosatti
2010-01-24 7:20 ` Avi Kivity
2010-02-02 8:16 ` Paolo Bonzini
2010-02-03 10:23 ` Gleb Natapov
2010-02-04 13:05 ` Avi Kivity
2010-02-04 13:11 ` Gleb Natapov
2010-02-04 17:56 ` Avi Kivity
2010-02-07 12:25 ` Avi Kivity
2010-01-21 13:31 ` [PATCH 4/8] KVM: Add a helper for checking if the guest is in protected mode Avi Kivity
2010-01-21 13:31 ` Avi Kivity [this message]
2010-01-21 13:31 ` [PATCH 6/8] KVM: Rename vcpu->shadow_efer to efer Avi Kivity
2010-01-21 13:31 ` [PATCH 7/8] KVM: Optimize kvm_read_cr[04]_bits() Avi Kivity
2010-02-05 8:26 ` Jan Kiszka
2010-02-07 12:05 ` Avi Kivity
2010-02-07 12:33 ` Jan Kiszka
2010-02-07 12:37 ` Avi Kivity
2010-02-07 13:20 ` Jan Kiszka
2010-01-21 13:31 ` [PATCH 8/8] KVM: trace guest fpu loads and unloads Avi Kivity
2010-01-23 19:02 ` [PATCH 0/8] cr0/cr4/efer/fpu miscellaneous bits Marcelo Tosatti
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=1264080712-3981-6-git-send-email-avi@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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