Skip to content

Commit 55d5d74

Browse files
mpemehmetb0
authored andcommitted
powerpc/64s/mm: Move __real_pte stubs into hash-4k.h
BugLink: https://bugs.launchpad.net/bugs/2106494 [ Upstream commit 8ae4f16 ] The stub versions of __real_pte() etc are only used with HPT & 4K pages, so move them into the hash-4k.h header. Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected] Stable-dep-of: 61bcc75 ("powerpc/64s: Rewrite __real_pte() and __rpte_to_hidx() as static inline") Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Noah Wager <[email protected]> Signed-off-by: Mehmet Basaran <[email protected]>
1 parent b752c43 commit 55d5d74

File tree

2 files changed

+20
-26
lines changed

2 files changed

+20
-26
lines changed

arch/powerpc/include/asm/book3s/64/hash-4k.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,26 @@
7474
#define remap_4k_pfn(vma, addr, pfn, prot) \
7575
remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, (prot))
7676

77+
/*
78+
* With 4K page size the real_pte machinery is all nops.
79+
*/
80+
#define __real_pte(e, p, o) ((real_pte_t){(e)})
81+
#define __rpte_to_pte(r) ((r).pte)
82+
#define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT)
83+
84+
#define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \
85+
do { \
86+
index = 0; \
87+
shift = mmu_psize_defs[psize].shift; \
88+
89+
#define pte_iterate_hashed_end() } while(0)
90+
91+
/*
92+
* We expect this to be called only for user addresses or kernel virtual
93+
* addresses other than the linear mapping.
94+
*/
95+
#define pte_pagesize_index(mm, addr, pte) MMU_PAGE_4K
96+
7797
/*
7898
* 4K PTE format is different from 64K PTE format. Saving the hash_slot is just
7999
* a matter of returning the PTE bits that need to be modified. On 64K PTE,

arch/powerpc/include/asm/book3s/64/pgtable.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -330,32 +330,6 @@ static inline unsigned long pud_leaf_size(pud_t pud)
330330

331331
#ifndef __ASSEMBLY__
332332

333-
/*
334-
* This is the default implementation of various PTE accessors, it's
335-
* used in all cases except Book3S with 64K pages where we have a
336-
* concept of sub-pages
337-
*/
338-
#ifndef __real_pte
339-
340-
#define __real_pte(e, p, o) ((real_pte_t){(e)})
341-
#define __rpte_to_pte(r) ((r).pte)
342-
#define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT)
343-
344-
#define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \
345-
do { \
346-
index = 0; \
347-
shift = mmu_psize_defs[psize].shift; \
348-
349-
#define pte_iterate_hashed_end() } while(0)
350-
351-
/*
352-
* We expect this to be called only for user addresses or kernel virtual
353-
* addresses other than the linear mapping.
354-
*/
355-
#define pte_pagesize_index(mm, addr, pte) MMU_PAGE_4K
356-
357-
#endif /* __real_pte */
358-
359333
static inline unsigned long pte_update(struct mm_struct *mm, unsigned long addr,
360334
pte_t *ptep, unsigned long clr,
361335
unsigned long set, int huge)

0 commit comments

Comments
 (0)