|
@@ -753,6 +753,24 @@ static int __init add_huge_page_size(unsigned long long size)
|
|
|
if ((mmu_psize = shift_to_mmu_psize(shift)) < 0)
|
|
|
return -EINVAL;
|
|
|
|
|
|
+#ifdef CONFIG_PPC_BOOK3S_64
|
|
|
+ /*
|
|
|
+ * We need to make sure that for different page sizes reported by
|
|
|
+ * firmware we only add hugetlb support for page sizes that can be
|
|
|
+ * supported by linux page table layout.
|
|
|
+ * For now we have
|
|
|
+ * Radix: 2M
|
|
|
+ * Hash: 16M and 16G
|
|
|
+ */
|
|
|
+ if (radix_enabled()) {
|
|
|
+ if (mmu_psize != MMU_PAGE_2M)
|
|
|
+ return -EINVAL;
|
|
|
+ } else {
|
|
|
+ if (mmu_psize != MMU_PAGE_16M && mmu_psize != MMU_PAGE_16G)
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
BUG_ON(mmu_psize_defs[mmu_psize].shift != shift);
|
|
|
|
|
|
/* Return if huge page size has already been setup */
|