All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Kevin Cernekee <cernekee@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	dediao@cisco.com, dvomlehn@cisco.com, linux-mips@linux-mips.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] MIPS: HIGHMEM DMA on noncoherent MIPS32 processors
Date: Tue, 07 Sep 2010 13:11:28 +0400	[thread overview]
Message-ID: <4C8601C0.40001@mvista.com> (raw)
In-Reply-To: <7d28a475591d9522bd1841a95fe21260@localhost>

Hello.

On 07-09-2010 8:03, Kevin Cernekee wrote:

> The MIPS DMA coherency functions do not work properly (i.e. kernel oops)
> when HIGHMEM pages are passed in as arguments.  This patch uses the PPC
> approach of calling kmap_atomic() with IRQs disabled to temporarily map
> high pages, in order to flush them out to memory.

> Signed-off-by: Dezhong Diao <dediao@cisco.com>
> Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
> ---
>   arch/mips/mm/dma-default.c |  159 ++++++++++++++++++++++----------------------
>   1 files changed, 80 insertions(+), 79 deletions(-)

> diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
> index 469d401..3f23952 100644
> --- a/arch/mips/mm/dma-default.c
> +++ b/arch/mips/mm/dma-default.c
[...]
> @@ -191,8 +231,8 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
>   	enum dma_data_direction direction)
>   {
>   	if (cpu_is_noncoherent_r10000(dev))
> -		__dma_sync(dma_addr_to_virt(dev, dma_addr), size,
> -		           direction);
> +		__dma_sync(dma_addr_to_page(dev, dma_addr),
> +			   (dma_addr & ~PAGE_MASK), size, direction);

    Parens are not needed here.

> @@ -277,15 +297,10 @@ EXPORT_SYMBOL(dma_sync_single_for_cpu);
>   void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
>   	size_t size, enum dma_data_direction direction)
>   {
> -	BUG_ON(direction == DMA_NONE);
> -
>   	plat_extra_sync_for_device(dev);
> -	if (!plat_device_is_coherent(dev)) {
> -		unsigned long addr;
> -
> -		addr = dma_addr_to_virt(dev, dma_handle);
> -		__dma_sync(addr, size, direction);
> -	}
> +	if (!plat_device_is_coherent(dev))
> +		__dma_sync(dma_addr_to_page(dev, dma_handle),
> +			   (dma_handle & ~PAGE_MASK), size, direction);

    Here as well...

WBR, Sergei

      reply	other threads:[~2010-09-07  9:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-07  4:03 [PATCH 1/5] MIPS: HIGHMEM DMA on noncoherent MIPS32 processors Kevin Cernekee
2010-09-07  4:03 ` Kevin Cernekee
2010-09-07  9:11 ` Sergei Shtylyov [this message]

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=4C8601C0.40001@mvista.com \
    --to=sshtylyov@mvista.com \
    --cc=cernekee@gmail.com \
    --cc=dediao@cisco.com \
    --cc=dvomlehn@cisco.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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.