Re: [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:

From: Greentime Hu
Date: Mon Jul 02 2018 - 04:09:29 EST


Guo Ren <ren_guo@xxxxxxxxx> æ 2018å6æ29æ éä äå4:46åéï
>
> 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.

Thank you, Ren.
I will prepare the next version patch to use
kmap_atomic/kunmap_atomic to fix this issue.