A couple of DMA teardown fixes for 3.19
Subsystems (2)
cover A couple of DMA teardown fixes for 3.19
Hi all,
Here are a couple of DMA teardown fixes for 3.19. The first patch adds a call to of_dma_deconfigure on device destruction and the second patch fixes a redundant "Not attached" message on the console when a device without an IOMMU is destroyed on ARM.
I guess the second patch can go independently via rmk?
Will
Will Deacon (2):
of/platform: teardown DMA mappings on device destruction
ARM: dma-mapping: don't detach devices without an IOMMU during
teardown
arch/arm/mm/dma-mapping.c | 5 ++++- drivers/of/platform.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.1.4
PATCH 1/2 of/platform: teardown DMA mappings on device destruction
Now that we can create and attach to IOMMU domains via of_dma_configure, make sure we give the architecture a chance to tear them down when a platform or amba device is destroyed.
--- drivers/of/platform.c | 1 + 1 file changed, 1 insertion(+)
drivers/of/platform.c +1 -0
@@ -526,6 +526,7 @@ static int of_platform_device_destroy(struct device *dev, void *data)amba_device_unregister (to_amba_device (dev));#endif +of_dma_deconfigure (dev);of_node_clear_flag (dev->of_node,OF_POPULATED );of_node_clear_flag (dev->of_node,OF_POPULATED_BUS );return 0 ;
Signature · 1 line
2.1.4
PATCH 2/2 ARM: dma-mapping: don't detach devices without an IOMMU during teardown
In reply to Will DeaconWhen tearing down the DMA ops for a device via of_dma_deconfigure, we unconditionally detach the device from its IOMMU domain. For devices that aren't actually behind an IOMMU, this produces a "Not attached" warning message on the console.
This patch changes the teardown code so that we don't detach from the IOMMU domain when there isn't an IOMMU dma mapping to start with.
--- arch/arm/mm/dma-mapping.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/mm/dma-mapping.c +4 -1
@@ -2023,7 +2023,10 @@ static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,static void arm_teardown_iommu_dma_ops (struct device *dev) { -struct dma_iommu_mapping *mapping = dev->archdata.mapping; +struct dma_iommu_mapping *mapping =to_dma_iommu_mapping (dev); + +if (!mapping) +return ;arm_iommu_detach_device (dev);arm_iommu_release_mapping (mapping);
Signature · 1 line
2.1.4
PATCH 2/2 ARM: dma-mapping: don't detach devices without an IOMMU during teardown
Hi Will,
Thank you for the patch.
Quoted 9 lines · On Monday 12 January 2015 17:23:33 Will Deacon wrote:
When tearing down the DMA ops for a device via
of_dma_deconfigure, we unconditionally detach the device from its IOMMU domain. For devices that aren't actually behind an IOMMU, this produces a "Not attached" warning message on the console.This patch changes the teardown code so that we don't detach from the IOMMU domain when there isn't an IOMMU dma mapping to start with.
Repoerted-by Laurent Pinchart <[email protected]>
I might have reported the problem, but I haven't repoerted it :-)
Quoted 10 lines
Signed-off-by Will Deacon <[email protected]>--- arch/arm/mm/dma-mapping.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)arch/arm/mm/dma-mapping.c +0
-0
arch/arm/mm/dma-mapping.c static bool arm_setup_iommu_dma_ops(struct device · line 2027
Quoted 6 lines
arch/arm/mm/dma-mapping.c +1
-1@@ -2023,7 +2023,10 @@ static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size, static void arm_teardown_iommu_dma_ops(struct device *dev) { -struct dma_iommu_mapping *mapping = dev->archdata.mapping; +struct dma_iommu_mapping *mapping =to_dma_iommu_mapping (dev);
As the function is already protected by an #ifdef CONFIG_ARM_DMA_USE_IOMMU is there a specific reason for this change ?
Quoted 6 lines
arch/arm/mm/dma-mapping.c +3
-0+ +if (!mapping) +return ;arm_iommu_detach_device (dev);
arm_iommu_release_mapping(mapping);
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 2/2 ARM: dma-mapping: don't detach devices without an IOMMU during teardown
Quoted 6 lines · Laurent Pinchart
Quoted 5 lines · On Monday 12 January 2015 17:23:33 Will Deacon wrote:
When tearing down the DMA ops for a device via
of_dma_deconfigure, we unconditionally detach the device from its IOMMU domain. For devices that aren't actually behind an IOMMU, this produces a "Not attached" warning message on the console.
Quoted 6 lines
Quoted 4 lines
This patch changes the teardown code so that we don't detach from the IOMMU domain when there isn't an IOMMU dma mapping to start with.
Repoerted-by Laurent Pinchart <[email protected]>I might have reported the problem, but I haven't repoerted it :-)
D'oh, fat fingers. Sorry!
Quoted 12 lines
Quoted 12 lines
Signed-off-by Will Deacon <[email protected]>--- arch/arm/mm/dma-mapping.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)arch/arm/mm/dma-mapping.c +0
-0@@ -2023,7 +2023,10 @@ static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,
Quoted 7 lines
arch/arm/mm/dma-mapping.c static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size, · line 2026
Quoted 4 lines
arch/arm/mm/dma-mapping.c +1
-1static void arm_teardown_iommu_dma_ops (struct device *dev) { -struct dma_iommu_mapping *mapping = dev->archdata.mapping; +struct dma_iommu_mapping *mapping =to_dma_iommu_mapping (dev);As the function is already protected by an #ifdef
CONFIG_ARM_DMA_USE_IOMMUis there a specific reason for this change ?
I just wanted to hide the archdata access, since we shouldn't really care where it's stored. I could do it as a seperate patch, but I was in the area...
Will
PATCH 2/2 ARM: dma-mapping: don't detach devices without an IOMMU during teardown
Hi Will,
Quoted 38 lines · On Tuesday 13 January 2015 15:24:45 Will Deacon wrote:
Quoted 6 lines · Laurent Pinchart
Quoted 5 lines · On Monday 12 January 2015 17:23:33 Will Deacon wrote:
When tearing down the DMA ops for a device via
of_dma_deconfigure, we unconditionally detach the device from its IOMMU domain. For devices that aren't actually behind an IOMMU, this produces a "Not attached" warning message on the console.Quoted 6 lines
Quoted 4 lines
This patch changes the teardown code so that we don't detach from the IOMMU domain when there isn't an IOMMU dma mapping to start with.
Repoerted-by Laurent Pinchart <[email protected]>I might have reported the problem, but I haven't repoerted it :-)
D'oh, fat fingers. Sorry!
Quoted 13 lines
Quoted 13 lines
Signed-off-by Will Deacon <[email protected]>---
arch/arm/mm/dma-mapping.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)arch/arm/mm/dma-mapping.c +0
-0@@ -2023,7 +2023,10 @@ static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,Quoted 8 lines
arch/arm/mm/dma-mapping.c static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,
Quoted 5 lines
arch/arm/mm/dma-mapping.c +1
-1static void arm_teardown_iommu_dma_ops (struct device *dev) { -struct dma_iommu_mapping *mapping = dev->archdata.mapping; +struct dma_iommu_mapping *mapping =to_dma_iommu_mapping (dev);As the function is already protected by an #ifdef
CONFIG_ARM_DMA_USE_IOMMUis there a specific reason for this change ?
Quoted 3 lines
I just wanted to hide the archdata access, since we shouldn't really care where it's stored. I could do it as a seperate patch, but I was in the area...
No issue about that, but you could then send another patch to replace all direct references to dev->archdata.mapping in the file.
Signature · 3 lines
Regards, Laurent Pinchart