Skip to content

Commit d936a7e

Browse files
committed
csky: Enable defer flush_dcache_page for abiv2 cpus (807/810/860)
Instead of flushing cache per update_mmu_cache() called, we use flush_dcache_page to reduce the frequency of flashing the cache. As abiv2 cpus are all PIPT for icache & dcache, we needn't handle dcache aliasing problem. But their icache can't snoop dcache, so we still need sync_icache_dcache in update_mmu_cache(). Signed-off-by: Guo Ren <[email protected]>
1 parent a117673 commit d936a7e

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

arch/csky/abiv2/cacheflush.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@
99
void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
1010
pte_t *pte)
1111
{
12-
unsigned long addr, pfn;
12+
unsigned long addr;
1313
struct page *page;
1414

15-
pfn = pte_pfn(*pte);
16-
if (unlikely(!pfn_valid(pfn)))
15+
page = pfn_to_page(pte_pfn(*pte));
16+
if (page == ZERO_PAGE(0))
1717
return;
1818

19-
page = pfn_to_page(pfn);
20-
if (page == ZERO_PAGE(0))
19+
if (test_and_set_bit(PG_dcache_clean, &page->flags))
2120
return;
2221

2322
addr = (unsigned long) kmap_atomic(page);
2423

25-
cache_wbinv_range(addr, addr + PAGE_SIZE);
24+
dcache_wb_range(addr, addr + PAGE_SIZE);
25+
26+
if (vma->vm_flags & VM_EXEC)
27+
icache_inv_range(addr, addr + PAGE_SIZE);
2628

2729
kunmap_atomic((void *) addr);
2830
}

arch/csky/abiv2/inc/abi/cacheflush.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@
1515
#define flush_cache_dup_mm(mm) do { } while (0)
1616
#define flush_cache_range(vma, start, end) do { } while (0)
1717
#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
18-
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
19-
#define flush_dcache_page(page) do { } while (0)
18+
19+
#define PG_dcache_clean PG_arch_1
20+
21+
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
22+
static inline void flush_dcache_page(struct page *page)
23+
{
24+
if (test_bit(PG_dcache_clean, &page->flags))
25+
clear_bit(PG_dcache_clean, &page->flags);
26+
}
27+
2028
#define flush_dcache_mmap_lock(mapping) do { } while (0)
2129
#define flush_dcache_mmap_unlock(mapping) do { } while (0)
2230
#define flush_icache_page(vma, page) do { } while (0)

0 commit comments

Comments
 (0)