From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Mon, 22 Dec 2014 23:24:33 +0100 Subject: [RFC v1 PATCH 1/2] of/pci: add of_pci_dma_configure() update dma configuration In-Reply-To: <54988FDB.8000108@ti.com> References: <1418940425-2017-1-git-send-email-m-karicheri2@ti.com> <11285984.OK9CqQGmjZ@wuerfel> <54988FDB.8000108@ti.com> Message-ID: <2285493.QXo0OxClZ5@wuerfel> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Monday 22 December 2014 16:40:43 Murali Karicheri wrote: > >> +++ b/arch/arm/mm/dma-mapping.c > >> @@ -2052,9 +2052,10 @@ void arch_setup_dma_ops(struct device *dev, u64 > >> dma_base, u64 size, > >> struct iommu_ops *iommu, bool coherent) > >> { > >> struct dma_map_ops *dma_ops; > >> + u64 temp_size = min((*(dev->dma_mask) + 1), size); > >> > >> dev->archdata.dma_coherent = coherent; > >> - if (arm_setup_iommu_dma_ops(dev, dma_base, size, iommu)) > >> + if (arm_setup_iommu_dma_ops(dev, dma_base, temp_size, iommu)) > >> > >> If you agree, I will post v1 of the patch with these updates. Let me > >> know. I did some basic tests on Keystone with these changes and it works > >> fine. > > > > It's not exactly what I meant. My main point was that we need to limit > > dev->dma_mask to (size-1) here, but you are not touching that. > > if you mean overriding the dev->dma_mask to min((*dev->dma_mask), > size-1), then I am getting the error "Coherent DMA mask 0x7fffffff (pfn > 0x780000-0x800000) covers a smaller range of system memory than the DMA > zone pfn 0x0-0x880000) when the devices on Keystone tries to set the dma > mask. Something wrong and I need to look into the code. Right, it sounds like the offset was applied incorrectly at some point. What are the DMA zone size and the phys-offset? Arnd