From patchwork Thu Sep 1 01:28:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 1118152 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p811SeF8018811 for ; Thu, 1 Sep 2011 01:28:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757377Ab1IAB2f (ORCPT ); Wed, 31 Aug 2011 21:28:35 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:45037 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757380Ab1IAB2W (ORCPT ); Wed, 31 Aug 2011 21:28:22 -0400 Received: by iabu26 with SMTP id u26so1322178iab.19 for ; Wed, 31 Aug 2011 18:28:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:sender:message-id:from:to:cc:subject:in-reply-to:references :user-agent:mime-version:content-type; bh=bbapurtRj3uzx2UzaCXWlz5/Jr/Iqa6Yd3pG9XZmWIE=; b=LbQlXj7muMxkGktsgWBVvOS+JvgXPqPCpjQ9E1Q66myW4LRHlz3G1CLz4iLt8wUffP 5RTlAg7xD351Vc1kUcV/W7PzHy6yQaDf8YlW9K9mJIVaHmVfwtaSdHfd5wllnrDQ/NV6 JvIfcG6Y7NQeOeudIQQx3F/HCx1/1XzVpe8wA= Received: by 10.43.45.196 with SMTP id ul4mr865539icb.116.1314840501260; Wed, 31 Aug 2011 18:28:21 -0700 (PDT) Received: from morimoto-Dell-XPS420.gmail.com (49.14.32.202.bf.2iij.net [202.32.14.49]) by mx.google.com with ESMTPS id a9sm141793icy.18.2011.08.31.18.28.18 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 31 Aug 2011 18:28:19 -0700 (PDT) Date: Wed, 31 Aug 2011 18:28:19 -0700 (PDT) Message-ID: <8762ldcaqa.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Yutaro Ebihara , Paul Mundt Cc: Magnus , Linux-SH , Kuninori Morimoto Subject: Re: Ecovec (SH7724) board doesn't work on latest linus tree In-Reply-To: <2ECC67EFACD13Cebiharaml@si-linux.co.jp> References: <20110609063132.GC26006@linux-sh.org> <871uy5f9kg.wl%kuninori.morimoto.gx@renesas.com> <2ECC67EFACD13Cebiharaml@si-linux.co.jp> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.8 Emacs/23.2 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 01 Sep 2011 01:28:42 +0000 (UTC) Hi Ebihara-san, and Paul Thank you for your report. > i think you can run linux-3.0.4 kernel on your Ecovec (SH7724) board > in this debug-code. > > > void dma_cache_sync(struct device *dev, void *vaddr, size_t size, > enum dma_data_direction direction) > { > void *addr; > > addr = __in_29bit_mode() ? > - (void *)CAC_ADDR((unsigned long)vaddr) : vaddr; > + (void *)P1SEGADDR((unsigned long)vaddr) : vaddr; 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 ? -------------------- ------------------------- 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); Best regards --- Kuninori Morimoto -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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) {