Make the powerpc PMD PFN helper use PTE-level pgprot_t as the basic format.
pmd_pgprot() currently derives pgprot_t from the PMD entry through pte_pgprot(). Some PMD leaf entries can carry H_PAGE_THP_HUGE, which is specific to huge PMDs and should not be propagated into PTE-level pgprot_t. Mask H_PAGE_THP_HUGE out in pmd_pgprot(). Signed-off-by: Yin Tirui <[email protected]> --- arch/powerpc/include/asm/pgtable.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index d20ff2ae02f5..0f368ea64b1f 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h @@ -67,7 +67,16 @@ static inline pgprot_t pte_pgprot(pte_t pte) #define pmd_pgprot pmd_pgprot static inline pgprot_t pmd_pgprot(pmd_t pmd) { - return pte_pgprot(pmd_pte(pmd)); + pgprot_t prot = pte_pgprot(pmd_pte(pmd)); + + /* + * pmd_pgprot() returns PTE-level pgprot_t. H_PAGE_THP_HUGE is specific + * to huge PMDs. + */ +#ifdef H_PAGE_THP_HUGE + prot = __pgprot(pgprot_val(prot) & ~H_PAGE_THP_HUGE); +#endif + return prot; } #define pud_pgprot pud_pgprot -- 2.43.0
