diff options
author | Avi Kivity <avi@redhat.com> | 2010-01-21 08:31:49 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:36:04 -0500 |
commit | 836a1b3c3456042704c86aaa3d837b976de9343b (patch) | |
tree | cf40744cf19a2e0bc407913ac86d53081116b022 /arch/x86/kvm | |
parent | 3eeb3288bcbf64da90afc26389b8844df7c34912 (diff) |
KVM: Move cr0/cr4/efer related helpers to x86.h
They have more general scope than the mmu.
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/emulate.c | 1 | ||||
-rw-r--r-- | arch/x86/kvm/mmu.c | 1 | ||||
-rw-r--r-- | arch/x86/kvm/mmu.h | 24 | ||||
-rw-r--r-- | 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 6a429eefc533..645b245a3c23 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <asm/kvm_emulate.h> | 33 | #include <asm/kvm_emulate.h> |
34 | 34 | ||
35 | #include "x86.h" | 35 | #include "x86.h" |
36 | #include "mmu.h" /* for is_long_mode() */ | ||
37 | 36 | ||
38 | /* | 37 | /* |
39 | * Opcode effective-address decode tables. | 38 | * Opcode effective-address decode tables. |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index ff2b2e8d72eb..6f7158f4fbfd 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -18,6 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "mmu.h" | 20 | #include "mmu.h" |
21 | #include "x86.h" | ||
21 | #include "kvm_cache_regs.h" | 22 | #include "kvm_cache_regs.h" |
22 | 23 | ||
23 | #include <linux/kvm_host.h> | 24 | #include <linux/kvm_host.h> |
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index 599159f728b9..61ef5a65b7d8 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) | |||
58 | return kvm_mmu_load(vcpu); | 58 | return kvm_mmu_load(vcpu); |
59 | } | 59 | } |
60 | 60 | ||
61 | static inline int is_long_mode(struct kvm_vcpu *vcpu) | ||
62 | { | ||
63 | #ifdef CONFIG_X86_64 | ||
64 | return vcpu->arch.shadow_efer & EFER_LMA; | ||
65 | #else | ||
66 | return 0; | ||
67 | #endif | ||
68 | } | ||
69 | |||
70 | static inline int is_pae(struct kvm_vcpu *vcpu) | ||
71 | { | ||
72 | return kvm_read_cr4_bits(vcpu, X86_CR4_PAE); | ||
73 | } | ||
74 | |||
75 | static inline int is_pse(struct kvm_vcpu *vcpu) | ||
76 | { | ||
77 | return kvm_read_cr4_bits(vcpu, X86_CR4_PSE); | ||
78 | } | ||
79 | |||
80 | static inline int is_paging(struct kvm_vcpu *vcpu) | ||
81 | { | ||
82 | return kvm_read_cr0_bits(vcpu, X86_CR0_PG); | ||
83 | } | ||
84 | |||
85 | static inline int is_present_gpte(unsigned long pte) | 61 | static inline int is_present_gpte(unsigned long pte) |
86 | { | 62 | { |
87 | return pte & PT_PRESENT_MASK; | 63 | return pte & PT_PRESENT_MASK; |
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index f783d8fe0d1d..2dc24a755b6d 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) | |||
41 | return kvm_read_cr0_bits(vcpu, X86_CR0_PE); | 41 | return kvm_read_cr0_bits(vcpu, X86_CR0_PE); |
42 | } | 42 | } |
43 | 43 | ||
44 | static inline int is_long_mode(struct kvm_vcpu *vcpu) | ||
45 | { | ||
46 | #ifdef CONFIG_X86_64 | ||
47 | return vcpu->arch.shadow_efer & EFER_LMA; | ||
48 | #else | ||
49 | return 0; | ||
50 | #endif | ||
51 | } | ||
52 | |||
53 | static inline int is_pae(struct kvm_vcpu *vcpu) | ||
54 | { | ||
55 | return kvm_read_cr4_bits(vcpu, X86_CR4_PAE); | ||
56 | } | ||
57 | |||
58 | static inline int is_pse(struct kvm_vcpu *vcpu) | ||
59 | { | ||
60 | return kvm_read_cr4_bits(vcpu, X86_CR4_PSE); | ||
61 | } | ||
62 | |||
63 | static inline int is_paging(struct kvm_vcpu *vcpu) | ||
64 | { | ||
65 | return kvm_read_cr0_bits(vcpu, X86_CR0_PG); | ||
66 | } | ||
67 | |||
44 | #endif | 68 | #endif |