From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH v3 2/4] of: move of_dma_configure() to device, c to help re-use Date: Thu, 08 Jan 2015 09:40:10 +0100 Message-ID: <3861625.CJ6m15sZMh@wuerfel> References: <1420656594-8908-1-git-send-email-m-karicheri2@ti.com> <1420656594-8908-3-git-send-email-m-karicheri2@ti.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Rob Herring Cc: "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Russell King - ARM Linux , "linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Will Deacon , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Rob Herring , Bjorn Helgaas , Linux IOMMU , Murali Karicheri , Grant Likely , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" List-Id: devicetree@vger.kernel.org On Wednesday 07 January 2015 17:37:56 Rob Herring wrote: > On Wed, Jan 7, 2015 at 12:49 PM, Murali Karicheri wrote: > > > + ret = of_dma_get_range(np, &dma_addr, &paddr, &size); > > + if (ret < 0) { > > + dma_addr = offset = 0; > > + size = dev->coherent_dma_mask + 1; > > If coherent_dma_mask is DMA_BIT_MASK(64), then you will overflow and > have a size of 0. There may also be a problem when the mask is only > 32-bit type. The mask is always a 64-bit type, it's not optional. But you are right, the 64-bit mask case is broken, so I guess we have to fix it differently by always passing the smaller value into arch_setup_dma_ops and adapting that function instead. Arnd