diff mbox

[1/2] gpu: host1x: Don't fail on NULL bo physical address

Message ID 20170802095505.27250-1-mperttunen@nvidia.com
State Accepted
Headers show

Commit Message

Mikko Perttunen Aug. 2, 2017, 9:55 a.m. UTC
Pinning a Host1x BO currently cannot fail and zero is a valid address
for a BO when IOMMU is enabled. To avoid false errors remove checks
for NULL BO physical addresses.

Fixes: 404bfb78daf3 ("gpu: host1x: Add IOMMU support")
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/gpu/host1x/job.c | 8 --------
 1 file changed, 8 deletions(-)

Comments

Dmitry Osipenko Aug. 2, 2017, 11:06 a.m. UTC | #1
On 02.08.2017 12:55, Mikko Perttunen wrote:
> Pinning a Host1x BO currently cannot fail and zero is a valid address
> for a BO when IOMMU is enabled. To avoid false errors remove checks
> for NULL BO physical addresses.
> 
> Fixes: 404bfb78daf3 ("gpu: host1x: Add IOMMU support")
> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
> ---
>  drivers/gpu/host1x/job.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
> index bee504406cfc..db509ab8874e 100644
> --- a/drivers/gpu/host1x/job.c
> +++ b/drivers/gpu/host1x/job.c
> @@ -197,10 +197,6 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
>  		}
>  
>  		phys_addr = host1x_bo_pin(reloc->target.bo, &sgt);
> -		if (!phys_addr) {
> -			err = -EINVAL;
> -			goto unpin;
> -		}
>  
>  		job->addr_phys[job->num_unpins] = phys_addr;
>  		job->unpins[job->num_unpins].bo = reloc->target.bo;
> @@ -225,10 +221,6 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
>  		}
>  
>  		phys_addr = host1x_bo_pin(g->bo, &sgt);
> -		if (!phys_addr) {
> -			err = -EINVAL;
> -			goto unpin;
> -		}
>  
>  		if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) && host->domain) {
>  			for_each_sg(sgt->sgl, sg, sgt->nents, j)
> 

I think 'Fixes' tag isn't really needed for this patch since it's not a bug fix,
but a cleanup.

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Mikko Perttunen Aug. 2, 2017, 11:16 a.m. UTC | #2
On 08/02/2017 02:06 PM, Dmitry Osipenko wrote:
> On 02.08.2017 12:55, Mikko Perttunen wrote:
>> Pinning a Host1x BO currently cannot fail and zero is a valid address
>> for a BO when IOMMU is enabled. To avoid false errors remove checks
>> for NULL BO physical addresses.
>>
>> Fixes: 404bfb78daf3 ("gpu: host1x: Add IOMMU support")
>> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
>> ---
>>   drivers/gpu/host1x/job.c | 8 --------
>>   1 file changed, 8 deletions(-)
>>
>> diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
>> index bee504406cfc..db509ab8874e 100644
>> --- a/drivers/gpu/host1x/job.c
>> +++ b/drivers/gpu/host1x/job.c
>> @@ -197,10 +197,6 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
>>   		}
>>   
>>   		phys_addr = host1x_bo_pin(reloc->target.bo, &sgt);
>> -		if (!phys_addr) {
>> -			err = -EINVAL;
>> -			goto unpin;
>> -		}
>>   
>>   		job->addr_phys[job->num_unpins] = phys_addr;
>>   		job->unpins[job->num_unpins].bo = reloc->target.bo;
>> @@ -225,10 +221,6 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
>>   		}
>>   
>>   		phys_addr = host1x_bo_pin(g->bo, &sgt);
>> -		if (!phys_addr) {
>> -			err = -EINVAL;
>> -			goto unpin;
>> -		}
>>   
>>   		if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) && host->domain) {
>>   			for_each_sg(sgt->sgl, sg, sgt->nents, j)
>>
> 
> I think 'Fixes' tag isn't really needed for this patch since it's not a bug fix,
> but a cleanup.
> 
> Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
> 

Actually without this, host1x_test fails for me on the first try on TX1 
:) So it's a bugfix.

