Commit a3dec9cd authored by Rob Clark's avatar Rob Clark

drm/msm/gem: Remove "valid" tracking

This was a small optimization for pre-soft-pin userspace.  But mesa
switched to soft-pin nearly 5yrs ago.  So lets drop the optimization
and simplify the code.
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/568328/
parent 3e6688fd
...@@ -275,7 +275,6 @@ struct msm_gem_submit { ...@@ -275,7 +275,6 @@ struct msm_gem_submit {
struct msm_gpu_submitqueue *queue; struct msm_gpu_submitqueue *queue;
struct pid *pid; /* submitting process */ struct pid *pid; /* submitting process */
bool fault_dumped; /* Limit devcoredump dumping to one per submit */ bool fault_dumped; /* Limit devcoredump dumping to one per submit */
bool valid; /* true if no cmdstream patching needed */
bool in_rb; /* "sudo" mode, copy cmds into RB */ bool in_rb; /* "sudo" mode, copy cmds into RB */
struct msm_ringbuffer *ring; struct msm_ringbuffer *ring;
unsigned int nr_cmds; unsigned int nr_cmds;
...@@ -292,7 +291,6 @@ struct msm_gem_submit { ...@@ -292,7 +291,6 @@ struct msm_gem_submit {
} *cmd; /* array of size nr_cmds */ } *cmd; /* array of size nr_cmds */
struct { struct {
/* make sure these don't conflict w/ MSM_SUBMIT_BO_x */ /* make sure these don't conflict w/ MSM_SUBMIT_BO_x */
#define BO_VALID 0x8000 /* is current addr in cmdstream correct/valid? */
#define BO_LOCKED 0x4000 /* obj lock is held */ #define BO_LOCKED 0x4000 /* obj lock is held */
#define BO_PINNED 0x2000 /* obj (pages) is pinned and on active list */ #define BO_PINNED 0x2000 /* obj (pages) is pinned and on active list */
uint32_t flags; uint32_t flags;
......
...@@ -150,8 +150,6 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, ...@@ -150,8 +150,6 @@ static int submit_lookup_objects(struct msm_gem_submit *submit,
submit->bos[i].handle = submit_bo.handle; submit->bos[i].handle = submit_bo.handle;
submit->bos[i].flags = submit_bo.flags; submit->bos[i].flags = submit_bo.flags;
/* in validate_objects() we figure out if this is true: */
submit->bos[i].iova = submit_bo.presumed;
} }
spin_lock(&file->table_lock); spin_lock(&file->table_lock);
...@@ -278,9 +276,6 @@ static void submit_unlock_unpin_bo(struct msm_gem_submit *submit, int i) ...@@ -278,9 +276,6 @@ static void submit_unlock_unpin_bo(struct msm_gem_submit *submit, int i)
{ {
unsigned cleanup_flags = BO_PINNED | BO_LOCKED; unsigned cleanup_flags = BO_PINNED | BO_LOCKED;
submit_cleanup_bo(submit, i, cleanup_flags); submit_cleanup_bo(submit, i, cleanup_flags);
if (!(submit->bos[i].flags & BO_VALID))
submit->bos[i].iova = 0;
} }
/* This is where we make sure all the bo's are reserved and pin'd: */ /* This is where we make sure all the bo's are reserved and pin'd: */
...@@ -390,8 +385,6 @@ static int submit_pin_objects(struct msm_gem_submit *submit) ...@@ -390,8 +385,6 @@ static int submit_pin_objects(struct msm_gem_submit *submit)
struct msm_drm_private *priv = submit->dev->dev_private; struct msm_drm_private *priv = submit->dev->dev_private;
int i, ret = 0; int i, ret = 0;
submit->valid = true;
for (i = 0; i < submit->nr_bos; i++) { for (i = 0; i < submit->nr_bos; i++) {
struct drm_gem_object *obj = submit->bos[i].obj; struct drm_gem_object *obj = submit->bos[i].obj;
struct msm_gem_vma *vma; struct msm_gem_vma *vma;
...@@ -407,14 +400,7 @@ static int submit_pin_objects(struct msm_gem_submit *submit) ...@@ -407,14 +400,7 @@ static int submit_pin_objects(struct msm_gem_submit *submit)
if (ret) if (ret)
break; break;
if (vma->iova == submit->bos[i].iova) { submit->bos[i].iova = vma->iova;
submit->bos[i].flags |= BO_VALID;
} else {
submit->bos[i].iova = vma->iova;
/* iova changed, so address in cmdstream is not valid: */
submit->bos[i].flags &= ~BO_VALID;
submit->valid = false;
}
} }
/* /*
...@@ -451,7 +437,7 @@ static void submit_attach_object_fences(struct msm_gem_submit *submit) ...@@ -451,7 +437,7 @@ static void submit_attach_object_fences(struct msm_gem_submit *submit)
} }
static int submit_bo(struct msm_gem_submit *submit, uint32_t idx, static int submit_bo(struct msm_gem_submit *submit, uint32_t idx,
struct drm_gem_object **obj, uint64_t *iova, bool *valid) struct drm_gem_object **obj, uint64_t *iova)
{ {
if (idx >= submit->nr_bos) { if (idx >= submit->nr_bos) {
SUBMIT_ERROR(submit, "invalid buffer index: %u (out of %u)\n", SUBMIT_ERROR(submit, "invalid buffer index: %u (out of %u)\n",
...@@ -463,8 +449,6 @@ static int submit_bo(struct msm_gem_submit *submit, uint32_t idx, ...@@ -463,8 +449,6 @@ static int submit_bo(struct msm_gem_submit *submit, uint32_t idx,
*obj = submit->bos[idx].obj; *obj = submit->bos[idx].obj;
if (iova) if (iova)
*iova = submit->bos[idx].iova; *iova = submit->bos[idx].iova;
if (valid)
*valid = !!(submit->bos[idx].flags & BO_VALID);
return 0; return 0;
} }
...@@ -477,9 +461,6 @@ static int submit_reloc(struct msm_gem_submit *submit, struct drm_gem_object *ob ...@@ -477,9 +461,6 @@ static int submit_reloc(struct msm_gem_submit *submit, struct drm_gem_object *ob
uint32_t *ptr; uint32_t *ptr;
int ret = 0; int ret = 0;
if (!nr_relocs)
return 0;
if (offset % 4) { if (offset % 4) {
SUBMIT_ERROR(submit, "non-aligned cmdstream buffer: %u\n", offset); SUBMIT_ERROR(submit, "non-aligned cmdstream buffer: %u\n", offset);
return -EINVAL; return -EINVAL;
...@@ -500,7 +481,6 @@ static int submit_reloc(struct msm_gem_submit *submit, struct drm_gem_object *ob ...@@ -500,7 +481,6 @@ static int submit_reloc(struct msm_gem_submit *submit, struct drm_gem_object *ob
struct drm_msm_gem_submit_reloc submit_reloc = relocs[i]; struct drm_msm_gem_submit_reloc submit_reloc = relocs[i];
uint32_t off; uint32_t off;
uint64_t iova; uint64_t iova;
bool valid;
if (submit_reloc.submit_offset % 4) { if (submit_reloc.submit_offset % 4) {
SUBMIT_ERROR(submit, "non-aligned reloc offset: %u\n", SUBMIT_ERROR(submit, "non-aligned reloc offset: %u\n",
...@@ -519,13 +499,10 @@ static int submit_reloc(struct msm_gem_submit *submit, struct drm_gem_object *ob ...@@ -519,13 +499,10 @@ static int submit_reloc(struct msm_gem_submit *submit, struct drm_gem_object *ob
goto out; goto out;
} }
ret = submit_bo(submit, submit_reloc.reloc_idx, NULL, &iova, &valid); ret = submit_bo(submit, submit_reloc.reloc_idx, NULL, &iova);
if (ret) if (ret)
goto out; goto out;
if (valid)
continue;
iova += submit_reloc.reloc_offset; iova += submit_reloc.reloc_offset;
if (submit_reloc.shift < 0) if (submit_reloc.shift < 0)
...@@ -879,8 +856,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, ...@@ -879,8 +856,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
struct drm_gem_object *obj; struct drm_gem_object *obj;
uint64_t iova; uint64_t iova;
ret = submit_bo(submit, submit->cmd[i].idx, ret = submit_bo(submit, submit->cmd[i].idx, &obj, &iova);
&obj, &iova, NULL);
if (ret) if (ret)
goto out; goto out;
...@@ -894,17 +870,13 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, ...@@ -894,17 +870,13 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
submit->cmd[i].iova = iova + (submit->cmd[i].offset * 4); submit->cmd[i].iova = iova + (submit->cmd[i].offset * 4);
if (submit->valid) if (likely(!submit->cmd[i].nr_relocs))
continue; continue;
if (!gpu->allow_relocs) { if (!gpu->allow_relocs) {
if (submit->cmd[i].nr_relocs) { SUBMIT_ERROR(submit, "relocs not allowed\n");
SUBMIT_ERROR(submit, "relocs not allowed\n"); ret = -EINVAL;
ret = -EINVAL; goto out;
goto out;
}
continue;
} }
ret = submit_reloc(submit, obj, submit->cmd[i].offset * 4, ret = submit_reloc(submit, obj, submit->cmd[i].offset * 4,
......
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