Skip to content

Commit 49bc8be

Browse files
author
Christoph Hellwig
committed
ARM/dma-mappіng: don't override ->dma_coherent when set from a bus notifier
Commit ae626eb ("ARM/dma-mapping: use dma-direct unconditionally") caused a regression on the mvebu platform, wherein devices that are dma-coherent are marked as dma-noncoherent, because although mvebu_hwcc_notifier() after that commit still marks then as coherent, the arm_coherent_dma_ops() function, which is called later, overwrites this setting, since it is being called from drivers/of/device.c with coherency parameter determined by of_dma_is_coherent(), and the device-trees do not declare the 'dma-coherent' property. Fix this by defaulting never clearing the dma_coherent flag in arm_coherent_dma_ops(). Fixes: ae626eb ("ARM/dma-mapping: use dma-direct unconditionally") Reported-by: Marek Behún <kabel@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Tested-by: Marek Behún <kabel@kernel.org>
1 parent f7f04d1 commit 49bc8be

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

arch/arm/mm/dma-mapping.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,8 +1769,16 @@ static void arm_teardown_iommu_dma_ops(struct device *dev) { }
17691769
void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
17701770
const struct iommu_ops *iommu, bool coherent)
17711771
{
1772-
dev->archdata.dma_coherent = coherent;
1773-
dev->dma_coherent = coherent;
1772+
/*
1773+
* Due to legacy code that sets the ->dma_coherent flag from a bus
1774+
* notifier we can't just assign coherent to the ->dma_coherent flag
1775+
* here, but instead have to make sure we only set but never clear it
1776+
* for now.
1777+
*/
1778+
if (coherent) {
1779+
dev->archdata.dma_coherent = true;
1780+
dev->dma_coherent = true;
1781+
}
17741782

17751783
/*
17761784
* Don't override the dma_ops if they have already been set. Ideally

0 commit comments

Comments
 (0)