aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/powerpc/include/asm/nohash/hugetlb-book3e.h
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@c-s.fr>2019-04-26 05:59:44 +0000
committerMichael Ellerman <mpe@ellerman.id.au>2019-05-03 01:20:23 +1000
commit8197af22be01e7c9ab476138652e0dc8cd22a207 (patch)
treeec0a615f31e2b2ded8beb9c65fec9077d589147c /arch/powerpc/include/asm/nohash/hugetlb-book3e.h
parentpowerpc/mm: make gup_hugepte() static (diff)
downloadwireguard-linux-8197af22be01e7c9ab476138652e0dc8cd22a207.tar.xz
wireguard-linux-8197af22be01e7c9ab476138652e0dc8cd22a207.zip
powerpc/mm: split asm/hugetlb.h into dedicated subarch files
Three subarches support hugepages: - fsl book3e - book3s/64 - 8xx This patch splits asm/hugetlb.h to reduce the #ifdef mess. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to '')
-rw-r--r--arch/powerpc/include/asm/nohash/hugetlb-book3e.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/nohash/hugetlb-book3e.h b/arch/powerpc/include/asm/nohash/hugetlb-book3e.h
new file mode 100644
index 000000000000..e94f1cd048ee
--- /dev/null
+++ b/arch/powerpc/include/asm/nohash/hugetlb-book3e.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_POWERPC_NOHASH_HUGETLB_BOOK3E_H
+#define _ASM_POWERPC_NOHASH_HUGETLB_BOOK3E_H
+
+static inline pte_t *hugepd_page(hugepd_t hpd)
+{
+ if (WARN_ON(!hugepd_ok(hpd)))
+ return NULL;
+
+ return (pte_t *)((hpd_val(hpd) & ~HUGEPD_SHIFT_MASK) | PD_HUGE);
+}
+
+static inline unsigned int hugepd_shift(hugepd_t hpd)
+{
+ return hpd_val(hpd) & HUGEPD_SHIFT_MASK;
+}
+
+static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr,
+ unsigned int pdshift)
+{
+ /*
+ * On FSL BookE, we have multiple higher-level table entries that
+ * point to the same hugepte. Just use the first one since they're all
+ * identical. So for that case, idx=0.
+ */
+ return hugepd_page(hpd);
+}
+
+void flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
+
+#endif /* _ASM_POWERPC_NOHASH_HUGETLB_BOOK3E_H */