Commit 691cdf01 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc: Rely on generic definition of hugepd_t and is_hugepd when unused

CONFIG_ARCH_HAS_HUGEPD is used to tell core mm when huge page
directories are used.

When they are not used, no need to provide hugepd_t or is_hugepd(),
just rely on the core mm fallback definition.

For that, change core mm behaviour so that CONFIG_ARCH_HAS_HUGEPD
is used instead of indirect is_hugepd macro existence.

powerpc being the only user of huge page directories, there is no
impact on other architectures.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/da81462d93069bb90fe5e762dd3283a644318937.1662543243.git.christophe.leroy@csgroup.eu
parent a26494cf
...@@ -308,11 +308,6 @@ static inline bool pfn_valid(unsigned long pfn) ...@@ -308,11 +308,6 @@ static inline bool pfn_valid(unsigned long pfn)
#include <asm/pgtable-types.h> #include <asm/pgtable-types.h>
#endif #endif
#ifndef CONFIG_HUGETLB_PAGE
#define is_hugepd(pdep) (0)
#endif /* CONFIG_HUGETLB_PAGE */
struct page; struct page;
extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
extern void copy_user_page(void *to, void *from, unsigned long vaddr, extern void copy_user_page(void *to, void *from, unsigned long vaddr,
......
...@@ -101,6 +101,7 @@ static inline bool pmd_xchg(pmd_t *pmdp, pmd_t old, pmd_t new) ...@@ -101,6 +101,7 @@ static inline bool pmd_xchg(pmd_t *pmdp, pmd_t old, pmd_t new)
return pmd_raw(old) == prev; return pmd_raw(old) == prev;
} }
#ifdef CONFIG_ARCH_HAS_HUGEPD
typedef struct { __be64 pdbe; } hugepd_t; typedef struct { __be64 pdbe; } hugepd_t;
#define __hugepd(x) ((hugepd_t) { cpu_to_be64(x) }) #define __hugepd(x) ((hugepd_t) { cpu_to_be64(x) })
...@@ -108,5 +109,6 @@ static inline unsigned long hpd_val(hugepd_t x) ...@@ -108,5 +109,6 @@ static inline unsigned long hpd_val(hugepd_t x)
{ {
return be64_to_cpu(x.pdbe); return be64_to_cpu(x.pdbe);
} }
#endif
#endif /* _ASM_POWERPC_PGTABLE_BE_TYPES_H */ #endif /* _ASM_POWERPC_PGTABLE_BE_TYPES_H */
...@@ -83,11 +83,13 @@ static inline bool pte_xchg(pte_t *ptep, pte_t old, pte_t new) ...@@ -83,11 +83,13 @@ static inline bool pte_xchg(pte_t *ptep, pte_t old, pte_t new)
} }
#endif #endif
#ifdef CONFIG_ARCH_HAS_HUGEPD
typedef struct { unsigned long pd; } hugepd_t; typedef struct { unsigned long pd; } hugepd_t;
#define __hugepd(x) ((hugepd_t) { (x) }) #define __hugepd(x) ((hugepd_t) { (x) })
static inline unsigned long hpd_val(hugepd_t x) static inline unsigned long hpd_val(hugepd_t x)
{ {
return x.pd; return x.pd;
} }
#endif
#endif /* _ASM_POWERPC_PGTABLE_TYPES_H */ #endif /* _ASM_POWERPC_PGTABLE_TYPES_H */
...@@ -17,7 +17,7 @@ struct ctl_table; ...@@ -17,7 +17,7 @@ struct ctl_table;
struct user_struct; struct user_struct;
struct mmu_gather; struct mmu_gather;
#ifndef is_hugepd #ifndef CONFIG_ARCH_HAS_HUGEPD
typedef struct { unsigned long pd; } hugepd_t; typedef struct { unsigned long pd; } hugepd_t;
#define is_hugepd(hugepd) (0) #define is_hugepd(hugepd) (0)
#define __hugepd(x) ((hugepd_t) { (x) }) #define __hugepd(x) ((hugepd_t) { (x) })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment