source "drivers/gpu/drm/sti/Kconfig"
-source "drivers/gpu/drm/amd/amdkfd/Kconfig"
-
source "drivers/gpu/drm/imx/Kconfig"
source "drivers/gpu/drm/v3d/Kconfig"
source "drivers/gpu/drm/amd/acp/Kconfig"
source "drivers/gpu/drm/amd/display/Kconfig"
+source "drivers/gpu/drm/amd/amdkfd/Kconfig"
-I$(FULL_AMD_DISPLAY_PATH) \
-I$(FULL_AMD_DISPLAY_PATH)/include \
-I$(FULL_AMD_DISPLAY_PATH)/dc \
- -I$(FULL_AMD_DISPLAY_PATH)/amdgpu_dm
+ -I$(FULL_AMD_DISPLAY_PATH)/amdgpu_dm \
+ -I$(FULL_AMD_PATH)/amdkfd
amdgpu-y := amdgpu_drv.o
amdgpu-y += amdgpu_amdkfd.o
ifneq ($(CONFIG_HSA_AMD),)
+AMDKFD_PATH := ../amdkfd
+include $(FULL_AMD_PATH)/amdkfd/Makefile
+amdgpu-y += $(AMDKFD_FILES)
amdgpu-y += \
amdgpu_amdkfd_fence.o \
amdgpu_amdkfd_gpuvm.o \
#
config HSA_AMD
- tristate "HSA kernel driver for AMD GPU devices"
+ bool "HSA kernel driver for AMD GPU devices"
depends on DRM_AMDGPU && X86_64
imply AMD_IOMMU_V2
select MMU_NOTIFIER
# Makefile for Heterogenous System Architecture support for AMD GPU devices
#
-ccflags-y := -Idrivers/gpu/drm/amd/include/ \
- -Idrivers/gpu/drm/amd/include/asic_reg
-
-amdkfd-y := kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o \
- kfd_pasid.o kfd_doorbell.o kfd_flat_memory.o \
- kfd_process.o kfd_queue.o kfd_mqd_manager.o \
- kfd_mqd_manager_cik.o kfd_mqd_manager_vi.o \
- kfd_mqd_manager_v9.o \
- kfd_kernel_queue.o kfd_kernel_queue_cik.o \
- kfd_kernel_queue_vi.o kfd_kernel_queue_v9.o \
- kfd_packet_manager.o kfd_process_queue_manager.o \
- kfd_device_queue_manager.o kfd_device_queue_manager_cik.o \
- kfd_device_queue_manager_vi.o kfd_device_queue_manager_v9.o \
- kfd_interrupt.o kfd_events.o cik_event_interrupt.o \
- kfd_int_process_v9.o kfd_dbgdev.o kfd_dbgmgr.o kfd_crat.o
+AMDKFD_FILES := $(AMDKFD_PATH)/kfd_module.o \
+ $(AMDKFD_PATH)/kfd_device.o \
+ $(AMDKFD_PATH)/kfd_chardev.o \
+ $(AMDKFD_PATH)/kfd_topology.o \
+ $(AMDKFD_PATH)/kfd_pasid.o \
+ $(AMDKFD_PATH)/kfd_doorbell.o \
+ $(AMDKFD_PATH)/kfd_flat_memory.o \
+ $(AMDKFD_PATH)/kfd_process.o \
+ $(AMDKFD_PATH)/kfd_queue.o \
+ $(AMDKFD_PATH)/kfd_mqd_manager.o \
+ $(AMDKFD_PATH)/kfd_mqd_manager_cik.o \
+ $(AMDKFD_PATH)/kfd_mqd_manager_vi.o \
+ $(AMDKFD_PATH)/kfd_mqd_manager_v9.o \
+ $(AMDKFD_PATH)/kfd_kernel_queue.o \
+ $(AMDKFD_PATH)/kfd_kernel_queue_cik.o \
+ $(AMDKFD_PATH)/kfd_kernel_queue_vi.o \
+ $(AMDKFD_PATH)/kfd_kernel_queue_v9.o \
+ $(AMDKFD_PATH)/kfd_packet_manager.o \
+ $(AMDKFD_PATH)/kfd_process_queue_manager.o \
+ $(AMDKFD_PATH)/kfd_device_queue_manager.o \
+ $(AMDKFD_PATH)/kfd_device_queue_manager_cik.o \
+ $(AMDKFD_PATH)/kfd_device_queue_manager_vi.o \
+ $(AMDKFD_PATH)/kfd_device_queue_manager_v9.o \
+ $(AMDKFD_PATH)/kfd_interrupt.o \
+ $(AMDKFD_PATH)/kfd_events.o \
+ $(AMDKFD_PATH)/cik_event_interrupt.o \
+ $(AMDKFD_PATH)/kfd_int_process_v9.o \
+ $(AMDKFD_PATH)/kfd_dbgdev.o \
+ $(AMDKFD_PATH)/kfd_dbgmgr.o \
+ $(AMDKFD_PATH)/kfd_crat.o
ifneq ($(CONFIG_AMD_IOMMU_V2),)
-amdkfd-y += kfd_iommu.o
+AMDKFD_FILES += $(AMDKFD_PATH)/kfd_iommu.o
endif
-amdkfd-$(CONFIG_DEBUG_FS) += kfd_debugfs.o
-
-obj-$(CONFIG_HSA_AMD) += amdkfd.o
+ifneq ($(CONFIG_DEBUG_FS),)
+AMDKFD_FILES += $(AMDKFD_PATH)/kfd_debugfs.o
+endif
* OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <linux/module.h>
#include <linux/sched.h>
#include <linux/moduleparam.h>
#include <linux/device.h>
-#include <linux/printk.h>
#include "kfd_priv.h"
-#define KFD_DRIVER_AUTHOR "AMD Inc. and others"
-
-#define KFD_DRIVER_DESC "Standalone HSA driver for AMD's GPUs"
-#define KFD_DRIVER_DATE "20150421"
-#define KFD_DRIVER_MAJOR 0
-#define KFD_DRIVER_MINOR 7
-#define KFD_DRIVER_PATCHLEVEL 2
-
static const struct kgd2kfd_calls kgd2kfd = {
.exit = kgd2kfd_exit,
.probe = kgd2kfd_probe,
MODULE_PARM_DESC(halt_if_hws_hang, "Halt if HWS hang is detected (0 = off (default), 1 = on)");
-static int amdkfd_init_completed;
-
-
-int kgd2kfd_init(unsigned int interface_version,
- const struct kgd2kfd_calls **g2f)
-{
- if (!amdkfd_init_completed)
- return -EPROBE_DEFER;
-
- /*
- * Only one interface version is supported,
- * no kfd/kgd version skew allowed.
- */
- if (interface_version != KFD_INTERFACE_VERSION)
- return -EINVAL;
-
- *g2f = &kgd2kfd;
-
- return 0;
-}
-EXPORT_SYMBOL(kgd2kfd_init);
-
-void kgd2kfd_exit(void)
-{
-}
-
-static int __init kfd_module_init(void)
+static int kfd_init(void)
{
int err;
if ((sched_policy < KFD_SCHED_POLICY_HWS) ||
(sched_policy > KFD_SCHED_POLICY_NO_HWS)) {
pr_err("sched_policy has invalid value\n");
- return -1;
+ return -EINVAL;
}
/* Verify module parameters */
(max_num_of_queues_per_device >
KFD_MAX_NUM_OF_QUEUES_PER_DEVICE)) {
pr_err("max_num_of_queues_per_device must be between 1 to KFD_MAX_NUM_OF_QUEUES_PER_DEVICE\n");
- return -1;
+ return -EINVAL;
}
err = kfd_chardev_init();
kfd_debugfs_init();
- amdkfd_init_completed = 1;
-
- dev_info(kfd_device, "Initialized module\n");
-
return 0;
err_create_wq:
return err;
}
-static void __exit kfd_module_exit(void)
+static void kfd_exit(void)
{
- amdkfd_init_completed = 0;
-
kfd_debugfs_fini();
kfd_process_destroy_wq();
kfd_topology_shutdown();
kfd_chardev_exit();
- pr_info("amdkfd: Removed module\n");
}
-module_init(kfd_module_init);
-module_exit(kfd_module_exit);
+int kgd2kfd_init(unsigned int interface_version,
+ const struct kgd2kfd_calls **g2f)
+{
+ int err;
+
+ err = kfd_init();
+ if (err)
+ return err;
-MODULE_AUTHOR(KFD_DRIVER_AUTHOR);
-MODULE_DESCRIPTION(KFD_DRIVER_DESC);
-MODULE_LICENSE("GPL and additional rights");
-MODULE_VERSION(__stringify(KFD_DRIVER_MAJOR) "."
- __stringify(KFD_DRIVER_MINOR) "."
- __stringify(KFD_DRIVER_PATCHLEVEL));
+ *g2f = &kgd2kfd;
+
+ return 0;
+}
+EXPORT_SYMBOL(kgd2kfd_init);
+
+void kgd2kfd_exit(void)
+{
+ kfd_exit();
+}