[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1419108374-7020-3-git-send-email-oded.gabbay@amd.com>
Date: Sat, 20 Dec 2014 22:46:13 +0200
From: Oded Gabbay <oded.gabbay@....com>
To: <dri-devel@...ts.freedesktop.org>
CC: David Airlie <airlied@...ux.ie>,
Jerome Glisse <j.glisse@...il.com>,
Joerg Roedel <joro@...tes.org>, <linux-kernel@...r.kernel.org>,
"John Bridgman" <John.Bridgman@....com>,
<Alexander.Deucher@....com>
Subject: [PATCH 2/3] amdkfd: Track when amdkfd init is complete
This patch adds a new function to amdkfd, which returns 1 if the amdkfd
initialization function has completed, and 0 otherwise.
This is necessary for the case when amdkfd and radeon are both compiled inside
the kernel image (not as modules). In that case, radeon probes the existing GPU
before amdkfd is even loaded. When radeon encounters an AMD GPU, it will pass
that information to amdkfd. However, if amdkfd is not loaded than that call
will fail and when amdkfd is eventually loaded, it won't know about that GPU.
Even if that call is delayed to a later stage, we will still need to know
whether amdkfd has already been initialized.
Note that when the two modules are compiled as modules, this situation can't
occur as the kernel enforces the order of loading.
Signed-off-by: Oded Gabbay <oded.gabbay@....com>
---
drivers/gpu/drm/amd/amdkfd/kfd_module.c | 9 +++++++++
drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 ++
2 files changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_module.c b/drivers/gpu/drm/amd/amdkfd/kfd_module.c
index 236562f..848ebed 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_module.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_module.c
@@ -60,6 +60,13 @@ module_param(max_num_of_queues_per_process, int, 0444);
MODULE_PARM_DESC(max_num_of_queues_per_process,
"Kernel cmdline parameter that defines the amdkfd maximum number of supported queues per process");
+static int amdkfd_init_completed;
+
+int amdkfd_is_init_completed(void)
+{
+ return amdkfd_init_completed;
+}
+
bool kgd2kfd_init(unsigned interface_version,
const struct kfd2kgd_calls *f2g,
const struct kgd2kfd_calls **g2f)
@@ -128,6 +135,8 @@ static int __init kfd_module_init(void)
dev_info(kfd_device, "Initialized module\n");
+ amdkfd_init_completed = 1;
+
return 0;
err_topology:
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index f9fb81e..01df7e6 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -153,6 +153,8 @@ struct kfd_dev {
bool interrupts_active;
};
+int amdkfd_is_init_completed(void);
+
/* KGD2KFD callbacks */
void kgd2kfd_exit(void);
struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, struct pci_dev *pdev);
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists