[PATCH] drm/amdgpu: release exclusive mode after hw_init if no kfd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I would pass only pdev to kgd2kfd_probe, instead of adev.
Then, I would initialize adev inside kgd2kfd_device_init
That way, you can call kgd2kfd_probe before device_init of amdgpu and
you can know if amdkfd is supposed to handle this device.
Does that make sense ?

On Mon, Oct 30, 2017 at 11:13 AM, Ding, Pixel <Pixel.Ding at amd.com> wrote:
> Another option is adding a function with the same logics as top half probe to determine if KFD is enabled or not, like amdgpu_amdkfd_enabled().
>
> I think itâ??s okay to pass pdev separately. The KFD probe implementation also has pdev parameter, it doesnâ??t retrieve that from adev, while the middle layer does this.
>
> Which one do you prefer?
>
> â??
> Sincerely Yours,
> Pixel
>
>
>
>
>
>
>
> On 30/10/2017, 4:52 PM, "Oded Gabbay" <oded.gabbay at gmail.com> wrote:
>
>>Except from pdev, kfd doesn't access any other fields in adev, so
>>passing pdev as a different parameter seems fine.
>>The problem with that approach is we need to remember for the future
>>not to access other adev fields, and that seems risky and not correct
>>
>>
>>
>>
>>On Mon, Oct 30, 2017 at 10:30 AM, Ding, Pixel <Pixel.Ding at amd.com> wrote:
>>> Get your point. I donâ??t know why the test is passed however will revise later.
>>>
>>> I definitely want the know if KFD is enabled before device init. Any suggestion? Or do you mind if the pdev is passed to probe in other way?
>>>
>>> â??
>>> Sincerely Yours,
>>> Pixel
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 30/10/2017, 4:20 PM, "Oded Gabbay" <oded.gabbay at gmail.com> wrote:
>>>
>>>>On Mon, Oct 30, 2017 at 9:57 AM, Pixel Ding <Pixel.Ding at amd.com> wrote:
>>>>> From: pding <Pixel.Ding at amd.com>
>>>>>
>>>>> Move kfd probe prior to device init. Release exclusive mode
>>>>> after hw_init if kfd is not enabled.
>>>>>
>>>>> Signed-off-by: pding <Pixel.Ding at amd.com>
>>>>> ---
>>>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++
>>>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c    | 5 +++--
>>>>>  2 files changed, 6 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>>> index 400dfaa..e46ec51 100644
>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>>> @@ -1716,6 +1716,9 @@ static int amdgpu_init(struct amdgpu_device *adev)
>>>>>                 adev->ip_blocks[i].status.hw = true;
>>>>>         }
>>>>>
>>>>> +       if (amdgpu_sriov_vf(adev) && !adev->kfd)
>>>>> +               amdgpu_virt_release_full_gpu(adev, true);
>>>>> +
>>>>>         return 0;
>>>>>  }
>>>>>
>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>>>>> index 3e9760d..e91907c 100644
>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>>>>> @@ -138,6 +138,8 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
>>>>>             !pci_is_thunderbolt_attached(dev->pdev))
>>>>>                 flags |= AMD_IS_PX;
>>>>>
>>>>> +       amdgpu_amdkfd_device_probe(adev);
>>>>> +
>>>>>         /* amdgpu_device_init should report only fatal error
>>>>>          * like memory allocation failure or iomapping failure,
>>>>>          * or memory manager initialization failure, it must
>>>>> @@ -170,7 +172,6 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
>>>>>                                 "Error during ACPI methods call\n");
>>>>>         }
>>>>>
>>>>> -       amdgpu_amdkfd_device_probe(adev);
>>>>>         amdgpu_amdkfd_device_init(adev);
>>>>>
>>>>>         if (amdgpu_device_is_px(dev)) {
>>>>> @@ -182,7 +183,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
>>>>>                 pm_runtime_put_autosuspend(dev->dev);
>>>>>         }
>>>>>
>>>>> -       if (amdgpu_sriov_vf(adev))
>>>>> +       if (amdgpu_sriov_vf(adev) && adev->kfd)
>>>>>                 amdgpu_virt_release_full_gpu(adev, true);
>>>>>
>>>>>  out:
>>>>> --
>>>>> 2.9.5
>>>>>
>>>>> _______________________________________________
>>>>> amd-gfx mailing list
>>>>> amd-gfx at lists.freedesktop.org
>>>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>>>>
>>>>The amdkfd probe function uses the pdev field inside adev. That field
>>>>is initialized in device init, so you can't call amdkfd probe before
>>>>that function.
>>>>Oded


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux