From cc0808eb40609e5ec008cf8466ad6917acaefb21 Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Fri, 10 Sep 2010 17:30:48 +0200 Subject: [PATCH] --- yaml --- r: 215871 b: refs/heads/master c: c30a358d33e0e111f06e54a4a4125371e6b6693c h: refs/heads/master i: 215869: 85e57b72818a6454364405f31632790eeb980f47 215867: eb27feaa91b69811e0bc7b7358ed0b6aafaf910d 215863: dabbb60ec186e17e46307dd6f3242ceb12f60574 215855: 02dfd3fc5b4d43f1417c8b4e8df9179a5d0870ee 215839: 9935b60867f45b37d6988b3a7715e56a1bd080eb 215807: 499f63008a1eb2315bb21135f371b6266ef4f0b8 v: v3 --- [refs] | 2 +- trunk/arch/x86/include/asm/kvm_host.h | 1 + trunk/arch/x86/kvm/x86.c | 6 ++++++ trunk/include/linux/kvm_host.h | 5 +++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 591b94574447..4833b7ca0e66 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1e301feb079e8ee6091bb75283e960fc33059a68 +refs/heads/master: c30a358d33e0e111f06e54a4a4125371e6b6693c diff --git a/trunk/arch/x86/include/asm/kvm_host.h b/trunk/arch/x86/include/asm/kvm_host.h index 3fde5b322534..4915b7c8f2ec 100644 --- a/trunk/arch/x86/include/asm/kvm_host.h +++ b/trunk/arch/x86/include/asm/kvm_host.h @@ -243,6 +243,7 @@ struct kvm_mmu { void (*free)(struct kvm_vcpu *vcpu); gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva, u32 access, u32 *error); + gpa_t (*translate_gpa)(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access); void (*prefetch_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page); int (*sync_page)(struct kvm_vcpu *vcpu, diff --git a/trunk/arch/x86/kvm/x86.c b/trunk/arch/x86/kvm/x86.c index 48b74d2fbfb7..2364c2cad891 100644 --- a/trunk/arch/x86/kvm/x86.c +++ b/trunk/arch/x86/kvm/x86.c @@ -3448,6 +3448,11 @@ void kvm_get_segment(struct kvm_vcpu *vcpu, kvm_x86_ops->get_segment(vcpu, var, seg); } +static gpa_t translate_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access) +{ + return gpa; +} + gpa_t kvm_mmu_gva_to_gpa_read(struct kvm_vcpu *vcpu, gva_t gva, u32 *error) { 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) vcpu->arch.emulate_ctxt.ops = &emulate_ops; vcpu->arch.mmu.root_hpa = INVALID_PAGE; + vcpu->arch.mmu.translate_gpa = translate_gpa; if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu)) vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; else diff --git a/trunk/include/linux/kvm_host.h b/trunk/include/linux/kvm_host.h index f2ecdd52032b..917e68ff5ed2 100644 --- a/trunk/include/linux/kvm_host.h +++ b/trunk/include/linux/kvm_host.h @@ -534,6 +534,11 @@ static inline gpa_t gfn_to_gpa(gfn_t gfn) return (gpa_t)gfn << PAGE_SHIFT; } +static inline gfn_t gpa_to_gfn(gpa_t gpa) +{ + return (gfn_t)(gpa >> PAGE_SHIFT); +} + static inline hpa_t pfn_to_hpa(pfn_t pfn) { return (hpa_t)pfn << PAGE_SHIFT;