lkml.org 
[lkml]   [2018]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] nds32: To implement these icache invalidation APIs since nds32 cores don't snoop data cache. This issue is found by Guo Ren. Based on the Documentation/core-api/cachetlb.rst and it says:
On Thu, Jun 28, 2018 at 06:49:27PM +0800, Greentime Hu wrote:
> +void flush_icache_page(struct vm_area_struct *vma, struct page *page)
> +{
> + unsigned long flags;
> + local_irq_save(flags);
> + cpu_cache_wbinval_page((unsigned long)page_address(page),
> + vma->vm_flags & VM_EXEC);
> + local_irq_restore(flags);
> +}
> +EXPORT_SYMBOL(flush_icache_page);
> +
I'm afraid that the page_address(page) will return NULL for non-mapped page.

So I use kmap_atomic/kunmap_atomic here.

ref: https://github.com/c-sky/csky-linux/blob/master/arch/csky/abiv2/cacheflush.c

> +void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
> + unsigned long addr, int len)
> +{
> + unsigned long _addr = (unsigned long) page_address(page) + (addr & ~PAGE_MASK);
> + flush_icache_range(_addr, _addr + len);
> +}

The same as above.

Guo Ren

\
 
 \ /
  Last update: 2018-06-29 10:46    [W:0.420 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site