lkml.org 
[lkml]   [2014]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] amdkfd: Track when amdkfd init is complete
Date
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@amd.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


\
 
 \ /
  Last update: 2014-12-20 22:21    [W:0.078 / U:1.632 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site