forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/arch/powerpc/include/asm/pte-walk.h
....@@ -10,8 +10,20 @@
1010 static inline pte_t *find_linux_pte(pgd_t *pgdir, unsigned long ea,
1111 bool *is_thp, unsigned *hshift)
1212 {
13
+ pte_t *pte;
14
+
1315 VM_WARN(!arch_irqs_disabled(), "%s called with irq enabled\n", __func__);
14
- return __find_linux_pte(pgdir, ea, is_thp, hshift);
16
+ pte = __find_linux_pte(pgdir, ea, is_thp, hshift);
17
+
18
+#if defined(CONFIG_DEBUG_VM) && \
19
+ !(defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE))
20
+ /*
21
+ * We should not find huge page if these configs are not enabled.
22
+ */
23
+ if (hshift)
24
+ WARN_ON(*hshift);
25
+#endif
26
+ return pte;
1527 }
1628
1729 static inline pte_t *find_init_mm_pte(unsigned long ea, unsigned *hshift)
....@@ -26,10 +38,22 @@
2638 static inline pte_t *find_current_mm_pte(pgd_t *pgdir, unsigned long ea,
2739 bool *is_thp, unsigned *hshift)
2840 {
41
+ pte_t *pte;
42
+
2943 VM_WARN(!arch_irqs_disabled(), "%s called with irq enabled\n", __func__);
3044 VM_WARN(pgdir != current->mm->pgd,
3145 "%s lock less page table lookup called on wrong mm\n", __func__);
32
- return __find_linux_pte(pgdir, ea, is_thp, hshift);
46
+ pte = __find_linux_pte(pgdir, ea, is_thp, hshift);
47
+
48
+#if defined(CONFIG_DEBUG_VM) && \
49
+ !(defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE))
50
+ /*
51
+ * We should not find huge page if these configs are not enabled.
52
+ */
53
+ if (hshift)
54
+ WARN_ON(*hshift);
55
+#endif
56
+ return pte;
3357 }
3458
3559 #endif /* _ASM_POWERPC_PTE_WALK_H */