aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/kvm_book3s_64.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include/asm/kvm_book3s_64.h')
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_64.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h
index 300ec04a8381..7e6f2ede44ac 100644
--- a/arch/powerpc/include/asm/kvm_book3s_64.h
+++ b/arch/powerpc/include/asm/kvm_book3s_64.h
@@ -101,4 +101,16 @@ static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r,
101 return rb; 101 return rb;
102} 102}
103 103
104static inline unsigned long hpte_page_size(unsigned long h, unsigned long l)
105{
106 /* only handle 4k, 64k and 16M pages for now */
107 if (!(h & HPTE_V_LARGE))
108 return 1ul << 12; /* 4k page */
109 if ((l & 0xf000) == 0x1000 && cpu_has_feature(CPU_FTR_ARCH_206))
110 return 1ul << 16; /* 64k page */
111 if ((l & 0xff000) == 0)
112 return 1ul << 24; /* 16M page */
113 return 0; /* error */
114}
115
104#endif /* __ASM_KVM_BOOK3S_64_H__ */ 116#endif /* __ASM_KVM_BOOK3S_64_H__ */