aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2006-12-13 03:34:01 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-13 12:05:47 -0500
commit7725f0badd6682e5bcc06f38eedf0123712a3f60 (patch)
treebee0e576e61c4551658f3ae463964815baf41691 /drivers/kvm/kvm_main.c
parentf7fbf1fdf0d79241f5cc95310b96f0c52452ab39 (diff)
[PATCH] KVM: Move find_vmx_entry() to vmx.c
Signed-off-by: Avi Kivity <avi@qumranet.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r--drivers/kvm/kvm_main.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index f8f11c75ecbd..088a445d1df7 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -72,17 +72,6 @@ static struct dentry *debugfs_dir;
72#define CR8_RESEVED_BITS (~0x0fULL) 72#define CR8_RESEVED_BITS (~0x0fULL)
73#define EFER_RESERVED_BITS 0xfffffffffffff2fe 73#define EFER_RESERVED_BITS 0xfffffffffffff2fe
74 74
75struct vmx_msr_entry *find_msr_entry(struct kvm_vcpu *vcpu, u32 msr)
76{
77 int i;
78
79 for (i = 0; i < vcpu->nmsrs; ++i)
80 if (vcpu->guest_msrs[i].index == msr)
81 return &vcpu->guest_msrs[i];
82 return 0;
83}
84EXPORT_SYMBOL_GPL(find_msr_entry);
85
86#ifdef CONFIG_X86_64 75#ifdef CONFIG_X86_64
87// LDT or TSS descriptor in the GDT. 16 bytes. 76// LDT or TSS descriptor in the GDT. 16 bytes.
88struct segment_descriptor_64 { 77struct segment_descriptor_64 {
@@ -1124,8 +1113,6 @@ static int get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
1124 1113
1125void set_efer(struct kvm_vcpu *vcpu, u64 efer) 1114void set_efer(struct kvm_vcpu *vcpu, u64 efer)
1126{ 1115{
1127 struct vmx_msr_entry *msr;
1128
1129 if (efer & EFER_RESERVED_BITS) { 1116 if (efer & EFER_RESERVED_BITS) {
1130 printk(KERN_DEBUG "set_efer: 0x%llx #GP, reserved bits\n", 1117 printk(KERN_DEBUG "set_efer: 0x%llx #GP, reserved bits\n",
1131 efer); 1118 efer);
@@ -1140,16 +1127,12 @@ void set_efer(struct kvm_vcpu *vcpu, u64 efer)
1140 return; 1127 return;
1141 } 1128 }
1142 1129
1130 kvm_arch_ops->set_efer(vcpu, efer);
1131
1143 efer &= ~EFER_LMA; 1132 efer &= ~EFER_LMA;
1144 efer |= vcpu->shadow_efer & EFER_LMA; 1133 efer |= vcpu->shadow_efer & EFER_LMA;
1145 1134
1146 vcpu->shadow_efer = efer; 1135 vcpu->shadow_efer = efer;
1147
1148 msr = find_msr_entry(vcpu, MSR_EFER);
1149
1150 if (!(efer & EFER_LMA))
1151 efer &= ~EFER_LME;
1152 msr->data = efer;
1153} 1136}
1154EXPORT_SYMBOL_GPL(set_efer); 1137EXPORT_SYMBOL_GPL(set_efer);
1155 1138