All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guo Ren <ren_guo@c-sky.com>
To: Greentime Hu <green.hu@gmail.com>
Cc: greentime@andestech.com, linux-kernel@vger.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:
Date: Fri, 29 Jun 2018 16:46:16 +0800	[thread overview]
Message-ID: <20180629084615.GA6236@guoren> (raw)
In-Reply-To: <20180628104927.9130-1-greentime@andestech.com>

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

  reply	other threads:[~2018-06-29  8:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28 10:49 [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: Greentime Hu
2018-06-29  8:46 ` Guo Ren [this message]
2018-07-02  8:08   ` Greentime Hu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180629084615.GA6236@guoren \
    --to=ren_guo@c-sky.com \
    --cc=green.hu@gmail.com \
    --cc=greentime@andestech.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.