[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180629084615.GA6236@guoren>
Date: Fri, 29 Jun 2018 16:46:16 +0800
From: Guo Ren <ren_guo@...ky.com>
To: Greentime Hu <green.hu@...il.com>
Cc: greentime@...estech.com, 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:
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
Powered by blists - more mailing lists