drm/amdgpu: Merge amdkfd into amdgpu
Subsystems (3)
PATCH 1/3 drm/amdgpu: Merge amdkfd into amdgpu
Since KFD is only supported by single GPU driver, it makes sense to merge amdgpu and amdkfd into one module. This patch is the initial step: merge Kconfig and Makefile.
--- drivers/gpu/drm/amd/amdgpu/Kconfig | 1 + drivers/gpu/drm/amd/amdgpu/Makefile | 6 ++- drivers/gpu/drm/amd/amdkfd/Kconfig | 2 +- drivers/gpu/drm/amd/amdkfd/Makefile | 53 ++++++++++++++--------- drivers/gpu/drm/amd/amdkfd/kfd_module.c | 76 ++++++++++----------------------- 5 files changed, 63 insertions(+), 75 deletions(-)
drivers/gpu/drm/amd/amdgpu/Kconfig +1 -0
@@ -42,3 +42,4 @@ config DRM_AMDGPU_GART_DEBUGFS source "drivers/gpu/drm/amd/acp/Kconfig" source "drivers/gpu/drm/amd/display/Kconfig" +source "drivers/gpu/drm/amd/amdkfd/Kconfig"
drivers/gpu/drm/amd/amdgpu/Makefile +5 -1
@@ -35,7 +35,8 @@ ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \ -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
@@ -136,6 +137,9 @@ amdgpu-y += \ 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 \
drivers/gpu/drm/amd/amdkfd/Kconfig +1 -1
@@ -3,7 +3,7 @@ # 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
drivers/gpu/drm/amd/amdkfd/Makefile +34 -19
60 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_module.c +22 -54
122 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/3 drm/amdgpu: Remove CONFIG_HSA_AMD_MODULE
In reply to a message not in the archiveAfter amdkfd is merged to amdgpu, CONFIG_HSA_AMD_MODULE no longer exists.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +3 -23
@@ -36,36 +36,16 @@ int amdgpu_amdkfd_init(void) {int ret; -#if defined(CONFIG_HSA_AMD_MODULE ) -int (*kgd2kfd_init_p)(unsigned int ,const struct kgd2kfd_calls **); - - kgd2kfd_init_p =symbol_request (kgd2kfd_init); - -if (kgd2kfd_init_p ==NULL ) -return -ENOENT ; - - ret =kgd2kfd_init_p (KFD_INTERFACE_VERSION , &kgd2kfd); -if (ret) { -symbol_put (kgd2kfd_init); - kgd2kfd =NULL ; - } - - -#elif defined(CONFIG_HSA_AMD ) - +#ifdef CONFIG_HSA_AMD ret =kgd2kfd_init (KFD_INTERFACE_VERSION , &kgd2kfd);if (ret) kgd2kfd =NULL ; - +amdgpu_amdkfd_gpuvm_init_mem_limits ();#else kgd2kfd =NULL ; ret = -ENOENT ;#endif -#if defined(CONFIG_HSA_AMD_MODULE ) || defined(CONFIG_HSA_AMD ) -amdgpu_amdkfd_gpuvm_init_mem_limits (); -#endif -return ret; }
@@ -471,7 +451,7 @@ bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)return false; } -#if !defined(CONFIG_HSA_AMD_MODULE ) && !defined(CONFIG_HSA_AMD ) +#ifndef CONFIG_HSA_AMD bool amdkfd_fence_check_mm (struct dma_fence *f,struct mm_struct *mm) {return false;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amdgpu: Move KFD parameters to amdgpu
In reply to a message not in the archiveAfter merging KFD into amdgpu, move module parameters defined in KFD to amdgpu_drv.c, where other module parameters are declared.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 41 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdkfd/kfd_module.c | 40 -------------------------------- 2 files changed, 41 insertions(+), 40 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +41 -0
@@ -39,6 +39,7 @@#include "amdgpu_gem.h" #include "amdgpu_amdkfd.h" +#include "kfd_priv.h" /* * KMS wrapper.
@@ -127,6 +128,15 @@ int amdgpu_compute_multipipe = -1;int amdgpu_gpu_recovery =-1 ;/* auto */ int amdgpu_emu_mode =0 ;uint amdgpu_smu_memory_pool_size =0 ; +/* KFD parameters */ +int sched_policy =KFD_SCHED_POLICY_HWS ; +int hws_max_conc_proc =8 ; +int cwsr_enable =1 ; +int max_num_of_queues_per_device =KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT ; +int send_sigterm; +int debug_largebar; +int ignore_crat; +int vega10_noretry;/** * DOC: vramlimit (int)
@@ -532,6 +542,37 @@ MODULE_PARM_DESC(smu_memory_pool_size, "0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");module_param_named (smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint,0444 ); +module_param (sched_policy, int,0444 ); +MODULE_PARM_DESC (sched_policy, +"Scheduling policy (0 = HWS (Default), 1 = HWS without over-subscription, 2 = Non-HWS (Used for debugging only)" ); + +module_param (hws_max_conc_proc, int,0444 ); +MODULE_PARM_DESC (hws_max_conc_proc, +"Max # processes HWS can execute concurrently when sched_policy=0 (0 = no concurrency, #VMIDs for KFD = Maximum(default))" ); + +module_param (cwsr_enable, int,0444 ); +MODULE_PARM_DESC (cwsr_enable,"CWSR enable (0 = Off, 1 = On (Default))" ); + +module_param (max_num_of_queues_per_device, int,0444 ); +MODULE_PARM_DESC (max_num_of_queues_per_device, +"Maximum number of supported queues per device (1 = Minimum, 4096 = default)" ); + +module_param (send_sigterm, int,0444 ); +MODULE_PARM_DESC (send_sigterm, +"Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)" ); + +module_param (debug_largebar, int,0444 ); +MODULE_PARM_DESC (debug_largebar, +"Debug large-bar flag used to simulate large-bar capability on non-large bar machine (0 = disable, 1 = enable)" ); + +module_param (ignore_crat, int,0444 ); +MODULE_PARM_DESC (ignore_crat, +"Ignore CRAT table during KFD initialization (0 = use CRAT (default), 1 = ignore CRAT)" ); + +module_param_named (noretry, vega10_noretry, int,0644 ); +MODULE_PARM_DESC (noretry, +"Set sh_mem_config.retry_disable on Vega10 (0 = retry enabled (default), 1 = retry disabled)" ); +static const struct pci_device_id pciidlist[] = { #ifdef CONFIG_DRM_AMDGPU_SI {0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},
drivers/gpu/drm/amd/amdkfd/kfd_module.c +0 -40
@@ -21,7 +21,6 @@*/ #include <linux/sched.h> -#include <linux/moduleparam.h> #include <linux/device.h> #include "kfd_priv.h"
@@ -39,45 +38,6 @@ static const struct kgd2kfd_calls kgd2kfd = { kgd2kfd_schedule_evict_and_restore_process, }; -int sched_policy =KFD_SCHED_POLICY_HWS ; -module_param (sched_policy, int,0444 ); -MODULE_PARM_DESC (sched_policy, -"Scheduling policy (0 = HWS (Default), 1 = HWS without over-subscription, 2 = Non-HWS (Used for debugging only)" ); - -int hws_max_conc_proc =8 ; -module_param (hws_max_conc_proc, int,0444 ); -MODULE_PARM_DESC (hws_max_conc_proc, -"Max # processes HWS can execute concurrently when sched_policy=0 (0 = no concurrency, #VMIDs for KFD = Maximum(default))" ); - -int cwsr_enable =1 ; -module_param (cwsr_enable, int,0444 ); -MODULE_PARM_DESC (cwsr_enable,"CWSR enable (0 = Off, 1 = On (Default))" ); - -int max_num_of_queues_per_device =KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT ; -module_param (max_num_of_queues_per_device, int,0444 ); -MODULE_PARM_DESC (max_num_of_queues_per_device, -"Maximum number of supported queues per device (1 = Minimum, 4096 = default)" ); - -int send_sigterm; -module_param (send_sigterm, int,0444 ); -MODULE_PARM_DESC (send_sigterm, -"Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)" ); - -int debug_largebar; -module_param (debug_largebar, int,0444 ); -MODULE_PARM_DESC (debug_largebar, -"Debug large-bar flag used to simulate large-bar capability on non-large bar machine (0 = disable, 1 = enable)" ); - -int ignore_crat; -module_param (ignore_crat, int,0444 ); -MODULE_PARM_DESC (ignore_crat, -"Ignore CRAT table during KFD initialization (0 = use CRAT (default), 1 = ignore CRAT)" ); - -int vega10_noretry; -module_param_named (noretry, vega10_noretry, int,0644 ); -MODULE_PARM_DESC (noretry, -"Set sh_mem_config.retry_disable on Vega10 (0 = retry enabled (default), 1 = retry disabled)" ); -static int kfd_init (void ) {int err;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 3/3] drm/amdgpu: Move KFD parameters to amdgpu
In reply to a message not in the archiveQuoted 40 lines · Amber Lin
After merging KFD into amdgpu, move module parameters defined in KFD to
amdgpu_drv.c, where other module parameters are declared.Change-Id I2de8d6c96bb49554c028bbc84bdb194f974c9278Signed-off-by Amber Lin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 41 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdkfd/kfd_module.c | 40 -------------------------------- 2 files changed, 41 insertions(+), 40 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +10
-0@@ -39,6 +39,7 @@#include "amdgpu_gem.h" #include "amdgpu_amdkfd.h" +#include "kfd_priv.h" /* * KMS wrapper. @@ -127,6 +128,15 @@ int amdgpu_compute_multipipe = -1;int amdgpu_gpu_recovery =-1 ;/* auto */ int amdgpu_emu_mode =0 ;uint amdgpu_smu_memory_pool_size =0 ; +/* KFD parameters */ +int sched_policy =KFD_SCHED_POLICY_HWS ; +int hws_max_conc_proc =8 ; +int cwsr_enable =1 ; +int max_num_of_queues_per_device =KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT ; +int send_sigterm; +int debug_largebar; +int ignore_crat; +int vega10_noretry;/** * DOC: vramlimit (int)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c MODULE_PARM_DESC(smu_memory_pool_size, · line 544
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -532,6 +542,37 @@ MODULE_PARM_DESC(smu_memory_pool_size, "0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");module_param_named (smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint,0444 );
Please add DOC comments for all of these options like the other amdgpu options.
Alex
Quoted 95 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +31
-0+module_param (sched_policy, int,0444 ); +MODULE_PARM_DESC (sched_policy, +"Scheduling policy (0 = HWS (Default), 1 = HWS without over-subscription, 2 = Non-HWS (Used for debugging only)" ); + +module_param (hws_max_conc_proc, int,0444 ); +MODULE_PARM_DESC (hws_max_conc_proc, +"Max # processes HWS can execute concurrently when sched_policy=0 (0 = no concurrency, #VMIDs for KFD = Maximum(default))" ); + +module_param (cwsr_enable, int,0444 ); +MODULE_PARM_DESC (cwsr_enable,"CWSR enable (0 = Off, 1 = On (Default))" ); + +module_param (max_num_of_queues_per_device, int,0444 ); +MODULE_PARM_DESC (max_num_of_queues_per_device, +"Maximum number of supported queues per device (1 = Minimum, 4096 = default)" ); + +module_param (send_sigterm, int,0444 ); +MODULE_PARM_DESC (send_sigterm, +"Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)" ); + +module_param (debug_largebar, int,0444 ); +MODULE_PARM_DESC (debug_largebar, +"Debug large-bar flag used to simulate large-bar capability on non-large bar machine (0 = disable, 1 = enable)" ); + +module_param (ignore_crat, int,0444 ); +MODULE_PARM_DESC (ignore_crat, +"Ignore CRAT table during KFD initialization (0 = use CRAT (default), 1 = ignore CRAT)" ); + +module_param_named (noretry, vega10_noretry, int,0644 ); +MODULE_PARM_DESC (noretry, +"Set sh_mem_config.retry_disable on Vega10 (0 = retry enabled (default), 1 = retry disabled)" ); +static const struct pci_device_id pciidlist[] = { #ifdef CONFIG_DRM_AMDGPU_SI {0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI},drivers/gpu/drm/amd/amdkfd/kfd_module.c +0
-41@@ -21,7 +21,6 @@*/ #include <linux/sched.h> -#include <linux/moduleparam.h> #include <linux/device.h> #include "kfd_priv.h" @@ -39,45 +38,6 @@ static const struct kgd2kfd_calls kgd2kfd = { kgd2kfd_schedule_evict_and_restore_process, }; -int sched_policy =KFD_SCHED_POLICY_HWS ; -module_param (sched_policy, int,0444 ); -MODULE_PARM_DESC (sched_policy, -"Scheduling policy (0 = HWS (Default), 1 = HWS without over-subscription, 2 = Non-HWS (Used for debugging only)" ); - -int hws_max_conc_proc =8 ; -module_param (hws_max_conc_proc, int,0444 ); -MODULE_PARM_DESC (hws_max_conc_proc, -"Max # processes HWS can execute concurrently when sched_policy=0 (0 = no concurrency, #VMIDs for KFD = Maximum(default))" ); - -int cwsr_enable =1 ; -module_param (cwsr_enable, int,0444 ); -MODULE_PARM_DESC (cwsr_enable,"CWSR enable (0 = Off, 1 = On (Default))" ); - -int max_num_of_queues_per_device =KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT ; -module_param (max_num_of_queues_per_device, int,0444 ); -MODULE_PARM_DESC (max_num_of_queues_per_device, -"Maximum number of supported queues per device (1 = Minimum, 4096 = default)" ); - -int send_sigterm; -module_param (send_sigterm, int,0444 ); -MODULE_PARM_DESC (send_sigterm, -"Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)" ); - -int debug_largebar; -module_param (debug_largebar, int,0444 ); -MODULE_PARM_DESC (debug_largebar, -"Debug large-bar flag used to simulate large-bar capability on non-large bar machine (0 = disable, 1 = enable)" ); - -int ignore_crat; -module_param (ignore_crat, int,0444 ); -MODULE_PARM_DESC (ignore_crat, -"Ignore CRAT table during KFD initialization (0 = use CRAT (default), 1 = ignore CRAT)" ); - -int vega10_noretry; -module_param_named (noretry, vega10_noretry, int,0644 ); -MODULE_PARM_DESC (noretry, -"Set sh_mem_config.retry_disable on Vega10 (0 = retry enabled (default), 1 = retry disabled)" ); -static int kfd_init (void ) {int err; --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Felix Kuehling
Reviewed-byI believe you also need to edit drivers/gpu/drm/Kconfig. Otherwise amdkfd/Kconfig will be included twice. With that fixed, this commit is
But let's give amdgpu reviewers some more time to respond.
Thanks,
Felix
Quoted 247 lines · Amber Lin
Since KFD is only supported by single GPU driver, it makes sense to merge amdgpu and amdkfd into one module. This patch is the initial step: merge
KconfigandMakefile.Change-Id I21c996ba29d393c1bf8064bdb2f5d89541159649Signed-off-by Amber Lin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/Kconfig | 1 + drivers/gpu/drm/amd/amdgpu/Makefile | 6 ++- drivers/gpu/drm/amd/amdkfd/Kconfig | 2 +- drivers/gpu/drm/amd/amdkfd/Makefile | 53 ++++++++++++++--------- drivers/gpu/drm/amd/amdkfd/kfd_module.c | 76 ++++++++++----------------------- 5 files changed, 63 insertions(+), 75 deletions(-)drivers/gpu/drm/amd/amdgpu/Kconfig +1
-0@@ -42,3 +42,4 @@ config DRM_AMDGPU_GART_DEBUGFS source "drivers/gpu/drm/amd/acp/Kconfig" source "drivers/gpu/drm/amd/display/Kconfig" +source "drivers/gpu/drm/amd/amdkfd/Kconfig"drivers/gpu/drm/amd/amdgpu/Makefile +5
-1@@ -35,7 +35,8 @@ ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \ -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@@ -136,6 +137,9 @@ amdgpu-y += \ 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 \drivers/gpu/drm/amd/amdkfd/Kconfig +1
-1@@ -3,7 +3,7 @@ # 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_NOTIFIERdrivers/gpu/drm/amd/amdkfd/Makefile +34
-19@@ -23,26 +23,41 @@ # 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 +endifdrivers/gpu/drm/amd/amdkfd/kfd_module.c +12
-54@@ -20,21 +20,11 @@* 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,@@ -88,32 +78,7 @@ module_param_named(noretry, vega10_noretry, int, 0644);MODULE_PARM_DESC (noretry,"Set sh_mem_config.retry_disable on Vega10 (0 = retry enabled (default), 1 = retry disabled)" ); -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;@@ -121,7 +86,7 @@ static int __init kfd_module_init(void)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 */ @@ -129,7 +94,7 @@ static int __init kfd_module_init(void) (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 ();@@ -146,10 +111,6 @@ static int __init kfd_module_init(void)kfd_debugfs_init (); - amdkfd_init_completed =1 ; - -dev_info (kfd_device,"Initialized module\n" ); -return 0 ; err_create_wq:@@ -160,23 +121,30 @@ static int __init kfd_module_init(void)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));
drivers/gpu/drm/amd/amdkfd/kfd_module.c static int __init kfd_module_init(void) · line 150
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_module.c +10
-0+ *g2f = &kgd2kfd; + +return 0 ; +} +EXPORT_SYMBOL (kgd2kfd_init); + +void kgd2kfd_exit (void ) +{ +kfd_exit (); +}
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Felix Kuehling
Reviewed-byRe: [PATCH 2/3] drm/amdgpu: Remove CONFIG_HSA_AMD_MODULE
In reply to a message not in the archiveQuoted 4 lines · Amber Lin
After amdkfd is merged to amdgpu,
CONFIG_HSA_AMD_MODULEno longer exists.Change-Id I42096cdf887e0d776075f3dd3e8d3f153aff4e85Signed-off-by Amber Lin <[email protected]>
Quoted 48 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2
-22@@ -36,36 +36,16 @@ int amdgpu_amdkfd_init(void) {int ret; -#if defined(CONFIG_HSA_AMD_MODULE ) -int (*kgd2kfd_init_p)(unsigned int ,const struct kgd2kfd_calls **); - - kgd2kfd_init_p =symbol_request (kgd2kfd_init); - -if (kgd2kfd_init_p ==NULL ) -return -ENOENT ; - - ret =kgd2kfd_init_p (KFD_INTERFACE_VERSION , &kgd2kfd); -if (ret) { -symbol_put (kgd2kfd_init); - kgd2kfd =NULL ; - } - - -#elif defined(CONFIG_HSA_AMD ) - +#ifdef CONFIG_HSA_AMD ret =kgd2kfd_init (KFD_INTERFACE_VERSION , &kgd2kfd);if (ret) kgd2kfd =NULL ; - +amdgpu_amdkfd_gpuvm_init_mem_limits ();#else kgd2kfd =NULL ; ret = -ENOENT ;#endif -#if defined(CONFIG_HSA_AMD_MODULE ) || defined(CONFIG_HSA_AMD ) -amdgpu_amdkfd_gpuvm_init_mem_limits (); -#endif -return ret; }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid) · line 457
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1
-1@@ -471,7 +451,7 @@ bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)return false; } -#if !defined(CONFIG_HSA_AMD_MODULE ) && !defined(CONFIG_HSA_AMD ) +#ifndef CONFIG_HSA_AMD bool amdkfd_fence_check_mm (struct dma_fence *f,struct mm_struct *mm) {return false;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Looks like a step into the right direction to me.
With Felix comment addressed patch #1 and #2 are Acked-by: Christian König <[email protected]>.
For patch #3 I agree with Alex that we need more kerneldoc, when that is done we can probably add rb to that as well.
Regards,
Christian.
Am 24.08.2018 um 00:21 schrieb Felix Kuehling:
Quoted 264 lines
I believe you also need to edit
drivers/gpu/drm/Kconfig. Otherwise amdkfd/Kconfig will be included twice. With that fixed, this commit isReviewed-by Felix Kuehling <[email protected]>But let's give amdgpu reviewers some more time to respond.
Thanks,
FelixQuoted 253 lines · Amber Lin
Since KFD is only supported by single GPU driver, it makes sense to merge amdgpu and amdkfd into one module. This patch is the initial step: merge
KconfigandMakefile.Change-Id I21c996ba29d393c1bf8064bdb2f5d89541159649Signed-off-by Amber Lin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/Kconfig | 1 + drivers/gpu/drm/amd/amdgpu/Makefile | 6 ++- drivers/gpu/drm/amd/amdkfd/Kconfig | 2 +- drivers/gpu/drm/amd/amdkfd/Makefile | 53 ++++++++++++++--------- drivers/gpu/drm/amd/amdkfd/kfd_module.c | 76 ++++++++++----------------------- 5 files changed, 63 insertions(+), 75 deletions(-)drivers/gpu/drm/amd/amdgpu/Kconfig +1
-0@@ -42,3 +42,4 @@ config DRM_AMDGPU_GART_DEBUGFS source "drivers/gpu/drm/amd/acp/Kconfig" source "drivers/gpu/drm/amd/display/Kconfig" +source "drivers/gpu/drm/amd/amdkfd/Kconfig"drivers/gpu/drm/amd/amdgpu/Makefile +5
-1@@ -35,7 +35,8 @@ ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \ -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@@ -136,6 +137,9 @@ amdgpu-y += \ 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 \drivers/gpu/drm/amd/amdkfd/Kconfig +1
-1@@ -3,7 +3,7 @@ # 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_NOTIFIERdrivers/gpu/drm/amd/amdkfd/Makefile +34
-19@@ -23,26 +23,41 @@ # 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 +endifdrivers/gpu/drm/amd/amdkfd/kfd_module.c +18
-54@@ -20,21 +20,11 @@* 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,@@ -88,32 +78,7 @@ module_param_named(noretry, vega10_noretry, int, 0644);MODULE_PARM_DESC (noretry,"Set sh_mem_config.retry_disable on Vega10 (0 = retry enabled (default), 1 = retry disabled)" ); -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;@@ -121,7 +86,7 @@ static int __init kfd_module_init(void)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 */ @@ -129,7 +94,7 @@ static int __init kfd_module_init(void) (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 ();@@ -146,10 +111,6 @@ static int __init kfd_module_init(void)kfd_debugfs_init (); - amdkfd_init_completed =1 ; - -dev_info (kfd_device,"Initialized module\n" ); -return 0 ; err_create_wq:@@ -160,23 +121,30 @@ static int __init kfd_module_init(void)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); +
Quoted 8 lines
drivers/gpu/drm/amd/amdkfd/kfd_module.c static int __init kfd_module_init(void) · line 150
Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_module.c +4
-0+void kgd2kfd_exit (void ) +{ +kfd_exit (); +}_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx