search for: to_dma_iommu_map

Displaying 20 results from an estimated 25 matches for "to_dma_iommu_map".

2018 May 30
8
[PATCH v4 0/2] drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping
From: Thierry Reding <treding at nvidia.com> An unfortunate interaction between the 32-bit ARM DMA/IOMMU mapping code and Tegra SMMU driver changes to support IOMMU groups introduced a boot- time regression on Tegra124. This was caught very late because none of the standard configurations that are tested on Tegra enable the ARM DMA/ IOMMU mapping code since it is not needed. The reason for
2018 Apr 25
5
[PATCH 1/4] drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping
...NFIG_NOUVEAU_PLATFORM_DRIVER #include "priv.h" @@ -105,6 +110,20 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev) unsigned long pgsize_bitmap; int ret; +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) + if (dev->archdata.mapping) { + struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); + + arm_iommu_release_mapping(mapping); + arm_iommu_detach_device(dev); + + if (dev->archdata.dma_coherent) + set_dma_ops(dev, &arm_coherent_dma_ops); + else + set_dma_ops(dev, &arm_dma_ops); + } +#endif + if (!tdev->func->iommu_bit) return; -- 2.17.0
2018 Apr 25
0
[PATCH v2 5/5] ARM: Unconditionally enable ARM_DMA_USE_IOMMU
...MMU_API void *iommu; /* private IOMMU data */ #endif -#ifdef CONFIG_ARM_DMA_USE_IOMMU struct dma_iommu_mapping *mapping; -#endif #ifdef CONFIG_XEN const struct dma_map_ops *dev_dma_ops; #endif @@ -31,10 +29,6 @@ struct pdev_archdata { #endif }; -#ifdef CONFIG_ARM_DMA_USE_IOMMU #define to_dma_iommu_mapping(dev) ((dev)->archdata.mapping) -#else -#define to_dma_iommu_mapping(dev) NULL -#endif #endif diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index cc63a25bd088..f6c28ed5651a 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -1174,8 +1174,6 @@ sta...
2019 Sep 16
2
[PATCH 08/11] drm/nouveau: tegra: Skip IOMMU initialization if already attached
...ra *tdev) > { > @@ -109,14 +105,13 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev) > unsigned long pgsize_bitmap; > int ret; > > -#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) > - if (dev->archdata.mapping) { > - struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); > - > - arm_iommu_detach_device(dev); > - arm_iommu_release_mapping(mapping); > - } > -#endif > + /* > + * Skip explicit IOMMU initialization if the GPU is already attached > + * to an IOMMU domain. This can happen if the DMA API is backed by an > + * IOMMU...
2018 Apr 25
1
[PATCH v2 3/5] ARM: dma-mapping: Implement arch_iommu_detach_device()
> +void arch_iommu_detach_device(struct device *dev) > +{ > +#ifdef CONFIG_ARM_DMA_USE_IOMMU > + struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); > + const struct dma_map_ops *dma_ops; > + > + if (!mapping) > + return; > + > + arm_iommu_release_mapping(mapping); > + arm_iommu_detach_device(dev); > + > + dma_ops = arm_get_dma_map_ops(dev->archdata.dma_coherent); > + set_dma_ops(dev, dma_ops); Why n...
2018 Apr 25
11
[PATCH v2 1/5] drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping
...NFIG_NOUVEAU_PLATFORM_DRIVER #include "priv.h" @@ -105,6 +110,20 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev) unsigned long pgsize_bitmap; int ret; +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) + if (dev->archdata.mapping) { + struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); + + arm_iommu_release_mapping(mapping); + arm_iommu_detach_device(dev); + + if (dev->archdata.dma_coherent) + set_dma_ops(dev, &arm_coherent_dma_ops); + else + set_dma_ops(dev, &arm_dma_ops); + } +#endif + if (!tdev->func->iommu_bit) return; -- 2.17.0
2018 Jul 02
1
[PATCH v4 1/2] ARM: dma-mapping: Set proper DMA ops in arm_iommu_detach_device()
...E_IOMMU > > static int __dma_info_to_prot(enum dma_data_direction dir, unsigned long attrs) > @@ -2296,7 +2301,7 @@ void arm_iommu_detach_device(struct device *dev) > iommu_detach_device(mapping->domain, dev); > kref_put(&mapping->kref, release_iommu_mapping); > to_dma_iommu_mapping(dev) = NULL; > - set_dma_ops(dev, NULL); > + set_dma_ops(dev, arm_get_dma_map_ops(dev->archdata.dma_coherent)); > > pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev)); > } > @@ -2357,11 +2362,6 @@ static void arm_teardown_iommu_dma_ops(str...
2018 Apr 23
1
[PATCH] drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping
...NFIG_NOUVEAU_PLATFORM_DRIVER #include "priv.h" @@ -105,6 +110,20 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev) unsigned long pgsize_bitmap; int ret; +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) + if (dev->archdata.mapping) { + struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); + + arm_iommu_release_mapping(mapping); + arm_iommu_detach_device(dev); + + if (dev->archdata.dma_coherent) + set_dma_ops(dev, &arm_coherent_dma_ops); + else + set_dma_ops(dev, &arm_dma_ops); + } +#endif + if (!tdev->func->iommu_bit) return; -- 2.17.0
2018 May 30
2
[PATCH v3 1/2] ARM: dma-mapping: Implement arm_dma_iommu_detach_device()
...a-mapping.c > @@ -2400,3 +2400,19 @@ void arch_teardown_dma_ops(struct device *dev) > > arm_teardown_iommu_dma_ops(dev); > } > + > +void arm_dma_iommu_detach_device(struct device *dev) > +{ > +#ifdef CONFIG_ARM_DMA_USE_IOMMU > + struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); > + > + if (!mapping) > + return; > + > + arm_iommu_release_mapping(mapping); Potentially freeing the mapping before you try to operate on it is never the best idea. Plus arm_iommu_detach_device() already releases a reference appropriately anyway, so it's a double-f...
2019 Sep 16
1
[PATCH 08/11] drm/nouveau: tegra: Skip IOMMU initialization if already attached
...+105,13 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev) >>> unsigned long pgsize_bitmap; >>> int ret; >>> -#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) >>> - if (dev->archdata.mapping) { >>> - struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); >>> - >>> - arm_iommu_detach_device(dev); >>> - arm_iommu_release_mapping(mapping); >>> - } >>> -#endif >>> + /* >>> + * Skip explicit IOMMU initialization if the GPU is already attached >>> + * to an IOMMU domain...
2018 May 30
2
[PATCH v3 1/2] ARM: dma-mapping: Implement arm_dma_iommu_detach_device()
..._ops(struct device *dev) > > > arm_teardown_iommu_dma_ops(dev); > > > } > > > + > > > +void arm_dma_iommu_detach_device(struct device *dev) > > > +{ > > > +#ifdef CONFIG_ARM_DMA_USE_IOMMU > > > + struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); > > > + > > > + if (!mapping) > > > + return; > > > + > > > + arm_iommu_release_mapping(mapping); > > > > Potentially freeing the mapping before you try to operate on it is never the > > best idea. Plus arm_iommu_detach_devi...
2018 Apr 25
0
[PATCH 3/4] ARM: dma-mapping: Implement arch_iommu_detach_device()
...957938d8c9c 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -2366,6 +2366,21 @@ static void arm_teardown_iommu_dma_ops(struct device *dev) arm_iommu_release_mapping(mapping); } +void arch_iommu_detach_device(struct device *dev) +{ + struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); + const struct dma_map_ops *dma_ops; + + if (!mapping) + return; + + arm_iommu_release_mapping(mapping); + arm_iommu_detach_device(dev); + + dma_ops = arm_get_dma_map_ops(dev->archdata.dma_coherent); + set_dma_ops(dev, dma_ops); +} + #else static bool arm_setup_iommu_dma_ops(struc...
2018 Apr 26
0
[PATCH v2 3/5] ARM: dma-mapping: Implement arch_iommu_detach_device()
On Wed, Apr 25, 2018 at 08:20:49AM -0700, Christoph Hellwig wrote: > > +void arch_iommu_detach_device(struct device *dev) > > +{ > > +#ifdef CONFIG_ARM_DMA_USE_IOMMU > > + struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); > > + const struct dma_map_ops *dma_ops; > > + > > + if (!mapping) > > + return; > > + > > + arm_iommu_release_mapping(mapping); > > + arm_iommu_detach_device(dev); > > + > > + dma_ops = arm_get_dma_map_ops(dev->archdata.dma_cohere...
2018 Apr 25
0
[PATCH v2 3/5] ARM: dma-mapping: Implement arch_iommu_detach_device()
...-- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -2423,3 +2423,20 @@ void arch_teardown_dma_ops(struct device *dev) arm_teardown_iommu_dma_ops(dev); } + +void arch_iommu_detach_device(struct device *dev) +{ +#ifdef CONFIG_ARM_DMA_USE_IOMMU + struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); + const struct dma_map_ops *dma_ops; + + if (!mapping) + return; + + arm_iommu_release_mapping(mapping); + arm_iommu_detach_device(dev); + + dma_ops = arm_get_dma_map_ops(dev->archdata.dma_coherent); + set_dma_ops(dev, dma_ops); +#endif +} -- 2.17.0
2018 May 30
0
[PATCH v3 1/2] ARM: dma-mapping: Implement arm_dma_iommu_detach_device()
...a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -2400,3 +2400,19 @@ void arch_teardown_dma_ops(struct device *dev) arm_teardown_iommu_dma_ops(dev); } + +void arm_dma_iommu_detach_device(struct device *dev) +{ +#ifdef CONFIG_ARM_DMA_USE_IOMMU + struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); + + if (!mapping) + return; + + arm_iommu_release_mapping(mapping); + arm_iommu_detach_device(dev); + + set_dma_ops(dev, arm_get_dma_map_ops(dev->archdata.dma_coherent)); +#endif +} +EXPORT_SYMBOL(arm_dma_iommu_detach_device); -- 2.17.0
2018 May 30
0
[PATCH v4 1/2] ARM: dma-mapping: Set proper DMA ops in arm_iommu_detach_device()
...+} + #ifdef CONFIG_ARM_DMA_USE_IOMMU static int __dma_info_to_prot(enum dma_data_direction dir, unsigned long attrs) @@ -2296,7 +2301,7 @@ void arm_iommu_detach_device(struct device *dev) iommu_detach_device(mapping->domain, dev); kref_put(&mapping->kref, release_iommu_mapping); to_dma_iommu_mapping(dev) = NULL; - set_dma_ops(dev, NULL); + set_dma_ops(dev, arm_get_dma_map_ops(dev->archdata.dma_coherent)); pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev)); } @@ -2357,11 +2362,6 @@ static void arm_teardown_iommu_dma_ops(struct device *dev) { } #endif...
2019 Sep 16
0
[PATCH 08/11] drm/nouveau: tegra: Skip IOMMU initialization if already attached
...device_tegra_power_up(struct nvkm_device_tegra *tdev) { @@ -109,14 +105,13 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev) unsigned long pgsize_bitmap; int ret; -#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) - if (dev->archdata.mapping) { - struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); - - arm_iommu_detach_device(dev); - arm_iommu_release_mapping(mapping); - } -#endif + /* + * Skip explicit IOMMU initialization if the GPU is already attached + * to an IOMMU domain. This can happen if the DMA API is backed by an + * IOMMU. + */ + if (iommu_get_domain_for_dev(dev))...
2019 Sep 16
0
[PATCH 08/11] drm/nouveau: tegra: Skip IOMMU initialization if already attached
...; > @@ -109,14 +105,13 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev) > > unsigned long pgsize_bitmap; > > int ret; > > -#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) > > - if (dev->archdata.mapping) { > > - struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); > > - > > - arm_iommu_detach_device(dev); > > - arm_iommu_release_mapping(mapping); > > - } > > -#endif > > + /* > > + * Skip explicit IOMMU initialization if the GPU is already attached > > + * to an IOMMU domain. This can happen if the...
2018 May 30
0
[PATCH v4 2/2] drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping
..._device_tegra_power_up(struct nvkm_device_tegra *tdev) { @@ -105,6 +109,15 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev) unsigned long pgsize_bitmap; int ret; +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) + if (dev->archdata.mapping) { + struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); + + arm_iommu_detach_device(dev); + arm_iommu_release_mapping(mapping); + } +#endif + if (!tdev->func->iommu_bit) return; -- 2.17.0
2018 May 30
4
[PATCH v3 0/2] drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping
From: Thierry Reding <treding at nvidia.com> An unfortunate interaction between the 32-bit ARM DMA/IOMMU mapping code and Tegra SMMU driver changes to support IOMMU groups introduced a boot- time regression on Tegra124. This was caught very late because none of the standard configurations that are tested on Tegra enable the ARM DMA/ IOMMU mapping code since it is not needed. The reason for