Skip to content

Commit aa9cd50

Browse files
chleroympe
authored andcommitted
powerpc/mm: move some nohash pte helpers in nohash/[32:64]/pgtable.h
In order to allow their use in nohash/32/pgtable.h, we have to move the following helpers in nohash/[32:64]/pgtable.h: - pte_mkwrite() - pte_mkdirty() - pte_mkyoung() - pte_wrprotect() Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent d81e6f8 commit aa9cd50

File tree

3 files changed

+48
-28
lines changed

3 files changed

+48
-28
lines changed

arch/powerpc/include/asm/nohash/32/pgtable.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,34 @@ extern int icache_44x_need_flush;
136136
#define pte_clear(mm, addr, ptep) \
137137
do { pte_update(ptep, ~0, 0); } while (0)
138138

139+
static inline pte_t pte_mkwrite(pte_t pte)
140+
{
141+
pte_basic_t ptev;
142+
143+
ptev = pte_val(pte) & ~_PAGE_RO;
144+
ptev |= _PAGE_RW;
145+
return __pte(ptev);
146+
}
147+
148+
static inline pte_t pte_mkdirty(pte_t pte)
149+
{
150+
return __pte(pte_val(pte) | _PAGE_DIRTY);
151+
}
152+
153+
static inline pte_t pte_mkyoung(pte_t pte)
154+
{
155+
return __pte(pte_val(pte) | _PAGE_ACCESSED);
156+
}
157+
158+
static inline pte_t pte_wrprotect(pte_t pte)
159+
{
160+
pte_basic_t ptev;
161+
162+
ptev = pte_val(pte) & ~(_PAGE_RW | _PAGE_HWWRITE);
163+
ptev |= _PAGE_RO;
164+
return __pte(ptev);
165+
}
166+
139167
#define pmd_none(pmd) (!pmd_val(pmd))
140168
#define pmd_bad(pmd) (pmd_val(pmd) & _PMD_BAD)
141169
#define pmd_present(pmd) (pmd_val(pmd) & _PMD_PRESENT_MASK)

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,26 @@
9494
#ifndef __ASSEMBLY__
9595
/* pte_clear moved to later in this file */
9696

97+
static inline pte_t pte_mkwrite(pte_t pte)
98+
{
99+
return __pte(pte_val(pte) | _PAGE_RW);
100+
}
101+
102+
static inline pte_t pte_mkdirty(pte_t pte)
103+
{
104+
return __pte(pte_val(pte) | _PAGE_DIRTY);
105+
}
106+
107+
static inline pte_t pte_mkyoung(pte_t pte)
108+
{
109+
return __pte(pte_val(pte) | _PAGE_ACCESSED);
110+
}
111+
112+
static inline pte_t pte_wrprotect(pte_t pte)
113+
{
114+
return __pte(pte_val(pte) & ~_PAGE_RW);
115+
}
116+
97117
#define PMD_BAD_BITS (PTE_TABLE_SIZE-1)
98118
#define PUD_BAD_BITS (PMD_TABLE_SIZE-1)
99119

arch/powerpc/include/asm/nohash/pgtable.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,6 @@ static inline unsigned long pte_pfn(pte_t pte) {
7777
return pte_val(pte) >> PTE_RPN_SHIFT; }
7878

7979
/* Generic modifiers for PTE bits */
80-
static inline pte_t pte_wrprotect(pte_t pte)
81-
{
82-
pte_basic_t ptev;
83-
84-
ptev = pte_val(pte) & ~(_PAGE_RW | _PAGE_HWWRITE);
85-
ptev |= _PAGE_RO;
86-
return __pte(ptev);
87-
}
88-
8980
static inline pte_t pte_mkclean(pte_t pte)
9081
{
9182
return __pte(pte_val(pte) & ~(_PAGE_DIRTY | _PAGE_HWWRITE));
@@ -96,25 +87,6 @@ static inline pte_t pte_mkold(pte_t pte)
9687
return __pte(pte_val(pte) & ~_PAGE_ACCESSED);
9788
}
9889

99-
static inline pte_t pte_mkwrite(pte_t pte)
100-
{
101-
pte_basic_t ptev;
102-
103-
ptev = pte_val(pte) & ~_PAGE_RO;
104-
ptev |= _PAGE_RW;
105-
return __pte(ptev);
106-
}
107-
108-
static inline pte_t pte_mkdirty(pte_t pte)
109-
{
110-
return __pte(pte_val(pte) | _PAGE_DIRTY);
111-
}
112-
113-
static inline pte_t pte_mkyoung(pte_t pte)
114-
{
115-
return __pte(pte_val(pte) | _PAGE_ACCESSED);
116-
}
117-
11890
static inline pte_t pte_mkspecial(pte_t pte)
11991
{
12092
return __pte(pte_val(pte) | _PAGE_SPECIAL);

0 commit comments

Comments
 (0)