[PATCH v3] KVM: Move gfn_to_memslot() to kvm_host.h

Alexander Graf agraf at suse.de
Tue Jan 17 00:30:41 EST 2012

On 13.01.2012, at 07:09, Paul Mackerras wrote:

> This moves __gfn_to_memslot() and search_memslots() from kvm_main.c to
> kvm_host.h to reduce the code duplication caused by the need for
> non-modular code in arch/powerpc/kvm/book3s_hv_rm_mmu.c to call
> gfn_to_memslot() in real mode.
> Rather than putting gfn_to_memslot() itself in a header, which would
> lead to increased code size, this puts __gfn_to_memslot() in a header.
> Then, the non-modular uses of gfn_to_memslot() are changed to call
> __gfn_to_memslot() instead.  This way there is only one place in the
> source code that needs to be changed should the gfn_to_memslot()
> implementation need to be modified.
> On powerpc, the Book3S HV style of KVM has code that is called from
> real mode which needs to call gfn_to_memslot() and thus needs this.
> (Module code is allocated in the vmalloc region, which can't be
> accessed in real mode.)
> With this, we can remove builtin_gfn_to_memslot() from book3s_hv_rm_mmu.c.

Which tree is this against? I got this diff between your patch and the patch when applied on my tree:

-@@ -97,7 +78,7 @@ static void remove_revmap_chain(struct kvm *kvm, long pte_index,
- 	rev = real_vmalloc_addr(&kvm->arch.revmap[pte_index]);
- 	ptel = rev->guest_rpte;
+@@ -99,7 +80,7 @@ static void remove_revmap_chain(struct kvm *kvm, long pte_index,
+ 	rcbits = hpte_r & (HPTE_R_R | HPTE_R_C);
+ 	ptel = rev->guest_rpte |= rcbits;

Since this is completely unrelated to the actual change, I'll apply the patch either way. It'd just be interesting to know.


More information about the Linuxppc-dev mailing list