From: Takashi Iwai Subject: Re: [PATCH] ASoC: omap-pcm: Lower the dma coherent mask to 32bits Date: Fri, 06 Dec 2013 14:04:22 +0100 Message-ID: References: <1386230802-3660-1-git-send-email-peter.ujfalusi@ti.com> <20131205095619.GC4360@n2100.arm.linux.org.uk> <52A09CDA.6010700@ti.com> <20131205192853.GH4360@n2100.arm.linux.org.uk> <20131205210707.GI4360@n2100.arm.linux.org.uk> <20131206122543.GL4360@n2100.arm.linux.org.uk> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 9FE6D2610A3 for ; Fri, 6 Dec 2013 14:04:23 +0100 (CET) In-Reply-To: <20131206122543.GL4360@n2100.arm.linux.org.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Russell King - ARM Linux Cc: Peter Ujfalusi , alsa-devel@alsa-project.org, Mark Brown , Liam Girdwood , Jarkko Nikula List-Id: alsa-devel@alsa-project.org At Fri, 6 Dec 2013 12:25:43 +0000, Russell King - ARM Linux wrote: > > On Fri, Dec 06, 2013 at 09:12:22AM +0100, Takashi Iwai wrote: > > But, it's still unclear why only get_coherent_dma_mask() takes max_pfn > > into account for the check of dma_to_pfn(dev, mask). > > > > In dma_supported(), > > > > unsigned long limit; > > limit = dma_to_pfn(dev, mask); > > if (limit < arm_dma_pfn_limit) > > return 0; > > > > while in get_coherent_dma_mask(), > > > > unsigned long max_dma_pfn; > > max_dma_pfn = min(max_pfn, arm_dma_pfn_limit); > > if (dma_to_pfn(dev, mask) < max_dma_pfn) > > return 0; > > > > So, the current code looks to me that the results from > > dma_set_coherent_mask() and the actual allocation may conflict. > > I did ask Peter to replace *both* with the same thing. Well, I'm looking at different points. You requested Peter to test both functions to take: if (sizeof(mask) != sizeof(dma_addr_t) && mask > (dma_addr_t)~0 && dma_to_pfn(dev, ~0) < min(max_pfn, arm_dma_pfn_limit)) return 0; But, after that line, dma_supported() has another check: if (dma_to_pfn(dev, mask) < arm_dma_pfn_limit) return 0; and get_coherent_dma_mask() has a different check: if (dma_to_pfn(dev, mask) < min(max_pfn, arm_dma_pfn_limit)) return 0; (the expressions here are expanded for easier comparison) This is what I'm wondering. Takashi