aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>2011-11-28 07:42:16 -0500
committerAvi Kivity <avi@redhat.com>2011-12-27 04:22:09 -0500
commite459e3228dc57f7160e564ce0f09edb5bee656d3 (patch)
treeaa3b61d28e69a094f0c7906de40c5fcdca38b3d6 /arch/x86/kvm
parent9edb17d55f3ea4943f9654f2aad7a99b4c55840a (diff)
KVM: MMU: move the relevant mmu code to mmu.c
Move the mmu code in kvm_arch_vcpu_init() to kvm_mmu_create() Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/mmu.c6
-rw-r--r--arch/x86/kvm/x86.c11
2 files changed, 6 insertions, 11 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 62f69dbf6b52..262a3af1f0ec 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3839,7 +3839,11 @@ static int alloc_mmu_pages(struct kvm_vcpu *vcpu)
3839int kvm_mmu_create(struct kvm_vcpu *vcpu) 3839int kvm_mmu_create(struct kvm_vcpu *vcpu)
3840{ 3840{
3841 ASSERT(vcpu); 3841 ASSERT(vcpu);
3842 ASSERT(!VALID_PAGE(vcpu->arch.mmu.root_hpa)); 3842
3843 vcpu->arch.walk_mmu = &vcpu->arch.mmu;
3844 vcpu->arch.mmu.root_hpa = INVALID_PAGE;
3845 vcpu->arch.mmu.translate_gpa = translate_gpa;
3846 vcpu->arch.nested_mmu.translate_gpa = translate_nested_gpa;
3843 3847
3844 return alloc_mmu_pages(vcpu); 3848 return alloc_mmu_pages(vcpu);
3845} 3849}
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 465053151a2d..d99976e4451e 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3430,12 +3430,7 @@ void kvm_get_segment(struct kvm_vcpu *vcpu,
3430 kvm_x86_ops->get_segment(vcpu, var, seg); 3430 kvm_x86_ops->get_segment(vcpu, var, seg);
3431} 3431}
3432 3432
3433static gpa_t translate_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access) 3433gpa_t translate_nested_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access)
3434{
3435 return gpa;
3436}
3437
3438static gpa_t translate_nested_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access)
3439{ 3434{
3440 gpa_t t_gpa; 3435 gpa_t t_gpa;
3441 struct x86_exception exception; 3436 struct x86_exception exception;
@@ -5915,10 +5910,6 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
5915 kvm = vcpu->kvm; 5910 kvm = vcpu->kvm;
5916 5911
5917 vcpu->arch.emulate_ctxt.ops = &emulate_ops; 5912 vcpu->arch.emulate_ctxt.ops = &emulate_ops;
5918 vcpu->arch.walk_mmu = &vcpu->arch.mmu;
5919 vcpu->arch.mmu.root_hpa = INVALID_PAGE;
5920 vcpu->arch.mmu.translate_gpa = translate_gpa;
5921 vcpu->arch.nested_mmu.translate_gpa = translate_nested_gpa;
5922 if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu)) 5913 if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu))
5923 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; 5914 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
5924 else 5915 else