aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorBharat Bhushan <r65777@freescale.com>2013-11-15 00:31:15 -0500
committerAlexander Graf <agraf@suse.de>2014-01-09 04:15:07 -0500
commitf5e3fe091f5238459752a81b478398b7cb22e575 (patch)
tree89cd631e5516c316611fac1008553d5ca8cabb90 /arch/powerpc
parent7c85e6b39ce880869929958bd7b95f72db03a9af (diff)
kvm: powerpc: define a linux pte lookup function
We need to search linux "pte" to get "pte" attributes for setting TLB in KVM. This patch defines a lookup_linux_ptep() function which returns pte pointer. Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com> Reviewed-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/pgtable.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 7d6eacf249cf..b60ceb8d86c8 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -223,6 +223,27 @@ extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
223#endif 223#endif
224pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, 224pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
225 unsigned *shift); 225 unsigned *shift);
226
227static inline pte_t *lookup_linux_ptep(pgd_t *pgdir, unsigned long hva,
228 unsigned long *pte_sizep)
229{
230 pte_t *ptep;
231 unsigned long ps = *pte_sizep;
232 unsigned int shift;
233
234 ptep = find_linux_pte_or_hugepte(pgdir, hva, &shift);
235 if (!ptep)
236 return NULL;
237 if (shift)
238 *pte_sizep = 1ul << shift;
239 else
240 *pte_sizep = PAGE_SIZE;
241
242 if (ps > *pte_sizep)
243 return NULL;
244
245 return ptep;
246}
226#endif /* __ASSEMBLY__ */ 247#endif /* __ASSEMBLY__ */
227 248
228#endif /* __KERNEL__ */ 249#endif /* __KERNEL__ */