diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2016-02-15 12:55:03 +1100 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2016-02-16 13:44:26 +1100 |
commit | e9ab1a1cafb7911df1550a285f2f733ea5920f55 (patch) | |
tree | 0a63e35cd571c6083440e4e8c3fb02bf23c27a6e /arch/powerpc/mm/pgtable.c | |
parent | 178a787502123b01499c5a4617b94bb69ad49dd5 (diff) | |
download | op-kernel-dev-e9ab1a1cafb7911df1550a285f2f733ea5920f55.zip op-kernel-dev-e9ab1a1cafb7911df1550a285f2f733ea5920f55.tar.gz |
powerpc: Make vmalloc_to_phys() public
This makes vmalloc_to_phys() public as there will be another user
(KVM in-kernel VFIO acceleration) for it soon. As this new user
can be compiled as a module, this exports the symbol.
As a little optimization, this changes the helper to call
vmalloc_to_pfn() instead of vmalloc_to_page() as the size of the
struct page may not be power-of-two aligned which will make gcc use
multiply instructions instead of shifts.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/mm/pgtable.c')
-rw-r--r-- | arch/powerpc/mm/pgtable.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c index 83dfd79..de37ff4 100644 --- a/arch/powerpc/mm/pgtable.c +++ b/arch/powerpc/mm/pgtable.c @@ -243,3 +243,11 @@ void assert_pte_locked(struct mm_struct *mm, unsigned long addr) } #endif /* CONFIG_DEBUG_VM */ +unsigned long vmalloc_to_phys(void *va) +{ + unsigned long pfn = vmalloc_to_pfn(va); + + BUG_ON(!pfn); + return __pa(pfn_to_kaddr(pfn)) + offset_in_page(va); +} +EXPORT_SYMBOL_GPL(vmalloc_to_phys); |