gpu: host1x: check relocs after all gathers are consumed
authorErik Faye-Lund <kusmabite@gmail.com>
Fri, 4 Oct 2013 20:18:33 +0000 (20:18 +0000)
committerThierry Reding <treding@nvidia.com>
Thu, 31 Oct 2013 08:20:04 +0000 (09:20 +0100)
The num_relocs count are passed to the kernel per job, not per gather.

For multi-gather jobs, we would previously fail if there were relocs in
other gathers aside from the first one.

Fix this by simply moving the check until all gathers have been
consumed.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
Acked-By: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/host1x/job.c

index c4e1050f2252679e448e58e1c2b3edffffd08073..c9ddff8c76cdb38643a16ac51c959fcaf7d139e7 100644 (file)
@@ -436,10 +436,6 @@ static int validate(struct host1x_firewall *fw, struct host1x_job_gather *g)
                }
        }
 
-       /* No relocs should remain at this point */
-       if (fw->num_relocs)
-               err = -EINVAL;
-
 out:
        return err;
 }
@@ -493,6 +489,10 @@ static inline int copy_gathers(struct host1x_job *job, struct device *dev)
                offset += g->words * sizeof(u32);
        }
 
+       /* No relocs should remain at this point */
+       if (fw.num_relocs)
+               return -EINVAL;
+
        return 0;
 }