Patch "iommu: Map reserved memory as cacheable if device is coherent" has been added to the 6.7-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

    iommu: Map reserved memory as cacheable if device is coherent

to the 6.7-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:
     iommu-map-reserved-memory-as-cacheable-if-device-is-.patch
and it can be found in the queue-6.7 subdirectory.

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



commit 9aabdb74ee22acc1308a2dbd6c27112312451118
Author: Laurentiu Tudor <laurentiu.tudor@xxxxxxx>
Date:   Tue Sep 26 18:26:00 2023 +0300

    iommu: Map reserved memory as cacheable if device is coherent
    
    [ Upstream commit f1aad9df93f39267e890836a28d22511f23474e1 ]
    
    Check if the device is marked as DMA coherent in the DT and if so,
    map its reserved memory as cacheable in the IOMMU.
    This fixes the recently added IOMMU reserved memory support which
    uses IOMMU_RESV_DIRECT without properly building the PROT for the
    mapping.
    
    Fixes: a5bf3cfce8cb ("iommu: Implement of_iommu_get_resv_regions()")
    Signed-off-by: Laurentiu Tudor <laurentiu.tudor@xxxxxxx>
    Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
    Acked-by: Thierry Reding <treding@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230926152600.8749-1-laurentiu.tudor@xxxxxxx
    Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
index 35ba090f3b5e..47302b637cc0 100644
--- a/drivers/iommu/of_iommu.c
+++ b/drivers/iommu/of_iommu.c
@@ -260,6 +260,9 @@ void of_iommu_get_resv_regions(struct device *dev, struct list_head *list)
 				phys_addr_t iova;
 				size_t length;
 
+				if (of_dma_is_coherent(dev->of_node))
+					prot |= IOMMU_CACHE;
+
 				maps = of_translate_dma_region(np, maps, &iova, &length);
 				type = iommu_resv_region_get_type(dev, &phys, iova, length);
 




[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