Skip to content

Commit 2ed21da

Browse files
committed
ARC: [mm] Assume pagecache page dirty by default
Similar to ARM/SH Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent fedf5b9 commit 2ed21da

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

arch/arc/include/asm/cacheflush.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ void flush_anon_page(struct vm_area_struct *vma,
8080

8181
#endif /* CONFIG_ARC_CACHE_VIPT_ALIASING */
8282

83+
/*
84+
* A new pagecache page has PG_arch_1 clear - thus dcache dirty by default
85+
* This works around some PIO based drivers which don't call flush_dcache_page
86+
* to record that they dirtied the dcache
87+
*/
88+
#define PG_dc_clean PG_arch_1
89+
8390
/*
8491
* Simple wrapper over config option
8592
* Bootup code ensures that hardware matches kernel configuration

arch/arc/mm/cache_arc700.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ void flush_dcache_page(struct page *page)
512512
struct address_space *mapping;
513513

514514
if (!cache_is_vipt_aliasing()) {
515-
set_bit(PG_arch_1, &page->flags);
515+
clear_bit(PG_dc_clean, &page->flags);
516516
return;
517517
}
518518

@@ -526,7 +526,7 @@ void flush_dcache_page(struct page *page)
526526
* Make a note that K-mapping is dirty
527527
*/
528528
if (!mapping_mapped(mapping)) {
529-
set_bit(PG_arch_1, &page->flags);
529+
clear_bit(PG_dc_clean, &page->flags);
530530
} else if (page_mapped(page)) {
531531

532532
/* kernel reading from page with U-mapping */
@@ -734,24 +734,24 @@ void copy_user_highpage(struct page *to, struct page *from,
734734
* non copied user pages (e.g. read faults which wire in pagecache page
735735
* directly).
736736
*/
737-
set_bit(PG_arch_1, &to->flags);
737+
clear_bit(PG_dc_clean, &to->flags);
738738

739739
/*
740740
* if SRC was already usermapped and non-congruent to kernel mapping
741741
* sync the kernel mapping back to physical page
742742
*/
743743
if (clean_src_k_mappings) {
744744
__flush_dcache_page(kfrom, kfrom);
745-
clear_bit(PG_arch_1, &from->flags);
745+
set_bit(PG_dc_clean, &from->flags);
746746
} else {
747-
set_bit(PG_arch_1, &from->flags);
747+
clear_bit(PG_dc_clean, &from->flags);
748748
}
749749
}
750750

751751
void clear_user_page(void *to, unsigned long u_vaddr, struct page *page)
752752
{
753753
clear_page(to);
754-
set_bit(PG_arch_1, &page->flags);
754+
clear_bit(PG_dc_clean, &page->flags);
755755
}
756756

757757

arch/arc/mm/tlb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr_unaligned,
453453
if ((vma->vm_flags & VM_EXEC) ||
454454
addr_not_cache_congruent(paddr, vaddr)) {
455455

456-
int dirty = test_and_clear_bit(PG_arch_1, &page->flags);
456+
int dirty = !test_and_set_bit(PG_dc_clean, &page->flags);
457457
if (dirty) {
458458
/* wback + inv dcache lines */
459459
__flush_dcache_page(paddr, paddr);

0 commit comments

Comments
 (0)