gpu: host1x: check relocs after all gathers are consumed

Submitted by Erik Faye-Lund on Oct. 4, 2013, 8:18 p.m.

Details

Message ID 1380917913-20482-1-git-send-email-kusmabite@gmail.com
State Not Applicable, archived
Headers show

Commit Message

Erik Faye-Lund Oct. 4, 2013, 8:18 p.m.
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>
---
 drivers/gpu/host1x/job.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Arto Merilainen Oct. 8, 2013, 5:22 a.m.
On 10/04/2013 11:18 PM, Erik Faye-Lund wrote:
> 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>

- Arto
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Terje Bergström Oct. 8, 2013, 10:57 a.m.
On 04.10.2013 23:18, Erik Faye-Lund wrote:
> 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>
> ---
>  drivers/gpu/host1x/job.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
> index c4e1050..c9ddff8 100644
> --- a/drivers/gpu/host1x/job.c
> +++ b/drivers/gpu/host1x/job.c
> @@ -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;
>  }

Good catch.

Acked-By: Terje Bergstrom <tbergstrom@nvidia.com>

Terje

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding Oct. 8, 2013, 11:32 a.m.
On Fri, Oct 04, 2013 at 08:18:33PM +0000, Erik Faye-Lund wrote:
> 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>
> ---
>  drivers/gpu/host1x/job.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

Thierry

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
index c4e1050..c9ddff8 100644
--- a/drivers/gpu/host1x/job.c
+++ b/drivers/gpu/host1x/job.c
@@ -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;
 }