All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: linux-sh@vger.kernel.org
Subject: Re: Ecovec (SH7724) board doesn't work on latest linus tree
Date: Thu, 01 Sep 2011 01:45:53 +0000	[thread overview]
Message-ID: <874o0xc9wy.wl%kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <w3pvcwf5xuu.wl%kuninori.morimoto.gx@renesas.com>


Hi Paul

> I guess your patch tried to share code for sh32/sh64.
> and CAC_ADDR() should be equal P1SEGADDR(), correct ?
> 
> I'm not filmier with memory control, but
> on Ecovec case, 1st (and crash case) dma_cache_sync() caller is
> ${LINUX}/arch/sh/mm/consistent.c :: dma_generic_alloc_coherent()
> 
> it tried
> 
> 	ret = (void *)__get_free_pages(gfp, order);
>         (snip)
>         dma_cache_sync(dev, ret, size, DMA_BIDIRECTIONAL);
> 
> This "ret" is "8e000000" for now.
> 
> but CAC_ADDR(xx)/P1SEGADDR(xx) is defined as below
> 
> CAC_ADDR(addr)  ((addr) - uncached_start + PAGE_OFFSET)
> P1SEGADDR(a)    ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P1SEG))
> 
> I guess this "ret" should be uncached area if dma_cache_sync(xx) use CAC_ADDR(xx).
> 
> If I apply below patch, Ecovec start works without crash, but I'm not sure.
> Is this correct patch ?
> 
> --------------------
> diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
> index f251b5f..198234a 100644
> --- a/arch/sh/mm/consistent.c
> +++ b/arch/sh/mm/consistent.c
> @@ -48,7 +48,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t si
>          * Pages from the page allocator may have data present in
>          * cache. So flush the cache before using uncached memory.
>          */
> -       dma_cache_sync(dev, ret, size, DMA_BIDIRECTIONAL);
> +       dma_cache_sync(dev, UNCAC_ADDR(ret), size, DMA_BIDIRECTIONAL);
>  
>         ret_nocache = (void __force *)ioremap_nocache(virt_to_phys(ret), size);
>         if (!ret_nocache) {
> -------------------------
> 
> But I'm afraid below comment of dma_generic_alloc_coherent()
> 
> 	/*
> 	 * Pages from the page allocator may have data present in
> 	 * cache. So flush the cache before using uncached memory.
> 	 */
> 	dma_cache_sync(dev, ret, size, DMA_BIDIRECTIONAL);


dma_cache_sync(xx) should not expect vaddr is in uncached area ?

Best regards
---
Kuninori Morimoto

  parent reply	other threads:[~2011-09-01  1:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09  6:21 Ecovec (SH7724) board doesn't work on latest linus tree Kuninori Morimoto
2011-06-09  6:31 ` Paul Mundt
2011-06-09  6:42 ` Kuninori Morimoto
2011-07-05  7:52 ` kuninori.morimoto.gx
2011-08-31 15:07 ` Yutaro Ebihara
2011-09-01  1:28 ` Kuninori Morimoto
2011-09-01  1:45 ` Kuninori Morimoto [this message]
2011-09-08  8:52 ` Nobuhiro Iwamatsu
2011-09-20  0:54 ` Paul Mundt
2011-09-20  2:08 ` Kuninori Morimoto
2011-09-20  3:10 ` Paul Mundt
2011-10-04 23:16 ` Simon Horman
2011-11-04 13:23 ` Paul Mundt

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=874o0xc9wy.wl%kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=linux-sh@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.