aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/4286-drm-amdkfd-Fix-error-handling-in-pm_init.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/4286-drm-amdkfd-Fix-error-handling-in-pm_init.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/4286-drm-amdkfd-Fix-error-handling-in-pm_init.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/4286-drm-amdkfd-Fix-error-handling-in-pm_init.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/4286-drm-amdkfd-Fix-error-handling-in-pm_init.patch
new file mode 100644
index 00000000..448a1270
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/4286-drm-amdkfd-Fix-error-handling-in-pm_init.patch
@@ -0,0 +1,61 @@
+From 9a915f78444eaa270bc86d024a02285f491c633f Mon Sep 17 00:00:00 2001
+From: Felix Kuehling <Felix.Kuehling@amd.com>
+Date: Wed, 25 Apr 2018 17:50:18 -0400
+Subject: [PATCH 4286/5725] drm/amdkfd: Fix error handling in pm_init
+
+Avoid BUG_ON. To avoid the need for cleaning up the kernel queue in
+case of an error, do the pm->pmf initialization first.
+
+Change-Id: I8260eacbff5101205aeab26d28a6f106eff5b00b
+Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c | 24 +++++++++++++-----------
+ 1 file changed, 13 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
+index bc6e854..c6f3218 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
+@@ -219,16 +219,7 @@ static int pm_create_runlist_ib(struct packet_manager *pm,
+
+ int pm_init(struct packet_manager *pm, struct device_queue_manager *dqm)
+ {
+- pm->dqm = dqm;
+- mutex_init(&pm->lock);
+- pm->priv_queue = kernel_queue_init(dqm->dev, KFD_QUEUE_TYPE_HIQ);
+- if (!pm->priv_queue) {
+- mutex_destroy(&pm->lock);
+- return -ENOMEM;
+- }
+- pm->allocated = false;
+-
+- switch (pm->dqm->dev->device_info->asic_family) {
++ switch (dqm->dev->device_info->asic_family) {
+ case CHIP_KAVERI:
+ case CHIP_HAWAII:
+ /* PM4 packet structures on CIK are the same as on VI */
+@@ -244,9 +235,20 @@ int pm_init(struct packet_manager *pm, struct device_queue_manager *dqm)
+ pm->pmf = &kfd_v9_pm_funcs;
+ break;
+ default:
+- BUG();
++ WARN(1, "Unexpected ASIC family %u",
++ dqm->dev->device_info->asic_family);
++ return -EINVAL;
+ }
+
++ pm->dqm = dqm;
++ mutex_init(&pm->lock);
++ pm->priv_queue = kernel_queue_init(dqm->dev, KFD_QUEUE_TYPE_HIQ);
++ if (!pm->priv_queue) {
++ mutex_destroy(&pm->lock);
++ return -ENOMEM;
++ }
++ pm->allocated = false;
++
+ return 0;
+ }
+
+--
+2.7.4
+