Patch "ARM/dma-mappіng: don't override ->dma_coherent when set from a bus notifier" has been added to the 6.0-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ARM/dma-mappіng: don't override ->dma_coherent when set from a bus notifier

to the 6.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm-dma-mapp-ng-don-t-override-dma_coherent-when-set.patch
and it can be found in the queue-6.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b4ca3b0eaa3466f8f75368b2d9b01aa8f30db3bb
Author: Christoph Hellwig <hch@xxxxxx>
Date:   Tue Oct 4 09:10:19 2022 +0200

    ARM/dma-mappіng: don't override ->dma_coherent when set from a bus notifier
    
    [ Upstream commit 49bc8bebae79c8516cb12f91818f3a7907e3ebce ]
    
    Commit ae626eb97376 ("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: ae626eb97376 ("ARM/dma-mapping: use dma-direct unconditionally")
    Reported-by: Marek Behún <kabel@xxxxxxxxxx>
    Signed-off-by: Christoph Hellwig <hch@xxxxxx>
    Reviewed-by: Russell King (Oracle) <rmk+kernel@xxxxxxxxxxxxxxx>
    Tested-by: Marek Behún <kabel@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 089c9c644cce..bfc7476f1411 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1769,8 +1769,16 @@ static void arm_teardown_iommu_dma_ops(struct device *dev) { }
 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 			const struct iommu_ops *iommu, bool coherent)
 {
-	dev->archdata.dma_coherent = coherent;
-	dev->dma_coherent = coherent;
+	/*
+	 * Due to legacy code that sets the ->dma_coherent flag from a bus
+	 * notifier we can't just assign coherent to the ->dma_coherent flag
+	 * here, but instead have to make sure we only set but never clear it
+	 * for now.
+	 */
+	if (coherent) {
+		dev->archdata.dma_coherent = true;
+		dev->dma_coherent = true;
+	}
 
 	/*
 	 * Don't override the dma_ops if they have already been set. Ideally



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux