diff options
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/5702-drm-amdgpu-Move-KFD-parameters-to-amdgpu-v3.patch')
-rw-r--r-- | common/recipes-kernel/linux/linux-yocto-4.14.71/5702-drm-amdgpu-Move-KFD-parameters-to-amdgpu-v3.patch | 348 |
1 files changed, 348 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/5702-drm-amdgpu-Move-KFD-parameters-to-amdgpu-v3.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/5702-drm-amdgpu-Move-KFD-parameters-to-amdgpu-v3.patch new file mode 100644 index 00000000..fcbc846e --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/5702-drm-amdgpu-Move-KFD-parameters-to-amdgpu-v3.patch @@ -0,0 +1,348 @@ +From 0c1308516ee7898e840e5fdfd60f0ded405b7268 Mon Sep 17 00:00:00 2001 +From: Chaudhary Amit Kumar <chaudharyamit.kumar@amd.com> +Date: Mon, 7 Jan 2019 16:26:05 +0530 +Subject: [PATCH 5702/5725] drm/amdgpu: Move KFD parameters to amdgpu (v3) + +After merging KFD into amdgpu, move module parameters defined in KFD to +amdgpu_drv.c, where other module parameters are declared. + +v2: add kernel-doc comments +v3: rebase and fix parameter variable name (Alex) + +Signed-off-by: Amber Lin <Amber.Lin@amd.com> +Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> +Signed-off-by: Alex Deucher <alexander.deucher@amd.com> +Signed-off-by: Chaudhary Amit Kumar <chaudharyamit.kumar@amd.com> +--- + drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- + drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 26 ++------ + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 97 ++++++++++++++++++++++++++++++ + drivers/gpu/drm/amd/amdkfd/kfd_module.c | 69 --------------------- + drivers/gpu/drm/amd/amdkfd/kfd_process.c | 5 -- + 5 files changed, 104 insertions(+), 96 deletions(-) + mode change 100644 => 100755 drivers/gpu/drm/amd/amdkfd/kfd_module.c + mode change 100644 => 100755 drivers/gpu/drm/amd/amdkfd/kfd_process.c + +diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile +index e351f2d..467125d 100644 +--- a/drivers/gpu/drm/amd/amdgpu/Makefile ++++ b/drivers/gpu/drm/amd/amdgpu/Makefile +@@ -135,7 +135,7 @@ amdgpu-y += \ + vcn_v1_0.o + + # add amdkfd interfaces +-ifneq ($(CONFIG_HSA_AMD),) ++# ifneq ($(CONFIG_HSA_AMD),) + AMDKFD_PATH := ../amdkfd + include $(FULL_AMD_PATH)/amdkfd/Makefile + amdgpu-y += $(AMDKFD_FILES) +@@ -145,7 +145,6 @@ amdgpu-y += \ + amdgpu_amdkfd_gfx_v8.o \ + amdgpu_amdkfd_gfx_v9.o \ + amdgpu_amdkfd_gpuvm.o +-endif + # add cgs + amdgpu-y += amdgpu_cgs.o + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +index 1aff1f6..68f3891 100755 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +@@ -38,29 +38,15 @@ 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) +- ret = kgd2kfd_init(KFD_INTERFACE_VERSION, &kgd2kfd); +- if (ret) +- kgd2kfd = NULL; +- ++#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 +- amdgpu_amdkfd_gpuvm_init_mem_limits(); + return ret; + } + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +index 5f59a07..7753af9 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +@@ -39,6 +39,7 @@ + #include "amdgpu_gem.h" + + #include "amdgpu_amdkfd.h" ++#include "kfd_priv.h" + + /* + * KMS wrapper. +@@ -137,6 +138,17 @@ struct amdgpu_mgpu_info mgpu_info = { + .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex), + }; + ++/* 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 noretry; ++int halt_if_hws_hang; ++ + /** + * DOC: vramlimit (int) + * Restrict the total amount of VRAM in MiB for testing. The default is 0 (Use full VRAM). +@@ -551,6 +563,91 @@ 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); + ++/** ++ * DOC: sched_policy (int) ++ * Set scheduling policy. Default is HWS(hardware scheduling) with over-subscription. ++ * Setting 1 disables over-subscription. Setting 2 disables HWS and statically ++ * assigns queues to HQDs. ++ */ ++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)"); ++ ++/** ++ * DOC: hws_max_conc_proc (int) ++ * Maximum number of processes that HWS can schedule concurrently. The maximum is the ++ * number of VMIDs assigned to the HWS, which is also the default. ++ */ ++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))"); ++ ++/** ++ * DOC: cwsr_enable (int) ++ * CWSR(compute wave store and resume) allows the GPU to preempt shader execution in ++ * the middle of a compute wave. Default is 1 to enable this feature. Setting 0 ++ * disables it. ++ */ ++module_param(cwsr_enable, int, 0444); ++MODULE_PARM_DESC(cwsr_enable, "CWSR enable (0 = Off, 1 = On (Default))"); ++ ++/** ++ * DOC: max_num_of_queues_per_device (int) ++ * Maximum number of queues per device. Valid setting is between 1 and 4096. Default ++ * is 4096. ++ */ ++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)"); ++ ++/** ++ * DOC: send_sigterm (int) ++ * Send sigterm to HSA process on unhandled exceptions. Default is not to send sigterm ++ * but just print errors on dmesg. Setting 1 enables sending sigterm. ++ */ ++module_param(send_sigterm, int, 0444); ++MODULE_PARM_DESC(send_sigterm, ++ "Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)"); ++ ++/** ++ * DOC: debug_largebar (int) ++ * Set debug_largebar as 1 to enable simulating large-bar capability on non-large bar ++ * system. This limits the VRAM size reported to ROCm applications to the visible ++ * size, usually 256MB. ++ * Default value is 0, diabled. ++ */ ++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)"); ++ ++/** ++ * DOC: ignore_crat (int) ++ * Ignore CRAT table during KFD initialization. By default, KFD uses the ACPI CRAT ++ * table to get information about AMD APUs. This option can serve as a workaround on ++ * systems with a broken CRAT table. ++ */ ++module_param(ignore_crat, int, 0444); ++MODULE_PARM_DESC(ignore_crat, ++ "Ignore CRAT table during KFD initialization (0 = use CRAT (default), 1 = ignore CRAT)"); ++ ++/** ++ * DOC: noretry (int) ++ * This parameter sets sh_mem_config.retry_disable. Default value, 0, enables retry. ++ * Setting 1 disables retry. ++ * Retry is needed for recoverable page faults. ++ */ ++module_param(noretry, int, 0644); ++MODULE_PARM_DESC(noretry, ++ "Set sh_mem_config.retry_disable on Vega10 (0 = retry enabled (default), 1 = retry disabled)"); ++ ++/** ++ * DOC: halt_if_hws_hang (int) ++ * Halt if HWS hang is detected. Default value, 0, disables the halt on hang. ++ * Setting 1 enables halt on hang. ++ */ ++module_param(halt_if_hws_hang, int, 0644); ++MODULE_PARM_DESC(halt_if_hws_hang, "Halt if HWS hang is detected (0 = off (default), 1 = on)"); ++ + static const struct pci_device_id pciidlist[] = { + #ifdef CONFIG_DRM_AMDGPU_SI + {0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI}, +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_module.c b/drivers/gpu/drm/amd/amdkfd/kfd_module.c +old mode 100644 +new mode 100755 +index 8675222..43cecf2 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_module.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_module.c +@@ -21,16 +21,9 @@ + */ + + #include <linux/sched.h> +-#include <linux/moduleparam.h> + #include <linux/device.h> + #include "kfd_priv.h" + +-#define KFD_DRIVER_DESC "Standalone HSA driver for AMD's GPUs" +-#define KFD_DRIVER_DATE "20160408" +-#define KFD_DRIVER_MAJOR 2 +-#define KFD_DRIVER_MINOR 0 +-#define KFD_DRIVER_PATCHLEVEL 0 +- + static const struct kgd2kfd_calls kgd2kfd = { + .exit = kgd2kfd_exit, + .probe = kgd2kfd_probe, +@@ -47,54 +40,6 @@ static const struct kgd2kfd_calls kgd2kfd = { + .post_reset = kgd2kfd_post_reset, + }; + +-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 noretry = 1; +-module_param(noretry, int, 0644); +-MODULE_PARM_DESC(noretry, +- "Set sh_mem_config.retry_disable on GFXv9+ dGPUs (0 = retry enabled, 1 = retry disabled (default))"); +- +-int priv_cp_queues; +-module_param(priv_cp_queues, int, 0644); +-MODULE_PARM_DESC(priv_cp_queues, +- "Enable privileged mode for CP queues (0 = off (default), 1 = on)"); +- +-int halt_if_hws_hang; +-module_param(halt_if_hws_hang, int, 0644); +-MODULE_PARM_DESC(halt_if_hws_hang, "Halt if HWS hang is detected (0 = off (default), 1 = on)"); +- + static int kfd_init(void) + { + int err; +@@ -122,22 +67,15 @@ static int kfd_init(void) + if (err < 0) + goto err_topology; + +- err = kfd_ipc_init(); +- if (err < 0) +- goto err_ipc; +- + err = kfd_process_create_wq(); + if (err < 0) + goto err_create_wq; + +- kfd_init_peer_direct(); +- + kfd_debugfs_init(); + + return 0; + + err_create_wq: +-err_ipc: + kfd_topology_shutdown(); + err_topology: + kfd_chardev_exit(); +@@ -148,7 +86,6 @@ static int kfd_init(void) + static void kfd_exit(void) + { + kfd_debugfs_fini(); +- kfd_close_peer_direct(); + kfd_process_destroy_wq(); + kfd_topology_shutdown(); + kfd_chardev_exit(); +@@ -172,9 +109,3 @@ void kgd2kfd_exit(void) + { + kfd_exit(); + } +-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)); +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c +old mode 100644 +new mode 100755 +index e79479b..73a1adc +--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c +@@ -600,11 +600,6 @@ static struct kfd_process *create_process(const struct task_struct *thread, + if (err) + goto err_init_cwsr; + +- /* If PeerDirect interface was not detected try to detect it again +- * in case if network driver was loaded later. +- */ +- kfd_init_peer_direct(); +- + return process; + + err_init_cwsr: +-- +2.7.4 + |