[PATCH] KVM: Move gfn_to_memslot() to kvm_host.h
Alexander Graf
agraf at suse.de
Tue Jan 3 02:23:11 EST 2012
On 26.12.2011, at 14:22, Avi Kivity wrote:
> On 12/20/2011 11:21 AM, Paul Mackerras wrote:
>> This moves gfn_to_memslot(), and the functions it calls, that is,
>> search_memslots() and __gfn_to_memslot(), from kvm_main.c to kvm_host.h
>> so that gfn_to_memslot() can be called from non-modular code even
>> when KVM is a module. 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
>> and thus eliminate a little bit of duplication.
>
> Those functions are too big to be inlined IMO. How about moving them to
> another C file, and making it builtin for ppc?
>
> The only issue is what to call it. virt/kvm/builtin-for-ppc seems silly.
Yeah - and it makes it pretty confusing to find the functions then.
> Or we could move the implementation into a header file, with an extra __
> prefix, and have the C stubs call those inlines, so we have exactly on
> instantiation. Your real mode code can then call the inlines.
I like this version. That way everyone should be happy :)
Alex
More information about the Linuxppc-dev
mailing list