From: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx> We never pass the GPU addresses of BOs to userspace, so userspace can never specify the correct address. Hence, this code serves no useful purpose, and can be removed. Signed-off-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx> --- drivers/staging/etnaviv/etnaviv_gem.h | 1 - drivers/staging/etnaviv/etnaviv_gem_submit.c | 36 +++++----------------------- 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/drivers/staging/etnaviv/etnaviv_gem.h b/drivers/staging/etnaviv/etnaviv_gem.h index 7844c073ee61..cfade337d4db 100644 --- a/drivers/staging/etnaviv/etnaviv_gem.h +++ b/drivers/staging/etnaviv/etnaviv_gem.h @@ -100,7 +100,6 @@ struct etnaviv_gem_submit { struct list_head bo_list; struct ww_acquire_ctx ticket; uint32_t fence; - bool valid; unsigned int nr_cmds; unsigned int nr_bos; struct { diff --git a/drivers/staging/etnaviv/etnaviv_gem_submit.c b/drivers/staging/etnaviv/etnaviv_gem_submit.c index bbe2171b8eb4..c32fb4424eea 100644 --- a/drivers/staging/etnaviv/etnaviv_gem_submit.c +++ b/drivers/staging/etnaviv/etnaviv_gem_submit.c @@ -25,7 +25,6 @@ #define BO_INVALID_FLAGS ~(ETNA_SUBMIT_BO_READ | ETNA_SUBMIT_BO_WRITE) /* make sure these don't conflict w/ MSM_SUBMIT_BO_x */ -#define BO_VALID 0x8000 #define BO_LOCKED 0x4000 #define BO_PINNED 0x2000 @@ -84,8 +83,6 @@ static int submit_lookup_objects(struct etnaviv_gem_submit *submit, } submit->bos[i].flags = submit_bo.flags; - /* in validate_objects() we figure out if this is true: */ - submit->bos[i].iova = submit_bo.presumed; /* normally use drm_gem_object_lookup(), but for bulk lookup * all under single table_lock just hit object_idr directly: @@ -131,9 +128,7 @@ static void submit_unlock_unpin_bo(struct etnaviv_gem_submit *submit, int i) if (submit->bos[i].flags & BO_LOCKED) ww_mutex_unlock(&etnaviv_obj->resv->lock); - if (!(submit->bos[i].flags & BO_VALID)) - submit->bos[i].iova = 0; - + submit->bos[i].iova = 0; submit->bos[i].flags &= ~(BO_LOCKED | BO_PINNED); } @@ -143,8 +138,6 @@ static int submit_validate_objects(struct etnaviv_gem_submit *submit) int contended, slow_locked = -1, i, ret = 0; retry: - submit->valid = true; - for (i = 0; i < submit->nr_bos; i++) { struct etnaviv_gem_object *etnaviv_obj = submit->bos[i].obj; uint32_t iova; @@ -177,14 +170,7 @@ retry: goto fail; submit->bos[i].flags |= BO_PINNED; - - if (iova == submit->bos[i].iova) { - submit->bos[i].flags |= BO_VALID; - } else { - submit->bos[i].iova = iova; - submit->bos[i].flags &= ~BO_VALID; - submit->valid = false; - } + submit->bos[i].iova = iova; } ww_acquire_done(&submit->ticket); @@ -217,7 +203,7 @@ fail: } static int submit_bo(struct etnaviv_gem_submit *submit, uint32_t idx, - struct etnaviv_gem_object **obj, uint32_t *iova, bool *valid) + struct etnaviv_gem_object **obj, uint32_t *iova) { if (idx >= submit->nr_bos) { DRM_ERROR("invalid buffer index: %u (out of %u)\n", @@ -229,8 +215,6 @@ static int submit_bo(struct etnaviv_gem_submit *submit, uint32_t idx, *obj = submit->bos[idx].obj; if (iova) *iova = submit->bos[idx].iova; - if (valid) - *valid = !!(submit->bos[idx].flags & BO_VALID); return 0; } @@ -254,7 +238,6 @@ static int submit_reloc(struct etnaviv_gem_submit *submit, struct etnaviv_gem_ob void __user *userptr = to_user_ptr(relocs + (i * sizeof(submit_reloc))); uint32_t iova, off; - bool valid; ret = copy_from_user(&submit_reloc, userptr, sizeof(submit_reloc)); @@ -276,14 +259,10 @@ static int submit_reloc(struct etnaviv_gem_submit *submit, struct etnaviv_gem_ob return -EINVAL; } - ret = submit_bo(submit, submit_reloc.reloc_idx, &bobj, - &iova, &valid); + ret = submit_bo(submit, submit_reloc.reloc_idx, &bobj, &iova); if (ret) return ret; - if (valid) - continue; - if (submit_reloc.reloc_offset >= bobj->base.size - sizeof(*ptr)) { DRM_ERROR("relocation %u outside object", i); @@ -371,8 +350,8 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, goto out; } - ret = submit_bo(submit, submit_cmd.submit_idx, - &etnaviv_obj, NULL, NULL); + ret = submit_bo(submit, submit_cmd.submit_idx, &etnaviv_obj, + NULL); if (ret) goto out; @@ -415,9 +394,6 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, submit->cmd[i].size = submit_cmd.size / 4; submit->cmd[i].obj = etnaviv_obj; - if (submit->valid) - continue; - ret = submit_reloc(submit, etnaviv_obj, submit_cmd.submit_offset, submit_cmd.nr_relocs, submit_cmd.relocs); -- 2.1.4 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel