[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEbi=3dj4mXVSOBq4g_jaGp0oXTZ2Ai9CU=ZP+cbxpYQXepJiA@mail.gmail.com>
Date: Mon, 2 Jul 2018 16:08:44 +0800
From: Greentime Hu <green.hu@...il.com>
To: Guo Ren <ren_guo@...ky.com>
Cc: Greentime <greentime@...estech.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: 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:
Guo Ren <ren_guo@...ky.com> 於 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.
Powered by blists - more mailing lists