diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2010-09-10 11:30:48 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-10-24 04:52:34 -0400 |
commit | c30a358d33e0e111f06e54a4a4125371e6b6693c (patch) | |
tree | bdd1d80f2eca1a63344b80f8e4353095cd06a947 /arch/x86/kvm/x86.c | |
parent | 1e301feb079e8ee6091bb75283e960fc33059a68 (diff) |
KVM: MMU: Add infrastructure for two-level page walker
This patch introduces a mmu-callback to translate gpa
addresses in the walk_addr code. This is later used to
translate l2_gpa addresses into l1_gpa addresses.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 48b74d2fbfb7..2364c2cad891 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -3448,6 +3448,11 @@ void kvm_get_segment(struct kvm_vcpu *vcpu, | |||
3448 | kvm_x86_ops->get_segment(vcpu, var, seg); | 3448 | kvm_x86_ops->get_segment(vcpu, var, seg); |
3449 | } | 3449 | } |
3450 | 3450 | ||
3451 | static gpa_t translate_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access) | ||
3452 | { | ||
3453 | return gpa; | ||
3454 | } | ||
3455 | |||
3451 | gpa_t kvm_mmu_gva_to_gpa_read(struct kvm_vcpu *vcpu, gva_t gva, u32 *error) | 3456 | gpa_t kvm_mmu_gva_to_gpa_read(struct kvm_vcpu *vcpu, gva_t gva, u32 *error) |
3452 | { | 3457 | { |
3453 | u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; | 3458 | u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; |
@@ -5659,6 +5664,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | |||
5659 | 5664 | ||
5660 | vcpu->arch.emulate_ctxt.ops = &emulate_ops; | 5665 | vcpu->arch.emulate_ctxt.ops = &emulate_ops; |
5661 | vcpu->arch.mmu.root_hpa = INVALID_PAGE; | 5666 | vcpu->arch.mmu.root_hpa = INVALID_PAGE; |
5667 | vcpu->arch.mmu.translate_gpa = translate_gpa; | ||
5662 | if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu)) | 5668 | if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu)) |
5663 | vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; | 5669 | vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; |
5664 | else | 5670 | else |