[PATCH] drm/amdgpu: Set correct context adev for gem object

Koenig, Christian Christian.Koenig at amd.com
Tue Mar 26 19:35:45 UTC 2019


Am 26.03.19 um 20:33 schrieb Liu, Shaoyun:
> OK , just ignore it . BTW , if you think it's a hack currently used in
> KFD  to share the memory among GPUs,  what's your plane to use the peer
> GPU through XGMI from GEM  point of view ?

We just need to unpack the root bo while doing the XGMI check, e.g. we 
have a BO structure in the importing device and use this one while doing 
the mapping.

Christian.

>
> Regards
>
> shaoyun.liu
>
> On 2019-03-26 2:56 p.m., Christian König wrote:
>> Am 26.03.19 um 16:51 schrieb Liu, Shaoyun:
>>> The context device pointer could be different of the object been
>>> acctually allocated
>> Actually that is unnecessary, cause the GEM adev is always identical
>> to the file_priv.
>>
>> E.g. we don't support the hack using in the KFD for BO sharing here.
>>
>>> Change-Id: I7b2338858126d75350b65ff04d9bb419e1eae15c
>>> Signed-off-by: shaoyunl <shaoyun.liu at amd.com>
>>> ---
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++--
>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> index 9ee8d7a..a82c3b1 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> @@ -117,8 +117,8 @@ int amdgpu_gem_object_open(struct drm_gem_object
>>> *obj,
>>>                   struct drm_file *file_priv)
>>>    {
>>>        struct amdgpu_bo *abo = gem_to_amdgpu_bo(obj);
>>> -    struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev);
>>>        struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
>>> +    struct amdgpu_device *adev = fpriv->ctx_mgr.adev;
>>>        struct amdgpu_vm *vm = &fpriv->vm;
>>>        struct amdgpu_bo_va *bo_va;
>>>        struct mm_struct *mm;
>>> @@ -150,8 +150,8 @@ void amdgpu_gem_object_close(struct
>>> drm_gem_object *obj,
>>>                     struct drm_file *file_priv)
>>>    {
>>>        struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
>>> -    struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
>>>        struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
>>> +    struct amdgpu_device *adev = fpriv->ctx_mgr.adev;
>>>        struct amdgpu_vm *vm = &fpriv->vm;
>>>          struct amdgpu_bo_list_entry vm_pd;



More information about the amd-gfx mailing list