|
Message-Id: <20181207124803.10828-4-ahmedsoliman@mena.vt.edu> Date: Fri, 7 Dec 2018 14:47:56 +0200 From: Ahmed Abd El Mawgood <ahmedsoliman@...a.vt.edu> To: Paolo Bonzini <pbonzini@...hat.com>, rkrcmar@...hat.com, Jonathan Corbet <corbet@....net>, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, hpa@...or.com, x86@...nel.org, kvm@...r.kernel.org, linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org, ahmedsoliman0x666@...il.com, ovich00@...il.com, kernel-hardening@...ts.openwall.com, nigel.edwards@....com, Boris Lukashev <blukashev@...pervictus.com>, Igor Stoppa <igor.stoppa@...il.com> Cc: Ahmed Abd El Mawgood <ahmedsoliman@...a.vt.edu> Subject: [PATCH 03/10] KVM: X86: Add helper function to convert SPTE to GFN Signed-off-by: Ahmed Abd El Mawgood <ahmedsoliman@...a.vt.edu> --- arch/x86/kvm/mmu.c | 7 +++++++ arch/x86/kvm/mmu.h | 1 + 2 files changed, 8 insertions(+) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index b67d743c33..a300e4acb8 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1024,6 +1024,13 @@ static gfn_t kvm_mmu_page_get_gfn(struct kvm_mmu_page *sp, int index) return sp->gfn + (index << ((sp->role.level - 1) * PT64_LEVEL_BITS)); } +gfn_t spte_to_gfn(u64 *spte) +{ + struct kvm_mmu_page *sp; + + sp = page_header(__pa(spte)); + return kvm_mmu_page_get_gfn(sp, spte - sp->spt); +} static void kvm_mmu_page_set_gfn(struct kvm_mmu_page *sp, int index, gfn_t gfn) { diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index c7b333147c..49d7f2f002 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h @@ -211,4 +211,5 @@ void kvm_mmu_gfn_allow_lpage(struct kvm_memory_slot *slot, gfn_t gfn); bool kvm_mmu_slot_gfn_write_protect(struct kvm *kvm, struct kvm_memory_slot *slot, u64 gfn); int kvm_arch_write_log_dirty(struct kvm_vcpu *vcpu); +gfn_t spte_to_gfn(u64 *sptep); #endif -- 2.19.2
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.