|
@@ -119,6 +119,57 @@ extern bool __rpte_sub_valid(real_pte_t rpte, unsigned long index);
|
|
|
#define pgd_pte(pgd) (pud_pte(((pud_t){ pgd })))
|
|
|
#define pte_pgd(pte) ((pgd_t)pte_pud(pte))
|
|
|
|
|
|
+#ifdef CONFIG_HUGETLB_PAGE
|
|
|
+/*
|
|
|
+ * We have PGD_INDEX_SIZ = 12 and PTE_INDEX_SIZE = 8, so that we can have
|
|
|
+ * 16GB hugepage pte in PGD and 16MB hugepage pte at PMD;
|
|
|
+ *
|
|
|
+ * Defined in such a way that we can optimize away code block at build time
|
|
|
+ * if CONFIG_HUGETLB_PAGE=n.
|
|
|
+ */
|
|
|
+static inline int pmd_huge(pmd_t pmd)
|
|
|
+{
|
|
|
+ /*
|
|
|
+ * leaf pte for huge page, bottom two bits != 00
|
|
|
+ */
|
|
|
+ return ((pmd_val(pmd) & 0x3) != 0x0);
|
|
|
+}
|
|
|
+
|
|
|
+static inline int pud_huge(pud_t pud)
|
|
|
+{
|
|
|
+ /*
|
|
|
+ * leaf pte for huge page, bottom two bits != 00
|
|
|
+ */
|
|
|
+ return ((pud_val(pud) & 0x3) != 0x0);
|
|
|
+}
|
|
|
+
|
|
|
+static inline int pgd_huge(pgd_t pgd)
|
|
|
+{
|
|
|
+ /*
|
|
|
+ * leaf pte for huge page, bottom two bits != 00
|
|
|
+ */
|
|
|
+ return ((pgd_val(pgd) & 0x3) != 0x0);
|
|
|
+}
|
|
|
+#define pgd_huge pgd_huge
|
|
|
+
|
|
|
+#ifdef CONFIG_DEBUG_VM
|
|
|
+extern int hugepd_ok(hugepd_t hpd);
|
|
|
+#define is_hugepd(hpd) (hugepd_ok(hpd))
|
|
|
+#else
|
|
|
+/*
|
|
|
+ * With 64k page size, we have hugepage ptes in the pgd and pmd entries. We don't
|
|
|
+ * need to setup hugepage directory for them. Our pte and page directory format
|
|
|
+ * enable us to have this enabled.
|
|
|
+ */
|
|
|
+static inline int hugepd_ok(hugepd_t hpd)
|
|
|
+{
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+#define is_hugepd(pdep) 0
|
|
|
+#endif /* CONFIG_DEBUG_VM */
|
|
|
+
|
|
|
+#endif /* CONFIG_HUGETLB_PAGE */
|
|
|
+
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
|
|
#endif /* _ASM_POWERPC_BOOK3S_64_HASH_64K_H */
|