OSDN Git Service

of/device: Update dma_range_map only when dev has valid dma-ranges
authorYong Wu <yong.wu@mediatek.com>
Tue, 19 Jan 2021 10:52:03 +0000 (18:52 +0800)
committerRob Herring <robh@kernel.org>
Wed, 27 Jan 2021 20:00:14 +0000 (14:00 -0600)
commit89c7cb1608ac3c7ecc19436469f35ed12da97e1d
tree9f58a2e1475f2ded1b959f122c35300c2e352d28
parent30596ae0547dbda469d31a2678d9072fb0a3fa27
of/device: Update dma_range_map only when dev has valid dma-ranges

The commit e0d072782c73 ("dma-mapping: introduce DMA range map,
supplanting dma_pfn_offset") always update dma_range_map even though it was
already set, like in the sunxi_mbus driver. the issue is reported at [1].
This patch avoid this(Updating it only when dev has valid dma-ranges).

Meanwhile, dma_range_map contains the devices' dma_ranges information,
This patch moves dma_range_map before of_iommu_configure. The iommu
driver may need to know the dma_address requirements of its iommu
consumer devices.

[1] https://lore.kernel.org/linux-arm-kernel/5c7946f3-b56e-da00-a750-be097c7ceb32@arm.com/

CC: Frank Rowand <frowand.list@gmail.com>
Fixes: e0d072782c73 ("dma-mapping: introduce DMA range map, supplanting dma_pfn_offset"),
Suggested-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210119105203.15530-1-yong.wu@mediatek.com
drivers/of/device.c