Skip to content

Commit ec94b9b

Browse files
kvaneeshmpe
authored andcommitted
powerpc/mm: Add PG_dcache_clean to indicate dcache clean state
This just add a better name for PG_arch_1. No functional change in this patch. Signed-off-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c7ba2d6 commit ec94b9b

File tree

5 files changed

+19
-13
lines changed

5 files changed

+19
-13
lines changed

arch/powerpc/include/asm/cacheflush.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
#include <asm/cputable.h>
99
#include <asm/cpu_has_feature.h>
1010

11+
/*
12+
* This flag is used to indicate that the page pointed to by a pte is clean
13+
* and does not require cleaning before returning it to the user.
14+
*/
15+
#define PG_dcache_clean PG_arch_1
16+
1117
#ifdef CONFIG_PPC_BOOK3S_64
1218
/*
1319
* Book3s has no ptesync after setting a pte, so without this ptesync it's

arch/powerpc/include/asm/kvm_ppc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,9 +881,9 @@ static inline void kvmppc_mmu_flush_icache(kvm_pfn_t pfn)
881881

882882
/* Clear i-cache for new pages */
883883
page = pfn_to_page(pfn);
884-
if (!test_bit(PG_arch_1, &page->flags)) {
884+
if (!test_bit(PG_dcache_clean, &page->flags)) {
885885
flush_dcache_icache_page(page);
886-
set_bit(PG_arch_1, &page->flags);
886+
set_bit(PG_dcache_clean, &page->flags);
887887
}
888888
}
889889

arch/powerpc/mm/book3s64/hash_utils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,10 +1144,10 @@ unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap)
11441144
page = pte_page(pte);
11451145

11461146
/* page is dirty */
1147-
if (!test_bit(PG_arch_1, &page->flags) && !PageReserved(page)) {
1147+
if (!test_bit(PG_dcache_clean, &page->flags) && !PageReserved(page)) {
11481148
if (trap == 0x400) {
11491149
flush_dcache_icache_page(page);
1150-
set_bit(PG_arch_1, &page->flags);
1150+
set_bit(PG_dcache_clean, &page->flags);
11511151
} else
11521152
pp |= HPTE_R_N;
11531153
}

arch/powerpc/mm/mem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,8 @@ void flush_dcache_page(struct page *page)
489489
if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
490490
return;
491491
/* avoid an atomic op if possible */
492-
if (test_bit(PG_arch_1, &page->flags))
493-
clear_bit(PG_arch_1, &page->flags);
492+
if (test_bit(PG_dcache_clean, &page->flags))
493+
clear_bit(PG_dcache_clean, &page->flags);
494494
}
495495
EXPORT_SYMBOL(flush_dcache_page);
496496

arch/powerpc/mm/pgtable.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ static pte_t set_pte_filter_hash(pte_t pte)
8282
struct page *pg = maybe_pte_to_page(pte);
8383
if (!pg)
8484
return pte;
85-
if (!test_bit(PG_arch_1, &pg->flags)) {
85+
if (!test_bit(PG_dcache_clean, &pg->flags)) {
8686
flush_dcache_icache_page(pg);
87-
set_bit(PG_arch_1, &pg->flags);
87+
set_bit(PG_dcache_clean, &pg->flags);
8888
}
8989
}
9090
return pte;
@@ -117,13 +117,13 @@ static inline pte_t set_pte_filter(pte_t pte)
117117
return pte;
118118

119119
/* If the page clean, we move on */
120-
if (test_bit(PG_arch_1, &pg->flags))
120+
if (test_bit(PG_dcache_clean, &pg->flags))
121121
return pte;
122122

123123
/* If it's an exec fault, we flush the cache and make it clean */
124124
if (is_exec_fault()) {
125125
flush_dcache_icache_page(pg);
126-
set_bit(PG_arch_1, &pg->flags);
126+
set_bit(PG_dcache_clean, &pg->flags);
127127
return pte;
128128
}
129129

@@ -162,12 +162,12 @@ static pte_t set_access_flags_filter(pte_t pte, struct vm_area_struct *vma,
162162
goto bail;
163163

164164
/* If the page is already clean, we move on */
165-
if (test_bit(PG_arch_1, &pg->flags))
165+
if (test_bit(PG_dcache_clean, &pg->flags))
166166
goto bail;
167167

168-
/* Clean the page and set PG_arch_1 */
168+
/* Clean the page and set PG_dcache_clean */
169169
flush_dcache_icache_page(pg);
170-
set_bit(PG_arch_1, &pg->flags);
170+
set_bit(PG_dcache_clean, &pg->flags);
171171

172172
bail:
173173
return pte_mkexec(pte);

0 commit comments

Comments
 (0)