Commit e316f08f authored by Rob Herring's avatar Rob Herring

drm/panfrost: Remove unnecessary mmu->lock mutex

There's no need to serialize io-pgtable calls and the as_lock is
sufficient to serialize flush operations, so we can remove the per
page table lock.

Fixes: 7282f764 ("drm/panfrost: Implement per FD address spaces")
Suggested-by: default avatarRobin Murphy <robin.murphy@arm.com>
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Acked-by: default avatarAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
Reviewed-by: default avatarSteven Price <steven.price@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190826223317.28509-4-robh@kernel.org
parent 330bec4b
...@@ -104,7 +104,6 @@ struct panfrost_device { ...@@ -104,7 +104,6 @@ struct panfrost_device {
struct panfrost_mmu { struct panfrost_mmu {
struct io_pgtable_cfg pgtbl_cfg; struct io_pgtable_cfg pgtbl_cfg;
struct io_pgtable_ops *pgtbl_ops; struct io_pgtable_ops *pgtbl_ops;
struct mutex lock;
int as; int as;
atomic_t as_count; atomic_t as_count;
struct list_head list; struct list_head list;
......
...@@ -228,8 +228,6 @@ static int mmu_map_sg(struct panfrost_device *pfdev, struct panfrost_mmu *mmu, ...@@ -228,8 +228,6 @@ static int mmu_map_sg(struct panfrost_device *pfdev, struct panfrost_mmu *mmu,
struct io_pgtable_ops *ops = mmu->pgtbl_ops; struct io_pgtable_ops *ops = mmu->pgtbl_ops;
u64 start_iova = iova; u64 start_iova = iova;
mutex_lock(&mmu->lock);
for_each_sg(sgt->sgl, sgl, sgt->nents, count) { for_each_sg(sgt->sgl, sgl, sgt->nents, count) {
unsigned long paddr = sg_dma_address(sgl); unsigned long paddr = sg_dma_address(sgl);
size_t len = sg_dma_len(sgl); size_t len = sg_dma_len(sgl);
...@@ -249,8 +247,6 @@ static int mmu_map_sg(struct panfrost_device *pfdev, struct panfrost_mmu *mmu, ...@@ -249,8 +247,6 @@ static int mmu_map_sg(struct panfrost_device *pfdev, struct panfrost_mmu *mmu,
mmu_hw_do_operation(pfdev, mmu, start_iova, iova - start_iova, mmu_hw_do_operation(pfdev, mmu, start_iova, iova - start_iova,
AS_COMMAND_FLUSH_PT); AS_COMMAND_FLUSH_PT);
mutex_unlock(&mmu->lock);
return 0; return 0;
} }
...@@ -304,8 +300,6 @@ void panfrost_mmu_unmap(struct panfrost_gem_object *bo) ...@@ -304,8 +300,6 @@ void panfrost_mmu_unmap(struct panfrost_gem_object *bo)
if (ret < 0) if (ret < 0)
return; return;
mutex_lock(&bo->mmu->lock);
while (unmapped_len < len) { while (unmapped_len < len) {
size_t unmapped_page; size_t unmapped_page;
size_t pgsize = get_pgsize(iova, len - unmapped_len); size_t pgsize = get_pgsize(iova, len - unmapped_len);
...@@ -321,8 +315,6 @@ void panfrost_mmu_unmap(struct panfrost_gem_object *bo) ...@@ -321,8 +315,6 @@ void panfrost_mmu_unmap(struct panfrost_gem_object *bo)
mmu_hw_do_operation(pfdev, bo->mmu, bo->node.start << PAGE_SHIFT, mmu_hw_do_operation(pfdev, bo->mmu, bo->node.start << PAGE_SHIFT,
bo->node.size << PAGE_SHIFT, AS_COMMAND_FLUSH_PT); bo->node.size << PAGE_SHIFT, AS_COMMAND_FLUSH_PT);
mutex_unlock(&bo->mmu->lock);
pm_runtime_mark_last_busy(pfdev->dev); pm_runtime_mark_last_busy(pfdev->dev);
pm_runtime_put_autosuspend(pfdev->dev); pm_runtime_put_autosuspend(pfdev->dev);
bo->is_mapped = false; bo->is_mapped = false;
...@@ -356,7 +348,6 @@ int panfrost_mmu_pgtable_alloc(struct panfrost_file_priv *priv) ...@@ -356,7 +348,6 @@ int panfrost_mmu_pgtable_alloc(struct panfrost_file_priv *priv)
struct panfrost_mmu *mmu = &priv->mmu; struct panfrost_mmu *mmu = &priv->mmu;
struct panfrost_device *pfdev = priv->pfdev; struct panfrost_device *pfdev = priv->pfdev;
mutex_init(&mmu->lock);
INIT_LIST_HEAD(&mmu->list); INIT_LIST_HEAD(&mmu->list);
mmu->as = -1; mmu->as = -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment