If X2TLB=y (CPU_SHX2=y or CPU_SHX3=y, e.g. migor_defconfig), pgd_t.pgd is "unsigned long long", causing: In file included from arch/sh/include/asm/pgtable.h:13, from include/linux/pgtable.h:6, from include/linux/mm.h:33, from arch/sh/kernel/asm-offsets.c:14: arch/sh/include/asm/pgtable-3level.h: In function `pud_pgtable': arch/sh/include/asm/pgtable-3level.h:37:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 37 | return (pmd_t *)pud_val(pud); | ^ Fix this by adding an intermediate cast to "unsigned long", which is basically what the old code did before. Link: https://lkml.kernel.org/r/2c2eef3c9a2f57e5609100a4864715ccf253d30f.1631713483.git.geert+renesas@glider.be Fixes: 9cf6fa2458443118 ("mm: rename pud_page_vaddr to pud_pgtable and make it return pmd_t *") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Tested-by: Daniel Palmer <daniel@thingy.jp> Acked-by: Rob Landley <rob@landley.net> Cc: Yoshinori Sato <ysato@users.osdn.me> Cc: Rich Felker <dalias@libc.org> Cc: "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com> Cc: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
54 lines
1.4 KiB
C
54 lines
1.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __ASM_SH_PGTABLE_3LEVEL_H
|
|
#define __ASM_SH_PGTABLE_3LEVEL_H
|
|
|
|
#include <asm-generic/pgtable-nopud.h>
|
|
|
|
/*
|
|
* Some cores need a 3-level page table layout, for example when using
|
|
* 64-bit PTEs and 4K pages.
|
|
*/
|
|
#define PAGETABLE_LEVELS 3
|
|
|
|
#define PTE_MAGNITUDE 3 /* 64-bit PTEs on SH-X2 TLB */
|
|
|
|
/* PGD bits */
|
|
#define PGDIR_SHIFT 30
|
|
|
|
#define PTRS_PER_PGD 4
|
|
#define USER_PTRS_PER_PGD 2
|
|
|
|
/* PMD bits */
|
|
#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT - PTE_MAGNITUDE))
|
|
#define PMD_SIZE (1UL << PMD_SHIFT)
|
|
#define PMD_MASK (~(PMD_SIZE-1))
|
|
|
|
#define PTRS_PER_PMD ((1 << PGDIR_SHIFT) / PMD_SIZE)
|
|
|
|
#define pmd_ERROR(e) \
|
|
printk("%s:%d: bad pmd %016llx.\n", __FILE__, __LINE__, pmd_val(e))
|
|
|
|
typedef struct { unsigned long long pmd; } pmd_t;
|
|
#define pmd_val(x) ((x).pmd)
|
|
#define __pmd(x) ((pmd_t) { (x) } )
|
|
|
|
static inline pmd_t *pud_pgtable(pud_t pud)
|
|
{
|
|
return (pmd_t *)(unsigned long)pud_val(pud);
|
|
}
|
|
|
|
/* only used by the stubbed out hugetlb gup code, should never be called */
|
|
#define pud_page(pud) NULL
|
|
#define pud_none(x) (!pud_val(x))
|
|
#define pud_present(x) (pud_val(x))
|
|
#define pud_clear(xp) do { set_pud(xp, __pud(0)); } while (0)
|
|
#define pud_bad(x) (pud_val(x) & ~PAGE_MASK)
|
|
|
|
/*
|
|
* (puds are folded into pgds so this doesn't get actually called,
|
|
* but the define is needed for a generic inline function.)
|
|
*/
|
|
#define set_pud(pudptr, pudval) do { *(pudptr) = (pudval); } while(0)
|
|
|
|
#endif /* __ASM_SH_PGTABLE_3LEVEL_H */
|