Skip to content

Commit 191a24c

Browse files
digetxgregkh
authored andcommitted
gpu: host1x: Add back arm_iommu_detach_device()
commit d518596 upstream. Host1x DMA buffer isn't mapped properly when CONFIG_ARM_DMA_USE_IOMMU=y. The memory management code of Host1x driver has a longstanding overhaul overdue and it's not obvious where the problem is in this case. Hence let's add back the old workaround which we already had sometime before. It explicitly detaches Host1x device from the offending implicit IOMMU domain. This fixes a completely broken Host1x DMA in case of ARM32 multiplatform kernel config. Cc: stable@vger.kernel.org Fixes: af1cbfb ("gpu: host1x: Support DMA mapping of buffers") Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0680674 commit 191a24c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎drivers/gpu/host1x/dev.c‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
#include <trace/events/host1x.h>
1919
#undef CREATE_TRACE_POINTS
2020

21+
#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
22+
#include <asm/dma-iommu.h>
23+
#endif
24+
2125
#include "bus.h"
2226
#include "channel.h"
2327
#include "debug.h"
@@ -232,6 +236,17 @@ static struct iommu_domain *host1x_iommu_attach(struct host1x *host)
232236
struct iommu_domain *domain = iommu_get_domain_for_dev(host->dev);
233237
int err;
234238

239+
#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
240+
if (host->dev->archdata.mapping) {
241+
struct dma_iommu_mapping *mapping =
242+
to_dma_iommu_mapping(host->dev);
243+
arm_iommu_detach_device(host->dev);
244+
arm_iommu_release_mapping(mapping);
245+
246+
domain = iommu_get_domain_for_dev(host->dev);
247+
}
248+
#endif
249+
235250
/*
236251
* We may not always want to enable IOMMU support (for example if the
237252
* host1x firewall is already enabled and we don't support addressing

0 commit comments

Comments
 (0)