PCI: endpoint: Use EPC's device in dma_alloc_coherent()/dma_free_coherent()
authorKishon Vijay Abraham I <kishon@ti.com>
Thu, 11 Jan 2018 08:30:57 +0000 (14:00 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Mar 2019 05:13:55 +0000 (14:13 +0900)
commit421abdcc909322d6595504cf8d20c1adf74bc1cd
tree85f12bb825c73e128a7808b844699da4d9088b66
parentdd913d610e214b97bba81b1b76883d0f29d63a37
PCI: endpoint: Use EPC's device in dma_alloc_coherent()/dma_free_coherent()

commit b330104fa76df3eae6e199a23791fed5d35f06b4 upstream.

After commit 723288836628 ("of: restrict DMA configuration"),
of_dma_configure() doesn't configure the coherent_dma_mask/dma_mask
of endpoint function device (since it doesn't have a DT node associated
with and hence no dma-ranges property), resulting in
dma_alloc_coherent() (used in pci_epf_alloc_space()) to fail.

Fix it by making dma_alloc_coherent() use EPC's device for allocating
memory address.

Link: http://lkml.kernel.org/r/64d63468-d28f-8fcd-a6f3-cf2a6401c8cb@ti.com
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
[lorenzo.pieralisi@arm.com: tweaked commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Tested-by: Cyrille Pitchen <cyrille.pitchen@free-electrons.com>
Tested-by: Niklas Cassel <niklas.cassel@axis.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pci/endpoint/pci-epc-core.c
drivers/pci/endpoint/pci-epf-core.c