Commit 2690262e authored by Amber Lin's avatar Amber Lin Committed by Alex Deucher

drm/amdgpu: Relocate some definitions v2

Move some KFD-related (but used in amdgpu_drv.c) definitions from
kfd_priv.h to kgd_kfd_interface.h so we don't need to include kfd_priv.h
in amdgpu_drv.c. This fixes a build failure when AMDGPU is enabled but
MMU_NOTIFIER is not.
This patch also disables KFD-related module options when HSA_AMD is not
enabled.

v2: rebase (Alex)
Signed-off-by: default avatarAmber Lin <Amber.Lin@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent dcaaff4e
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "amdgpu_gem.h" #include "amdgpu_gem.h"
#include "amdgpu_amdkfd.h" #include "amdgpu_amdkfd.h"
#include "kfd_priv.h"
/* /*
* KMS wrapper. * KMS wrapper.
...@@ -128,16 +127,6 @@ int amdgpu_compute_multipipe = -1; ...@@ -128,16 +127,6 @@ int amdgpu_compute_multipipe = -1;
int amdgpu_gpu_recovery = -1; /* auto */ int amdgpu_gpu_recovery = -1; /* auto */
int amdgpu_emu_mode = 0; int amdgpu_emu_mode = 0;
uint amdgpu_smu_memory_pool_size = 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 noretry;
int halt_if_hws_hang;
/** /**
* DOC: vramlimit (int) * DOC: vramlimit (int)
...@@ -543,12 +532,14 @@ MODULE_PARM_DESC(smu_memory_pool_size, ...@@ -543,12 +532,14 @@ MODULE_PARM_DESC(smu_memory_pool_size,
"0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte"); "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_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444);
#ifdef CONFIG_HSA_AMD
/** /**
* DOC: sched_policy (int) * DOC: sched_policy (int)
* Set scheduling policy. Default is HWS(hardware scheduling) with over-subscription. * Set scheduling policy. Default is HWS(hardware scheduling) with over-subscription.
* Setting 1 disables over-subscription. Setting 2 disables HWS and statically * Setting 1 disables over-subscription. Setting 2 disables HWS and statically
* assigns queues to HQDs. * assigns queues to HQDs.
*/ */
int sched_policy = KFD_SCHED_POLICY_HWS;
module_param(sched_policy, int, 0444); module_param(sched_policy, int, 0444);
MODULE_PARM_DESC(sched_policy, MODULE_PARM_DESC(sched_policy,
"Scheduling policy (0 = HWS (Default), 1 = HWS without over-subscription, 2 = Non-HWS (Used for debugging only)"); "Scheduling policy (0 = HWS (Default), 1 = HWS without over-subscription, 2 = Non-HWS (Used for debugging only)");
...@@ -558,6 +549,7 @@ MODULE_PARM_DESC(sched_policy, ...@@ -558,6 +549,7 @@ MODULE_PARM_DESC(sched_policy,
* Maximum number of processes that HWS can schedule concurrently. The maximum is the * 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. * number of VMIDs assigned to the HWS, which is also the default.
*/ */
int hws_max_conc_proc = 8;
module_param(hws_max_conc_proc, int, 0444); module_param(hws_max_conc_proc, int, 0444);
MODULE_PARM_DESC(hws_max_conc_proc, 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))"); "Max # processes HWS can execute concurrently when sched_policy=0 (0 = no concurrency, #VMIDs for KFD = Maximum(default))");
...@@ -568,6 +560,7 @@ MODULE_PARM_DESC(hws_max_conc_proc, ...@@ -568,6 +560,7 @@ MODULE_PARM_DESC(hws_max_conc_proc,
* the middle of a compute wave. Default is 1 to enable this feature. Setting 0 * the middle of a compute wave. Default is 1 to enable this feature. Setting 0
* disables it. * disables it.
*/ */
int cwsr_enable = 1;
module_param(cwsr_enable, int, 0444); module_param(cwsr_enable, int, 0444);
MODULE_PARM_DESC(cwsr_enable, "CWSR enable (0 = Off, 1 = On (Default))"); MODULE_PARM_DESC(cwsr_enable, "CWSR enable (0 = Off, 1 = On (Default))");
...@@ -576,6 +569,7 @@ MODULE_PARM_DESC(cwsr_enable, "CWSR enable (0 = Off, 1 = On (Default))"); ...@@ -576,6 +569,7 @@ MODULE_PARM_DESC(cwsr_enable, "CWSR enable (0 = Off, 1 = On (Default))");
* Maximum number of queues per device. Valid setting is between 1 and 4096. Default * Maximum number of queues per device. Valid setting is between 1 and 4096. Default
* is 4096. * is 4096.
*/ */
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_param(max_num_of_queues_per_device, int, 0444);
MODULE_PARM_DESC(max_num_of_queues_per_device, MODULE_PARM_DESC(max_num_of_queues_per_device,
"Maximum number of supported queues per device (1 = Minimum, 4096 = default)"); "Maximum number of supported queues per device (1 = Minimum, 4096 = default)");
...@@ -585,6 +579,7 @@ MODULE_PARM_DESC(max_num_of_queues_per_device, ...@@ -585,6 +579,7 @@ MODULE_PARM_DESC(max_num_of_queues_per_device,
* Send sigterm to HSA process on unhandled exceptions. Default is not to send sigterm * 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. * but just print errors on dmesg. Setting 1 enables sending sigterm.
*/ */
int send_sigterm;
module_param(send_sigterm, int, 0444); module_param(send_sigterm, int, 0444);
MODULE_PARM_DESC(send_sigterm, MODULE_PARM_DESC(send_sigterm,
"Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)"); "Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)");
...@@ -596,6 +591,7 @@ MODULE_PARM_DESC(send_sigterm, ...@@ -596,6 +591,7 @@ MODULE_PARM_DESC(send_sigterm,
* size, usually 256MB. * size, usually 256MB.
* Default value is 0, diabled. * Default value is 0, diabled.
*/ */
int debug_largebar;
module_param(debug_largebar, int, 0444); module_param(debug_largebar, int, 0444);
MODULE_PARM_DESC(debug_largebar, MODULE_PARM_DESC(debug_largebar,
"Debug large-bar flag used to simulate large-bar capability on non-large bar machine (0 = disable, 1 = enable)"); "Debug large-bar flag used to simulate large-bar capability on non-large bar machine (0 = disable, 1 = enable)");
...@@ -606,6 +602,7 @@ MODULE_PARM_DESC(debug_largebar, ...@@ -606,6 +602,7 @@ MODULE_PARM_DESC(debug_largebar,
* table to get information about AMD APUs. This option can serve as a workaround on * table to get information about AMD APUs. This option can serve as a workaround on
* systems with a broken CRAT table. * systems with a broken CRAT table.
*/ */
int ignore_crat;
module_param(ignore_crat, int, 0444); module_param(ignore_crat, int, 0444);
MODULE_PARM_DESC(ignore_crat, MODULE_PARM_DESC(ignore_crat,
"Ignore CRAT table during KFD initialization (0 = use CRAT (default), 1 = ignore CRAT)"); "Ignore CRAT table during KFD initialization (0 = use CRAT (default), 1 = ignore CRAT)");
...@@ -616,6 +613,7 @@ MODULE_PARM_DESC(ignore_crat, ...@@ -616,6 +613,7 @@ MODULE_PARM_DESC(ignore_crat,
* Setting 1 disables retry. * Setting 1 disables retry.
* Retry is needed for recoverable page faults. * Retry is needed for recoverable page faults.
*/ */
int noretry;
module_param(noretry, int, 0644); module_param(noretry, int, 0644);
MODULE_PARM_DESC(noretry, MODULE_PARM_DESC(noretry,
"Set sh_mem_config.retry_disable on Vega10 (0 = retry enabled (default), 1 = retry disabled)"); "Set sh_mem_config.retry_disable on Vega10 (0 = retry enabled (default), 1 = retry disabled)");
...@@ -625,8 +623,10 @@ MODULE_PARM_DESC(noretry, ...@@ -625,8 +623,10 @@ MODULE_PARM_DESC(noretry,
* Halt if HWS hang is detected. Default value, 0, disables the halt on hang. * Halt if HWS hang is detected. Default value, 0, disables the halt on hang.
* Setting 1 enables halt on hang. * Setting 1 enables halt on hang.
*/ */
int halt_if_hws_hang;
module_param(halt_if_hws_hang, int, 0644); 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)"); MODULE_PARM_DESC(halt_if_hws_hang, "Halt if HWS hang is detected (0 = off (default), 1 = on)");
#endif
static const struct pci_device_id pciidlist[] = { static const struct pci_device_id pciidlist[] = {
#ifdef CONFIG_DRM_AMDGPU_SI #ifdef CONFIG_DRM_AMDGPU_SI
......
...@@ -103,7 +103,6 @@ ...@@ -103,7 +103,6 @@
*/ */
extern int max_num_of_queues_per_device; extern int max_num_of_queues_per_device;
#define KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT 4096
#define KFD_MAX_NUM_OF_QUEUES_PER_DEVICE \ #define KFD_MAX_NUM_OF_QUEUES_PER_DEVICE \
(KFD_MAX_NUM_OF_PROCESSES * \ (KFD_MAX_NUM_OF_PROCESSES * \
KFD_MAX_NUM_OF_QUEUES_PER_PROCESS) KFD_MAX_NUM_OF_QUEUES_PER_PROCESS)
...@@ -149,33 +148,6 @@ extern int noretry; ...@@ -149,33 +148,6 @@ extern int noretry;
*/ */
extern int halt_if_hws_hang; extern int halt_if_hws_hang;
/**
* enum kfd_sched_policy
*
* @KFD_SCHED_POLICY_HWS: H/W scheduling policy known as command processor (cp)
* scheduling. In this scheduling mode we're using the firmware code to
* schedule the user mode queues and kernel queues such as HIQ and DIQ.
* the HIQ queue is used as a special queue that dispatches the configuration
* to the cp and the user mode queues list that are currently running.
* the DIQ queue is a debugging queue that dispatches debugging commands to the
* firmware.
* in this scheduling mode user mode queues over subscription feature is
* enabled.
*
* @KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION: The same as above but the over
* subscription feature disabled.
*
* @KFD_SCHED_POLICY_NO_HWS: no H/W scheduling policy is a mode which directly
* set the command processor registers and sets the queues "manually". This
* mode is used *ONLY* for debugging proposes.
*
*/
enum kfd_sched_policy {
KFD_SCHED_POLICY_HWS = 0,
KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION,
KFD_SCHED_POLICY_NO_HWS
};
enum cache_policy { enum cache_policy {
cache_policy_coherent, cache_policy_coherent,
cache_policy_noncoherent cache_policy_noncoherent
......
...@@ -98,6 +98,33 @@ enum kgd_engine_type { ...@@ -98,6 +98,33 @@ enum kgd_engine_type {
KGD_ENGINE_MAX KGD_ENGINE_MAX
}; };
/**
* enum kfd_sched_policy
*
* @KFD_SCHED_POLICY_HWS: H/W scheduling policy known as command processor (cp)
* scheduling. In this scheduling mode we're using the firmware code to
* schedule the user mode queues and kernel queues such as HIQ and DIQ.
* the HIQ queue is used as a special queue that dispatches the configuration
* to the cp and the user mode queues list that are currently running.
* the DIQ queue is a debugging queue that dispatches debugging commands to the
* firmware.
* in this scheduling mode user mode queues over subscription feature is
* enabled.
*
* @KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION: The same as above but the over
* subscription feature disabled.
*
* @KFD_SCHED_POLICY_NO_HWS: no H/W scheduling policy is a mode which directly
* set the command processor registers and sets the queues "manually". This
* mode is used *ONLY* for debugging proposes.
*
*/
enum kfd_sched_policy {
KFD_SCHED_POLICY_HWS = 0,
KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION,
KFD_SCHED_POLICY_NO_HWS
};
struct kgd2kfd_shared_resources { struct kgd2kfd_shared_resources {
/* Bit n == 1 means VMID n is available for KFD. */ /* Bit n == 1 means VMID n is available for KFD. */
unsigned int compute_vmid_bitmap; unsigned int compute_vmid_bitmap;
...@@ -153,6 +180,7 @@ struct tile_config { ...@@ -153,6 +180,7 @@ struct tile_config {
uint32_t num_ranks; uint32_t num_ranks;
}; };
#define KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT 4096
/* /*
* Allocation flag domains * Allocation flag domains
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment