drm/amdgpu: Fix handling of KFD initialization failures
Remember KFD module initializaton status in a global variable. Skip KFD device probing when the module was not initialized. Other amdgpu_amdkfd calls are then protected by the adev->kfd.dev check. Also print a clear error message when KFD disables itself. Amdgpu continues its initialization even when KFD failed. Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Reviewed-by: Kent Russell <kent.russell@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
911d5bd5e7
commit
c7651b7358
@ -36,6 +36,8 @@
|
|||||||
*/
|
*/
|
||||||
uint64_t amdgpu_amdkfd_total_mem_size;
|
uint64_t amdgpu_amdkfd_total_mem_size;
|
||||||
|
|
||||||
|
bool kfd_initialized;
|
||||||
|
|
||||||
int amdgpu_amdkfd_init(void)
|
int amdgpu_amdkfd_init(void)
|
||||||
{
|
{
|
||||||
struct sysinfo si;
|
struct sysinfo si;
|
||||||
@ -51,19 +53,26 @@ int amdgpu_amdkfd_init(void)
|
|||||||
#else
|
#else
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
#endif
|
#endif
|
||||||
|
kfd_initialized = !ret;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void amdgpu_amdkfd_fini(void)
|
void amdgpu_amdkfd_fini(void)
|
||||||
{
|
{
|
||||||
kgd2kfd_exit();
|
if (kfd_initialized) {
|
||||||
|
kgd2kfd_exit();
|
||||||
|
kfd_initialized = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev)
|
void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev)
|
||||||
{
|
{
|
||||||
bool vf = amdgpu_sriov_vf(adev);
|
bool vf = amdgpu_sriov_vf(adev);
|
||||||
|
|
||||||
|
if (!kfd_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
adev->kfd.dev = kgd2kfd_probe((struct kgd_dev *)adev,
|
adev->kfd.dev = kgd2kfd_probe((struct kgd_dev *)adev,
|
||||||
adev->pdev, adev->asic_type, vf);
|
adev->pdev, adev->asic_type, vf);
|
||||||
|
|
||||||
|
@ -97,6 +97,7 @@ void kfd_chardev_exit(void)
|
|||||||
device_destroy(kfd_class, MKDEV(kfd_char_dev_major, 0));
|
device_destroy(kfd_class, MKDEV(kfd_char_dev_major, 0));
|
||||||
class_destroy(kfd_class);
|
class_destroy(kfd_class);
|
||||||
unregister_chrdev(kfd_char_dev_major, kfd_dev_name);
|
unregister_chrdev(kfd_char_dev_major, kfd_dev_name);
|
||||||
|
kfd_device = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct device *kfd_chardev(void)
|
struct device *kfd_chardev(void)
|
||||||
|
@ -70,6 +70,7 @@ err_create_wq:
|
|||||||
err_topology:
|
err_topology:
|
||||||
kfd_chardev_exit();
|
kfd_chardev_exit();
|
||||||
err_ioctl:
|
err_ioctl:
|
||||||
|
pr_err("KFD is disabled due to module initialization failure\n");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user