[08/12] drm/amdgpu: disallow foreign BOs for UVD/VCE

Submitted by Kuehling, Felix on July 3, 2017, 9:11 p.m.

Details

Message ID 1499116294-12817-9-git-send-email-Felix.Kuehling@amd.com
State New
Headers show
Series "Patches from amd-kfd-staging" ( rev: 4 3 2 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Kuehling, Felix July 3, 2017, 9:11 p.m.
From: Christian König <christian.koenig@amd.com>

They don't support VM mode yet.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 82131d7..24035e4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -1343,7 +1343,8 @@  struct amdgpu_bo_va_mapping *
 		struct amdgpu_bo_list_entry *lobj;
 
 		lobj = &parser->bo_list->array[i];
-		if (!lobj->bo_va)
+		if (!lobj->bo_va ||
+		    amdgpu_ttm_adev(lobj->bo_va->bo->tbo.bdev) != parser->adev)
 			continue;
 
 		list_for_each_entry(mapping, &lobj->bo_va->valids, list) {

Comments

On Mon, Jul 3, 2017 at 5:11 PM, Felix Kuehling <Felix.Kuehling@amd.com> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> They don't support VM mode yet.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>

This could probably be refined since newer asics support VM for MM
engines.  Maybe add a comment to that effect?  I would add a comment
in general either way.

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 82131d7..24035e4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -1343,7 +1343,8 @@ struct amdgpu_bo_va_mapping *
>                 struct amdgpu_bo_list_entry *lobj;
>
>                 lobj = &parser->bo_list->array[i];
> -               if (!lobj->bo_va)
> +               if (!lobj->bo_va ||
> +                   amdgpu_ttm_adev(lobj->bo_va->bo->tbo.bdev) != parser->adev)
>                         continue;
>
>                 list_for_each_entry(mapping, &lobj->bo_va->valids, list) {
> --
> 1.9.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
On 17-07-03 10:55 PM, Alex Deucher wrote:
> On Mon, Jul 3, 2017 at 5:11 PM, Felix Kuehling <Felix.Kuehling@amd.com> wrote:
>> From: Christian König <christian.koenig@amd.com>
>>
>> They don't support VM mode yet.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> This could probably be refined since newer asics support VM for MM
> engines.  Maybe add a comment to that effect?  I would add a comment
> in general either way.
As I understand it, the code doesn't specifically check for UVD or VCE.
It just looks at whether the BO list entry has a virtual address
mapping. If on newer chips user mode creates a virtual address mapping
for UVD/VCE, they should be able to use foreign BOs just fine.

So I think, all I need to change is the commit message.

Regards,
  Felix

>
> Alex
>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> index 82131d7..24035e4 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> @@ -1343,7 +1343,8 @@ struct amdgpu_bo_va_mapping *
>>                 struct amdgpu_bo_list_entry *lobj;
>>
>>                 lobj = &parser->bo_list->array[i];
>> -               if (!lobj->bo_va)
>> +               if (!lobj->bo_va ||
>> +                   amdgpu_ttm_adev(lobj->bo_va->bo->tbo.bdev) != parser->adev)
>>                         continue;
>>
>>                 list_for_each_entry(mapping, &lobj->bo_va->valids, list) {
>> --
>> 1.9.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 12.07.2017 um 07:06 schrieb Felix Kuehling:
> On 17-07-03 10:55 PM, Alex Deucher wrote:
>> On Mon, Jul 3, 2017 at 5:11 PM, Felix Kuehling <Felix.Kuehling@amd.com> wrote:
>>> From: Christian König <christian.koenig@amd.com>
>>>
>>> They don't support VM mode yet.
>>>
>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
>> This could probably be refined since newer asics support VM for MM
>> engines.  Maybe add a comment to that effect?  I would add a comment
>> in general either way.
> As I understand it, the code doesn't specifically check for UVD or VCE.
> It just looks at whether the BO list entry has a virtual address
> mapping. If on newer chips user mode creates a virtual address mapping
> for UVD/VCE, they should be able to use foreign BOs just fine.
>
> So I think, all I need to change is the commit message.

Yeah, correct. The code is called for all rings which need to access 
it's buffers using VMID0, at the time of writing that was just UVD/VCE.

Sorry, haven't seen Alex mail earlier, other I would have already 
corrected that.

Regards,
Christian.

>
> Regards,
>    Felix
>
>> Alex
>>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>>> index 82131d7..24035e4 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>>> @@ -1343,7 +1343,8 @@ struct amdgpu_bo_va_mapping *
>>>                  struct amdgpu_bo_list_entry *lobj;
>>>
>>>                  lobj = &parser->bo_list->array[i];
>>> -               if (!lobj->bo_va)
>>> +               if (!lobj->bo_va ||
>>> +                   amdgpu_ttm_adev(lobj->bo_va->bo->tbo.bdev) != parser->adev)
>>>                          continue;
>>>
>>>                  list_for_each_entry(mapping, &lobj->bo_va->valids, list) {
>>> --
>>> 1.9.1
>>>
>>> _______________________________________________
>>> amd-gfx mailing list
>>> amd-gfx@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx