* [PATCH 06/13] drm/etnaviv: Use sychronized interface of the IOMMU-API
[not found] ` <1502974596-23835-1-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
@ 2017-08-17 12:56 ` Joerg Roedel
[not found] ` <1502974596-23835-7-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2017-08-17 12:56 ` [PATCH 08/13] drm/nouveau/imem/gk20a: " Joerg Roedel
` (2 subsequent siblings)
3 siblings, 1 reply; 15+ messages in thread
From: Joerg Roedel @ 2017-08-17 12:56 UTC (permalink / raw)
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Cc: Joerg Roedel, David Airlie, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
etnaviv-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Christian Gmeiner,
Russell King, Lucas Stach
From: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
The map and unmap functions of the IOMMU-API changed their
semantics: They do no longer guarantee that the hardware
TLBs are synchronized with the page-table updates they made.
To make conversion easier, new synchronized functions have
been introduced which give these guarantees again until the
code is converted to use the new TLB-flush interface of the
IOMMU-API, which allows certain optimizations.
But for now, just convert this code to use the synchronized
functions so that it will behave as before.
Cc: Lucas Stach <l.stach-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Russell King <linux+etnaviv-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>
Cc: Christian Gmeiner <christian.gmeiner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: David Airlie <airlied-cv59FeDIM0c@public.gmane.org>
Cc: etnaviv-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Signed-off-by: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
---
drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
index f103e78..ae0247c 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
@@ -47,7 +47,7 @@ int etnaviv_iommu_map(struct etnaviv_iommu *iommu, u32 iova,
VERB("map[%d]: %08x %08x(%zx)", i, iova, pa, bytes);
- ret = iommu_map(domain, da, pa, bytes, prot);
+ ret = iommu_map_sync(domain, da, pa, bytes, prot);
if (ret)
goto fail;
@@ -62,7 +62,7 @@ int etnaviv_iommu_map(struct etnaviv_iommu *iommu, u32 iova,
for_each_sg(sgt->sgl, sg, i, j) {
size_t bytes = sg_dma_len(sg) + sg->offset;
- iommu_unmap(domain, da, bytes);
+ iommu_unmap_sync(domain, da, bytes);
da += bytes;
}
return ret;
@@ -80,7 +80,7 @@ int etnaviv_iommu_unmap(struct etnaviv_iommu *iommu, u32 iova,
size_t bytes = sg_dma_len(sg) + sg->offset;
size_t unmapped;
- unmapped = iommu_unmap(domain, da, bytes);
+ unmapped = iommu_unmap_sync(domain, da, bytes);
if (unmapped < bytes)
return unmapped;
@@ -338,7 +338,7 @@ int etnaviv_iommu_get_suballoc_va(struct etnaviv_gpu *gpu, dma_addr_t paddr,
mutex_unlock(&mmu->lock);
return ret;
}
- ret = iommu_map(mmu->domain, vram_node->start, paddr, size,
+ ret = iommu_map_sync(mmu->domain, vram_node->start, paddr, size,
IOMMU_READ);
if (ret < 0) {
drm_mm_remove_node(vram_node);
@@ -362,7 +362,7 @@ void etnaviv_iommu_put_suballoc_va(struct etnaviv_gpu *gpu,
if (mmu->version == ETNAVIV_IOMMU_V2) {
mutex_lock(&mmu->lock);
- iommu_unmap(mmu->domain,iova, size);
+ iommu_unmap_sync(mmu->domain,iova, size);
drm_mm_remove_node(vram_node);
mutex_unlock(&mmu->lock);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 08/13] drm/nouveau/imem/gk20a: Use sychronized interface of the IOMMU-API
[not found] ` <1502974596-23835-1-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2017-08-17 12:56 ` [PATCH 06/13] drm/etnaviv: Use sychronized interface of the IOMMU-API Joerg Roedel
@ 2017-08-17 12:56 ` Joerg Roedel
2017-08-17 12:56 ` [PATCH 10/13] drm/tegra: " Joerg Roedel
2017-08-17 12:56 ` [PATCH 11/13] gpu: host1x: " Joerg Roedel
3 siblings, 0 replies; 15+ messages in thread
From: Joerg Roedel @ 2017-08-17 12:56 UTC (permalink / raw)
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Cc: Joerg Roedel, David Airlie,
nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Ben Skeggs
From: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
The map and unmap functions of the IOMMU-API changed their
semantics: They do no longer guarantee that the hardware
TLBs are synchronized with the page-table updates they made.
To make conversion easier, new synchronized functions have
been introduced which give these guarantees again until the
code is converted to use the new TLB-flush interface of the
IOMMU-API, which allows certain optimizations.
But for now, just convert this code to use the synchronized
functions so that it will behave as before.
Cc: Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: David Airlie <airlied-cv59FeDIM0c@public.gmane.org>
Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Signed-off-by: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
---
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
index cd5adbe..3f0de47 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
@@ -322,8 +322,9 @@ gk20a_instobj_dtor_iommu(struct nvkm_memory *memory)
/* Unmap pages from GPU address space and free them */
for (i = 0; i < node->base.mem.size; i++) {
- iommu_unmap(imem->domain,
- (r->offset + i) << imem->iommu_pgshift, PAGE_SIZE);
+ iommu_unmap_sync(imem->domain,
+ (r->offset + i) << imem->iommu_pgshift,
+ PAGE_SIZE);
dma_unmap_page(dev, node->dma_addrs[i], PAGE_SIZE,
DMA_BIDIRECTIONAL);
__free_page(node->pages[i]);
@@ -458,14 +459,15 @@ gk20a_instobj_ctor_iommu(struct gk20a_instmem *imem, u32 npages, u32 align,
for (i = 0; i < npages; i++) {
u32 offset = (r->offset + i) << imem->iommu_pgshift;
- ret = iommu_map(imem->domain, offset, node->dma_addrs[i],
- PAGE_SIZE, IOMMU_READ | IOMMU_WRITE);
+ ret = iommu_map_sync(imem->domain, offset, node->dma_addrs[i],
+ PAGE_SIZE, IOMMU_READ | IOMMU_WRITE);
if (ret < 0) {
nvkm_error(subdev, "IOMMU mapping failure: %d\n", ret);
while (i-- > 0) {
offset -= PAGE_SIZE;
- iommu_unmap(imem->domain, offset, PAGE_SIZE);
+ iommu_unmap_sync(imem->domain, offset,
+ PAGE_SIZE);
}
goto release_area;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 10/13] drm/tegra: Use sychronized interface of the IOMMU-API
[not found] ` <1502974596-23835-1-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2017-08-17 12:56 ` [PATCH 06/13] drm/etnaviv: Use sychronized interface of the IOMMU-API Joerg Roedel
2017-08-17 12:56 ` [PATCH 08/13] drm/nouveau/imem/gk20a: " Joerg Roedel
@ 2017-08-17 12:56 ` Joerg Roedel
2017-08-17 13:28 ` Thierry Reding
2017-08-17 12:56 ` [PATCH 11/13] gpu: host1x: " Joerg Roedel
3 siblings, 1 reply; 15+ messages in thread
From: Joerg Roedel @ 2017-08-17 12:56 UTC (permalink / raw)
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Cc: Joerg Roedel, David Airlie, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Jonathan Hunter,
Thierry Reding, linux-tegra-u79uwXL29TY76Z2rM5mHXA
From: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
The map and unmap functions of the IOMMU-API changed their
semantics: They do no longer guarantee that the hardware
TLBs are synchronized with the page-table updates they made.
To make conversion easier, new synchronized functions have
been introduced which give these guarantees again until the
code is converted to use the new TLB-flush interface of the
IOMMU-API, which allows certain optimizations.
But for now, just convert this code to use the synchronized
functions so that it will behave as before.
Cc: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: David Airlie <airlied-cv59FeDIM0c@public.gmane.org>
Cc: Jonathan Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
---
drivers/gpu/drm/tegra/drm.c | 6 +++---
drivers/gpu/drm/tegra/gem.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 518f4b6..bc4528ee 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -1156,8 +1156,8 @@ void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size,
}
*dma = iova_dma_addr(&tegra->carveout.domain, alloc);
- err = iommu_map(tegra->domain, *dma, virt_to_phys(virt),
- size, IOMMU_READ | IOMMU_WRITE);
+ err = iommu_map_sync(tegra->domain, *dma, virt_to_phys(virt),
+ size, IOMMU_READ | IOMMU_WRITE);
if (err < 0)
goto free_iova;
@@ -1180,7 +1180,7 @@ void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt,
size = PAGE_ALIGN(size);
if (tegra->domain) {
- iommu_unmap(tegra->domain, dma, size);
+ iommu_unmap_sync(tegra->domain, dma, size);
free_iova(&tegra->carveout.domain,
iova_pfn(&tegra->carveout.domain, dma));
}
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index 7a39a35..639bc75 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -135,8 +135,8 @@ static int tegra_bo_iommu_map(struct tegra_drm *tegra, struct tegra_bo *bo)
bo->paddr = bo->mm->start;
- err = iommu_map_sg(tegra->domain, bo->paddr, bo->sgt->sgl,
- bo->sgt->nents, prot);
+ err = iommu_map_sg_sync(tegra->domain, bo->paddr, bo->sgt->sgl,
+ bo->sgt->nents, prot);
if (err < 0) {
dev_err(tegra->drm->dev, "failed to map buffer: %zd\n", err);
goto remove;
@@ -162,7 +162,7 @@ static int tegra_bo_iommu_unmap(struct tegra_drm *tegra, struct tegra_bo *bo)
return 0;
mutex_lock(&tegra->mm_lock);
- iommu_unmap(tegra->domain, bo->paddr, bo->size);
+ iommu_unmap_sync(tegra->domain, bo->paddr, bo->size);
drm_mm_remove_node(bo->mm);
mutex_unlock(&tegra->mm_lock);
--
2.7.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 10/13] drm/tegra: Use sychronized interface of the IOMMU-API
2017-08-17 12:56 ` [PATCH 10/13] drm/tegra: " Joerg Roedel
@ 2017-08-17 13:28 ` Thierry Reding
0 siblings, 0 replies; 15+ messages in thread
From: Thierry Reding @ 2017-08-17 13:28 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu, linux-kernel, Suravee Suthikulpanit, Joerg Roedel,
David Airlie, Jonathan Hunter, dri-devel, linux-tegra
[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]
On Thu, Aug 17, 2017 at 02:56:33PM +0200, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.de>
>
> The map and unmap functions of the IOMMU-API changed their
> semantics: They do no longer guarantee that the hardware
> TLBs are synchronized with the page-table updates they made.
>
> To make conversion easier, new synchronized functions have
> been introduced which give these guarantees again until the
> code is converted to use the new TLB-flush interface of the
> IOMMU-API, which allows certain optimizations.
>
> But for now, just convert this code to use the synchronized
> functions so that it will behave as before.
>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Jonathan Hunter <jonathanh@nvidia.com>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-tegra@vger.kernel.org
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> ---
> drivers/gpu/drm/tegra/drm.c | 6 +++---
> drivers/gpu/drm/tegra/gem.c | 6 +++---
> 2 files changed, 6 insertions(+), 6 deletions(-)
Acked-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 11/13] gpu: host1x: Use sychronized interface of the IOMMU-API
[not found] ` <1502974596-23835-1-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
` (2 preceding siblings ...)
2017-08-17 12:56 ` [PATCH 10/13] drm/tegra: " Joerg Roedel
@ 2017-08-17 12:56 ` Joerg Roedel
[not found] ` <1502974596-23835-12-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
3 siblings, 1 reply; 15+ messages in thread
From: Joerg Roedel @ 2017-08-17 12:56 UTC (permalink / raw)
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Cc: Joerg Roedel, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Thierry Reding,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
From: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
The map and unmap functions of the IOMMU-API changed their
semantics: They do no longer guarantee that the hardware
TLBs are synchronized with the page-table updates they made.
To make conversion easier, new synchronized functions have
been introduced which give these guarantees again until the
code is converted to use the new TLB-flush interface of the
IOMMU-API, which allows certain optimizations.
But for now, just convert this code to use the synchronized
functions so that it will behave as before.
Cc: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
---
drivers/gpu/host1x/cdma.c | 6 +++---
drivers/gpu/host1x/job.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
index 28541b2..bdf557e 100644
--- a/drivers/gpu/host1x/cdma.c
+++ b/drivers/gpu/host1x/cdma.c
@@ -55,7 +55,7 @@ static void host1x_pushbuffer_destroy(struct push_buffer *pb)
return;
if (host1x->domain) {
- iommu_unmap(host1x->domain, pb->dma, pb->alloc_size);
+ iommu_unmap_sync(host1x->domain, pb->dma, pb->alloc_size);
free_iova(&host1x->iova, iova_pfn(&host1x->iova, pb->dma));
}
@@ -105,8 +105,8 @@ static int host1x_pushbuffer_init(struct push_buffer *pb)
}
pb->dma = iova_dma_addr(&host1x->iova, alloc);
- err = iommu_map(host1x->domain, pb->dma, pb->phys, size,
- IOMMU_READ);
+ err = iommu_map_sync(host1x->domain, pb->dma, pb->phys, size,
+ IOMMU_READ);
if (err)
goto iommu_free_iova;
} else {
diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
index bee5044..70a029c 100644
--- a/drivers/gpu/host1x/job.c
+++ b/drivers/gpu/host1x/job.c
@@ -243,7 +243,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
goto unpin;
}
- err = iommu_map_sg(host->domain,
+ err = iommu_map_sg_sync(host->domain,
iova_dma_addr(&host->iova, alloc),
sgt->sgl, sgt->nents, IOMMU_READ);
if (err == 0) {
@@ -695,8 +695,8 @@ void host1x_job_unpin(struct host1x_job *job)
struct host1x_job_unpin_data *unpin = &job->unpins[i];
if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) && host->domain) {
- iommu_unmap(host->domain, job->addr_phys[i],
- unpin->size);
+ iommu_unmap_sync(host->domain, job->addr_phys[i],
+ unpin->size);
free_iova(&host->iova,
iova_pfn(&host->iova, job->addr_phys[i]));
}
--
2.7.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 07/13] drm/msm: Use sychronized interface of the IOMMU-API
[not found] <1502974596-23835-1-git-send-email-joro@8bytes.org>
[not found] ` <1502974596-23835-1-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
@ 2017-08-17 12:56 ` Joerg Roedel
2017-08-19 15:39 ` Rob Clark
2017-08-17 12:56 ` [PATCH 09/13] drm/rockchip: " Joerg Roedel
2 siblings, 1 reply; 15+ messages in thread
From: Joerg Roedel @ 2017-08-17 12:56 UTC (permalink / raw)
To: iommu
Cc: linux-kernel, Suravee Suthikulpanit, Joerg Roedel, Rob Clark,
David Airlie, linux-arm-msm, dri-devel, freedreno
From: Joerg Roedel <jroedel@suse.de>
The map and unmap functions of the IOMMU-API changed their
semantics: They do no longer guarantee that the hardware
TLBs are synchronized with the page-table updates they made.
To make conversion easier, new synchronized functions have
been introduced which give these guarantees again until the
code is converted to use the new TLB-flush interface of the
IOMMU-API, which allows certain optimizations.
But for now, just convert this code to use the synchronized
functions so that it will behave as before.
Cc: Rob Clark <robdclark@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: linux-arm-msm@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
drivers/gpu/drm/msm/msm_iommu.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
index b23d336..b3525b7 100644
--- a/drivers/gpu/drm/msm/msm_iommu.c
+++ b/drivers/gpu/drm/msm/msm_iommu.c
@@ -64,7 +64,8 @@ static int msm_iommu_map(struct msm_mmu *mmu, uint64_t iova,
size_t ret;
// pm_runtime_get_sync(mmu->dev);
- ret = iommu_map_sg(iommu->domain, iova, sgt->sgl, sgt->nents, prot);
+ ret = iommu_map_sg_sync(iommu->domain, iova, sgt->sgl,
+ sgt->nents, prot);
// pm_runtime_put_sync(mmu->dev);
WARN_ON(ret < 0);
@@ -77,7 +78,7 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint64_t iova,
struct msm_iommu *iommu = to_msm_iommu(mmu);
pm_runtime_get_sync(mmu->dev);
- iommu_unmap(iommu->domain, iova, len);
+ iommu_unmap_sync(iommu->domain, iova, len);
pm_runtime_put_sync(mmu->dev);
return 0;
--
2.7.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 09/13] drm/rockchip: Use sychronized interface of the IOMMU-API
[not found] <1502974596-23835-1-git-send-email-joro@8bytes.org>
[not found] ` <1502974596-23835-1-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2017-08-17 12:56 ` [PATCH 07/13] drm/msm: " Joerg Roedel
@ 2017-08-17 12:56 ` Joerg Roedel
2 siblings, 0 replies; 15+ messages in thread
From: Joerg Roedel @ 2017-08-17 12:56 UTC (permalink / raw)
To: iommu
Cc: linux-kernel, Suravee Suthikulpanit, Joerg Roedel, Mark Yao,
David Airlie, Heiko Stuebner, dri-devel, linux-arm-kernel,
linux-rockchip
From: Joerg Roedel <jroedel@suse.de>
The map and unmap functions of the IOMMU-API changed their
semantics: They do no longer guarantee that the hardware
TLBs are synchronized with the page-table updates they made.
To make conversion easier, new synchronized functions have
been introduced which give these guarantees again until the
code is converted to use the new TLB-flush interface of the
IOMMU-API, which allows certain optimizations.
But for now, just convert this code to use the synchronized
functions so that it will behave as before.
Cc: Mark Yao <mark.yao@rock-chips.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
index b74ac71..6d28224 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
@@ -41,8 +41,8 @@ static int rockchip_gem_iommu_map(struct rockchip_gem_object *rk_obj)
rk_obj->dma_addr = rk_obj->mm.start;
- ret = iommu_map_sg(private->domain, rk_obj->dma_addr, rk_obj->sgt->sgl,
- rk_obj->sgt->nents, prot);
+ ret = iommu_map_sg_sync(private->domain, rk_obj->dma_addr,
+ rk_obj->sgt->sgl, rk_obj->sgt->nents, prot);
if (ret < rk_obj->base.size) {
DRM_ERROR("failed to map buffer: size=%zd request_size=%zd\n",
ret, rk_obj->base.size);
@@ -67,7 +67,7 @@ static int rockchip_gem_iommu_unmap(struct rockchip_gem_object *rk_obj)
struct drm_device *drm = rk_obj->base.dev;
struct rockchip_drm_private *private = drm->dev_private;
- iommu_unmap(private->domain, rk_obj->dma_addr, rk_obj->size);
+ iommu_unmap_sync(private->domain, rk_obj->dma_addr, rk_obj->size);
mutex_lock(&private->mm_lock);
--
2.7.4
^ permalink raw reply related [flat|nested] 15+ messages in thread