[PATCH 2/3] drm/amdgpu: release exclusive mode after hw_init if no kfd
Ding, Pixel
Pixel.Ding at amd.com
Fri Nov 3 01:00:52 UTC 2017
Hi Felix,
KFD will set HQD. These registers must be accessed in exclusive mode, otherwise driver use KIQ to access them which causes world switch failure.
—
Sincerely Yours,
Pixel
On 02/11/2017, 9:49 PM, "Kuehling, Felix" <Felix.Kuehling at amd.com> wrote:
>Hi Pixel,
>
>I'm curious, which part of the KFD initialization requires exclusive
>access? KFD doesn't access MMIO directly, only through callbacks to
>amdgpu. Which of those callbacks are only used during initialization,
>and require exclusive access? Maybe that's something that can be fixed.
>
>Regards,
> Felix
>
>
>On 2017-11-01 11:16 PM, Pixel Ding wrote:
>> From: pding <Pixel.Ding at amd.com>
>>
>> KFD device init requires exclusive mode. Driver can 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 809e656..dc1d1af 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 acdb010..589b41f 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> @@ -130,6 +130,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
>>
>> dev->dev_private = (void *)adev;
>>
>> + 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
>> @@ -141,6 +142,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
>> adev->virt.caps &= ~AMDGPU_SRIOV_CAPS_RUNTIME;
>> adev->virt.ops = NULL;
>> amdgpu_device_fini(adev);
>> + kfree(adev->kfd);
>> kfree(adev);
>> dev->dev_private = NULL;
>> /* Don't request EX mode too frequently which is attacking */
>> @@ -162,7 +164,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)) {
>> @@ -174,7 +175,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:
>
More information about the amd-gfx
mailing list