Skip to content

Commit e4c1112

Browse files
kvaneeshmpe
authored andcommitted
powerpc/mm: Change function prototype
In later patch, we use the vma and psize to do tlb flush. Do the prototype update in separate patch to make the review easy. Signed-off-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 044003b commit e4c1112

File tree

8 files changed

+41
-19
lines changed

8 files changed

+41
-19
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,10 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
235235
}
236236

237237

238-
static inline void __ptep_set_access_flags(struct mm_struct *mm,
238+
static inline void __ptep_set_access_flags(struct vm_area_struct *vma,
239239
pte_t *ptep, pte_t entry,
240-
unsigned long address)
240+
unsigned long address,
241+
int psize)
241242
{
242243
unsigned long set = pte_val(entry) &
243244
(_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -767,12 +767,14 @@ static inline bool check_pte_access(unsigned long access, unsigned long ptev)
767767
* Generic functions with hash/radix callbacks
768768
*/
769769

770-
static inline void __ptep_set_access_flags(struct mm_struct *mm,
770+
static inline void __ptep_set_access_flags(struct vm_area_struct *vma,
771771
pte_t *ptep, pte_t entry,
772-
unsigned long address)
772+
unsigned long address,
773+
int psize)
773774
{
774775
if (radix_enabled())
775-
return radix__ptep_set_access_flags(mm, ptep, entry, address);
776+
return radix__ptep_set_access_flags(vma, ptep, entry,
777+
address, psize);
776778
return hash__ptep_set_access_flags(ptep, entry);
777779
}
778780

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@ extern void radix__mark_rodata_ro(void);
124124
extern void radix__mark_initmem_nx(void);
125125
#endif
126126

127-
extern void radix__ptep_set_access_flags(struct mm_struct *mm, pte_t *ptep,
128-
pte_t entry, unsigned long address);
127+
extern void radix__ptep_set_access_flags(struct vm_area_struct *vma, pte_t *ptep,
128+
pte_t entry, unsigned long address,
129+
int psize);
129130

130131
static inline unsigned long __radix_pte_update(pte_t *ptep, unsigned long clr,
131132
unsigned long set)

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,10 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
256256
}
257257

258258

259-
static inline void __ptep_set_access_flags(struct mm_struct *mm,
259+
static inline void __ptep_set_access_flags(struct vm_area_struct *vma,
260260
pte_t *ptep, pte_t entry,
261-
unsigned long address)
261+
unsigned long address,
262+
int psize)
262263
{
263264
unsigned long set = pte_val(entry) &
264265
(_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,10 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
281281
/* Set the dirty and/or accessed bits atomically in a linux PTE, this
282282
* function doesn't need to flush the hash entry
283283
*/
284-
static inline void __ptep_set_access_flags(struct mm_struct *mm,
284+
static inline void __ptep_set_access_flags(struct vm_area_struct *vma,
285285
pte_t *ptep, pte_t entry,
286-
unsigned long address)
286+
unsigned long address,
287+
int psize)
287288
{
288289
unsigned long bits = pte_val(entry) &
289290
(_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);

arch/powerpc/mm/pgtable-book3s64.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ int pmdp_set_access_flags(struct vm_area_struct *vma, unsigned long address,
4646
#endif
4747
changed = !pmd_same(*(pmdp), entry);
4848
if (changed) {
49-
__ptep_set_access_flags(vma->vm_mm, pmdp_ptep(pmdp),
50-
pmd_pte(entry), address);
49+
/*
50+
* We can use MMU_PAGE_2M here, because only radix
51+
* path look at the psize.
52+
*/
53+
__ptep_set_access_flags(vma, pmdp_ptep(pmdp),
54+
pmd_pte(entry), address, MMU_PAGE_2M);
5155
flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
5256
}
5357
return changed;

arch/powerpc/mm/pgtable-radix.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,10 +1085,10 @@ int radix__has_transparent_hugepage(void)
10851085
}
10861086
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
10871087

1088-
void radix__ptep_set_access_flags(struct mm_struct *mm,
1089-
pte_t *ptep, pte_t entry,
1090-
unsigned long address)
1088+
void radix__ptep_set_access_flags(struct vm_area_struct *vma, pte_t *ptep,
1089+
pte_t entry, unsigned long address, int psize)
10911090
{
1091+
struct mm_struct *mm = vma->vm_mm;
10921092
unsigned long set = pte_val(entry) & (_PAGE_DIRTY | _PAGE_ACCESSED |
10931093
_PAGE_RW | _PAGE_EXEC);
10941094

arch/powerpc/mm/pgtable.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address,
222222
changed = !pte_same(*(ptep), entry);
223223
if (changed) {
224224
assert_pte_locked(vma->vm_mm, address);
225-
__ptep_set_access_flags(vma->vm_mm, ptep, entry, address);
225+
__ptep_set_access_flags(vma, ptep, entry,
226+
address, mmu_virtual_psize);
226227
flush_tlb_page(vma, address);
227228
}
228229
return changed;
@@ -242,15 +243,26 @@ extern int huge_ptep_set_access_flags(struct vm_area_struct *vma,
242243
ptep_set_access_flags(vma, addr, ptep, pte, dirty);
243244
return 1;
244245
#else
245-
int changed;
246+
int changed, psize;
246247

247248
pte = set_access_flags_filter(pte, vma, dirty);
248249
changed = !pte_same(*(ptep), pte);
249250
if (changed) {
251+
252+
#ifdef CONFIG_PPC_BOOK3S_64
253+
struct hstate *hstate = hstate_file(vma->vm_file);
254+
psize = hstate_get_psize(hstate);
255+
#else
256+
/*
257+
* Not used on non book3s64 platforms. But 8xx
258+
* can possibly use tsize derived from hstate.
259+
*/
260+
psize = 0;
261+
#endif
250262
#ifdef CONFIG_DEBUG_VM
251263
assert_spin_locked(&vma->vm_mm->page_table_lock);
252264
#endif
253-
__ptep_set_access_flags(vma->vm_mm, ptep, pte, addr);
265+
__ptep_set_access_flags(vma, ptep, pte, addr, psize);
254266
flush_hugetlb_page(vma, addr);
255267
}
256268
return changed;

0 commit comments

Comments
 (0)