Thanks for the reviews and tests.

Mikko
--
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
Dmitry Osipenko Aug. 2, 2017, 11:29 a.m. UTC | #3
On 02.08.2017 14:16, Mikko Perttunen wrote:
> On 08/02/2017 02:06 PM, Dmitry Osipenko wrote:
>> On 02.08.2017 12:55, Mikko Perttunen wrote:
>>> Pinning a Host1x BO currently cannot fail and zero is a valid address
>>> for a BO when IOMMU is enabled. To avoid false errors remove checks
>>> for NULL BO physical addresses.
>>>
>>> Fixes: 404bfb78daf3 ("gpu: host1x: Add IOMMU support")
>>> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
>>> ---
>>>   drivers/gpu/host1x/job.c | 8 --------
>>>   1 file changed, 8 deletions(-)
>>>
>>> diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
>>> index bee504406cfc..db509ab8874e 100644
>>> --- a/drivers/gpu/host1x/job.c
>>> +++ b/drivers/gpu/host1x/job.c
>>> @@ -197,10 +197,6 @@ static unsigned int pin_job(struct host1x *host, struct
>>> host1x_job *job)
>>>           }
>>>             phys_addr = host1x_bo_pin(reloc->target.bo, &sgt);
>>> -        if (!phys_addr) {
>>> -            err = -EINVAL;
>>> -            goto unpin;
>>> -        }
>>>             job->addr_phys[job->num_unpins] = phys_addr;
>>>           job->unpins[job->num_unpins].bo = reloc->target.bo;
>>> @@ -225,10 +221,6 @@ static unsigned int pin_job(struct host1x *host, struct
>>> host1x_job *job)
>>>           }
>>>             phys_addr = host1x_bo_pin(g->bo, &sgt);
>>> -        if (!phys_addr) {
>>> -            err = -EINVAL;
>>> -            goto unpin;
>>> -        }
>>>             if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) && host->domain) {
>>>               for_each_sg(sgt->sgl, sg, sgt->nents, j)
>>>
>>
>> I think 'Fixes' tag isn't really needed for this patch since it's not a bug fix,
>> but a cleanup.
>>
>> Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
>>
> 
> Actually without this, host1x_test fails for me on the first try on TX1 :) So
> it's a bugfix.

Right, my bad.

> 
> Thanks for the reviews and tests.
> 

I haven't tested this patch, only the the second because I've tested it on top
of grate's kernel which has a conflicting patch being applied.
Thierry Reding Aug. 17, 2017, 3:30 p.m. UTC | #4
On Wed, Aug 02, 2017 at 12:55:04PM +0300, Mikko Perttunen wrote:
> Pinning a Host1x BO currently cannot fail and zero is a valid address
> for a BO when IOMMU is enabled. To avoid false errors remove checks
> for NULL BO physical addresses.
> 
> Fixes: 404bfb78daf3 ("gpu: host1x: Add IOMMU support")
> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
> ---
>  drivers/gpu/host1x/job.c | 8 --------
>  1 file changed, 8 deletions(-)

Applied, thanks.

Thierry
diff mbox

Patch

diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
index bee504406cfc..db509ab8874e 100644
--- a/drivers/gpu/host1x/job.c
+++ b/drivers/gpu/host1x/job.c
@@ -197,10 +197,6 @@  static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
 		}
 
 		phys_addr = host1x_bo_pin(reloc->target.bo, &sgt);
-		if (!phys_addr) {
-			err = -EINVAL;
-			goto unpin;
-		}
 
 		job->addr_phys[job->num_unpins] = phys_addr;
 		job->unpins[job->num_unpins].bo = reloc->target.bo;
@@ -225,10 +221,6 @@  static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
 		}
 
 		phys_addr = host1x_bo_pin(g->bo, &sgt);
-		if (!phys_addr) {
-			err = -EINVAL;
-			goto unpin;
-		}
 
 		if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) && host->domain) {
 			for_each_sg(sgt->sgl, sg, sgt->nents, j)