diff options
author | Amber Lin <Amber.Lin@amd.com> | 2018-08-29 13:39:16 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-08-29 13:41:50 -0400 |
commit | 2690262ec9fea3aa364ca9cd31981d7fe3888a5b (patch) | |
tree | 85b2b28e9b3cde27a0e30e274c91e12917a78127 /drivers/gpu/drm/amd | |
parent | dcaaff4eed13c4dcc15525ff87269b3f4544345a (diff) |
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: Amber Lin <Amber.Lin@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 22 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 28 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/include/kgd_kfd_interface.h | 28 |
3 files changed, 39 insertions, 39 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 82e6b6746511..d7d9a9d32381 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include "amdgpu_gem.h" | 39 | #include "amdgpu_gem.h" |
40 | 40 | ||
41 | #include "amdgpu_amdkfd.h" | 41 | #include "amdgpu_amdkfd.h" |
42 | #include "kfd_priv.h" | ||
43 | 42 | ||
44 | /* | 43 | /* |
45 | * KMS wrapper. | 44 | * KMS wrapper. |
@@ -128,16 +127,6 @@ int amdgpu_compute_multipipe = -1; | |||
128 | int amdgpu_gpu_recovery = -1; /* auto */ | 127 | int amdgpu_gpu_recovery = -1; /* auto */ |
129 | int amdgpu_emu_mode = 0; | 128 | int amdgpu_emu_mode = 0; |
130 | uint amdgpu_smu_memory_pool_size = 0; | 129 | uint amdgpu_smu_memory_pool_size = 0; |
131 | /* KFD parameters */ | ||
132 | int sched_policy = KFD_SCHED_POLICY_HWS; | ||
133 | int hws_max_conc_proc = 8; | ||
134 | int cwsr_enable = 1; | ||
135 | int max_num_of_queues_per_device = KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT; | ||
136 | int send_sigterm; | ||
137 | int debug_largebar; | ||
138 | int ignore_crat; | ||
139 | int noretry; | ||
140 | int halt_if_hws_hang; | ||
141 | 130 | ||
142 | /** | 131 | /** |
143 | * DOC: vramlimit (int) | 132 | * DOC: vramlimit (int) |
@@ -543,12 +532,14 @@ MODULE_PARM_DESC(smu_memory_pool_size, | |||
543 | "0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte"); | 532 | "0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte"); |
544 | module_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444); | 533 | module_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444); |
545 | 534 | ||
535 | #ifdef CONFIG_HSA_AMD | ||
546 | /** | 536 | /** |
547 | * DOC: sched_policy (int) | 537 | * DOC: sched_policy (int) |
548 | * Set scheduling policy. Default is HWS(hardware scheduling) with over-subscription. | 538 | * Set scheduling policy. Default is HWS(hardware scheduling) with over-subscription. |
549 | * Setting 1 disables over-subscription. Setting 2 disables HWS and statically | 539 | * Setting 1 disables over-subscription. Setting 2 disables HWS and statically |
550 | * assigns queues to HQDs. | 540 | * assigns queues to HQDs. |
551 | */ | 541 | */ |
542 | int sched_policy = KFD_SCHED_POLICY_HWS; | ||
552 | module_param(sched_policy, int, 0444); | 543 | module_param(sched_policy, int, 0444); |
553 | MODULE_PARM_DESC(sched_policy, | 544 | MODULE_PARM_DESC(sched_policy, |
554 | "Scheduling policy (0 = HWS (Default), 1 = HWS without over-subscription, 2 = Non-HWS (Used for debugging only)"); | 545 | "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 | * Maximum number of processes that HWS can schedule concurrently. The maximum is the | 549 | * Maximum number of processes that HWS can schedule concurrently. The maximum is the |
559 | * number of VMIDs assigned to the HWS, which is also the default. | 550 | * number of VMIDs assigned to the HWS, which is also the default. |
560 | */ | 551 | */ |
552 | int hws_max_conc_proc = 8; | ||
561 | module_param(hws_max_conc_proc, int, 0444); | 553 | module_param(hws_max_conc_proc, int, 0444); |
562 | MODULE_PARM_DESC(hws_max_conc_proc, | 554 | MODULE_PARM_DESC(hws_max_conc_proc, |
563 | "Max # processes HWS can execute concurrently when sched_policy=0 (0 = no concurrency, #VMIDs for KFD = Maximum(default))"); | 555 | "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 | * the middle of a compute wave. Default is 1 to enable this feature. Setting 0 | 560 | * the middle of a compute wave. Default is 1 to enable this feature. Setting 0 |
569 | * disables it. | 561 | * disables it. |
570 | */ | 562 | */ |
563 | int cwsr_enable = 1; | ||
571 | module_param(cwsr_enable, int, 0444); | 564 | module_param(cwsr_enable, int, 0444); |
572 | MODULE_PARM_DESC(cwsr_enable, "CWSR enable (0 = Off, 1 = On (Default))"); | 565 | MODULE_PARM_DESC(cwsr_enable, "CWSR enable (0 = Off, 1 = On (Default))"); |
573 | 566 | ||
@@ -576,6 +569,7 @@ MODULE_PARM_DESC(cwsr_enable, "CWSR enable (0 = Off, 1 = On (Default))"); | |||
576 | * Maximum number of queues per device. Valid setting is between 1 and 4096. Default | 569 | * Maximum number of queues per device. Valid setting is between 1 and 4096. Default |
577 | * is 4096. | 570 | * is 4096. |
578 | */ | 571 | */ |
572 | int max_num_of_queues_per_device = KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT; | ||
579 | module_param(max_num_of_queues_per_device, int, 0444); | 573 | module_param(max_num_of_queues_per_device, int, 0444); |
580 | MODULE_PARM_DESC(max_num_of_queues_per_device, | 574 | MODULE_PARM_DESC(max_num_of_queues_per_device, |
581 | "Maximum number of supported queues per device (1 = Minimum, 4096 = default)"); | 575 | "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 | * Send sigterm to HSA process on unhandled exceptions. Default is not to send sigterm | 579 | * Send sigterm to HSA process on unhandled exceptions. Default is not to send sigterm |
586 | * but just print errors on dmesg. Setting 1 enables sending sigterm. | 580 | * but just print errors on dmesg. Setting 1 enables sending sigterm. |
587 | */ | 581 | */ |
582 | int send_sigterm; | ||
588 | module_param(send_sigterm, int, 0444); | 583 | module_param(send_sigterm, int, 0444); |
589 | MODULE_PARM_DESC(send_sigterm, | 584 | MODULE_PARM_DESC(send_sigterm, |
590 | "Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)"); | 585 | "Send sigterm to HSA process on unhandled exception (0 = disable, 1 = enable)"); |
@@ -596,6 +591,7 @@ MODULE_PARM_DESC(send_sigterm, | |||
596 | * size, usually 256MB. | 591 | * size, usually 256MB. |
597 | * Default value is 0, diabled. | 592 | * Default value is 0, diabled. |
598 | */ | 593 | */ |
594 | int debug_largebar; | ||
599 | module_param(debug_largebar, int, 0444); | 595 | module_param(debug_largebar, int, 0444); |
600 | MODULE_PARM_DESC(debug_largebar, | 596 | MODULE_PARM_DESC(debug_largebar, |
601 | "Debug large-bar flag used to simulate large-bar capability on non-large bar machine (0 = disable, 1 = enable)"); | 597 | "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 | * table to get information about AMD APUs. This option can serve as a workaround on | 602 | * table to get information about AMD APUs. This option can serve as a workaround on |
607 | * systems with a broken CRAT table. | 603 | * systems with a broken CRAT table. |
608 | */ | 604 | */ |
605 | int ignore_crat; | ||
609 | module_param(ignore_crat, int, 0444); | 606 | module_param(ignore_crat, int, 0444); |
610 | MODULE_PARM_DESC(ignore_crat, | 607 | MODULE_PARM_DESC(ignore_crat, |
611 | "Ignore CRAT table during KFD initialization (0 = use CRAT (default), 1 = ignore CRAT)"); | 608 | "Ignore CRAT table during KFD initialization (0 = use CRAT (default), 1 = ignore CRAT)"); |
@@ -616,6 +613,7 @@ MODULE_PARM_DESC(ignore_crat, | |||
616 | * Setting 1 disables retry. | 613 | * Setting 1 disables retry. |
617 | * Retry is needed for recoverable page faults. | 614 | * Retry is needed for recoverable page faults. |
618 | */ | 615 | */ |
616 | int noretry; | ||
619 | module_param(noretry, int, 0644); | 617 | module_param(noretry, int, 0644); |
620 | MODULE_PARM_DESC(noretry, | 618 | MODULE_PARM_DESC(noretry, |
621 | "Set sh_mem_config.retry_disable on Vega10 (0 = retry enabled (default), 1 = retry disabled)"); | 619 | "Set sh_mem_config.retry_disable on Vega10 (0 = retry enabled (default), 1 = retry disabled)"); |
@@ -625,8 +623,10 @@ MODULE_PARM_DESC(noretry, | |||
625 | * Halt if HWS hang is detected. Default value, 0, disables the halt on hang. | 623 | * Halt if HWS hang is detected. Default value, 0, disables the halt on hang. |
626 | * Setting 1 enables halt on hang. | 624 | * Setting 1 enables halt on hang. |
627 | */ | 625 | */ |
626 | int halt_if_hws_hang; | ||
628 | module_param(halt_if_hws_hang, int, 0644); | 627 | module_param(halt_if_hws_hang, int, 0644); |
629 | MODULE_PARM_DESC(halt_if_hws_hang, "Halt if HWS hang is detected (0 = off (default), 1 = on)"); | 628 | MODULE_PARM_DESC(halt_if_hws_hang, "Halt if HWS hang is detected (0 = off (default), 1 = on)"); |
629 | #endif | ||
630 | 630 | ||
631 | static const struct pci_device_id pciidlist[] = { | 631 | static const struct pci_device_id pciidlist[] = { |
632 | #ifdef CONFIG_DRM_AMDGPU_SI | 632 | #ifdef CONFIG_DRM_AMDGPU_SI |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h index f971710f1c91..355f79da8a63 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h | |||
@@ -103,7 +103,6 @@ | |||
103 | */ | 103 | */ |
104 | extern int max_num_of_queues_per_device; | 104 | extern int max_num_of_queues_per_device; |
105 | 105 | ||
106 | #define KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT 4096 | ||
107 | #define KFD_MAX_NUM_OF_QUEUES_PER_DEVICE \ | 106 | #define KFD_MAX_NUM_OF_QUEUES_PER_DEVICE \ |
108 | (KFD_MAX_NUM_OF_PROCESSES * \ | 107 | (KFD_MAX_NUM_OF_PROCESSES * \ |
109 | KFD_MAX_NUM_OF_QUEUES_PER_PROCESS) | 108 | KFD_MAX_NUM_OF_QUEUES_PER_PROCESS) |
@@ -149,33 +148,6 @@ extern int noretry; | |||
149 | */ | 148 | */ |
150 | extern int halt_if_hws_hang; | 149 | extern int halt_if_hws_hang; |
151 | 150 | ||
152 | /** | ||
153 | * enum kfd_sched_policy | ||
154 | * | ||
155 | * @KFD_SCHED_POLICY_HWS: H/W scheduling policy known as command processor (cp) | ||
156 | * scheduling. In this scheduling mode we're using the firmware code to | ||
157 | * schedule the user mode queues and kernel queues such as HIQ and DIQ. | ||
158 | * the HIQ queue is used as a special queue that dispatches the configuration | ||
159 | * to the cp and the user mode queues list that are currently running. | ||
160 | * the DIQ queue is a debugging queue that dispatches debugging commands to the | ||
161 | * firmware. | ||
162 | * in this scheduling mode user mode queues over subscription feature is | ||
163 | * enabled. | ||
164 | * | ||
165 | * @KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION: The same as above but the over | ||
166 | * subscription feature disabled. | ||
167 | * | ||
168 | * @KFD_SCHED_POLICY_NO_HWS: no H/W scheduling policy is a mode which directly | ||
169 | * set the command processor registers and sets the queues "manually". This | ||
170 | * mode is used *ONLY* for debugging proposes. | ||
171 | * | ||
172 | */ | ||
173 | enum kfd_sched_policy { | ||
174 | KFD_SCHED_POLICY_HWS = 0, | ||
175 | KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION, | ||
176 | KFD_SCHED_POLICY_NO_HWS | ||
177 | }; | ||
178 | |||
179 | enum cache_policy { | 151 | enum cache_policy { |
180 | cache_policy_coherent, | 152 | cache_policy_coherent, |
181 | cache_policy_noncoherent | 153 | cache_policy_noncoherent |
diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h index 814576f6ca1c..31c52c116e20 100644 --- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h +++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h | |||
@@ -98,6 +98,33 @@ enum kgd_engine_type { | |||
98 | KGD_ENGINE_MAX | 98 | KGD_ENGINE_MAX |
99 | }; | 99 | }; |
100 | 100 | ||
101 | /** | ||
102 | * enum kfd_sched_policy | ||
103 | * | ||
104 | * @KFD_SCHED_POLICY_HWS: H/W scheduling policy known as command processor (cp) | ||
105 | * scheduling. In this scheduling mode we're using the firmware code to | ||
106 | * schedule the user mode queues and kernel queues such as HIQ and DIQ. | ||
107 | * the HIQ queue is used as a special queue that dispatches the configuration | ||
108 | * to the cp and the user mode queues list that are currently running. | ||
109 | * the DIQ queue is a debugging queue that dispatches debugging commands to the | ||
110 | * firmware. | ||
111 | * in this scheduling mode user mode queues over subscription feature is | ||
112 | * enabled. | ||
113 | * | ||
114 | * @KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION: The same as above but the over | ||
115 | * subscription feature disabled. | ||
116 | * | ||
117 | * @KFD_SCHED_POLICY_NO_HWS: no H/W scheduling policy is a mode which directly | ||
118 | * set the command processor registers and sets the queues "manually". This | ||
119 | * mode is used *ONLY* for debugging proposes. | ||
120 | * | ||
121 | */ | ||
122 | enum kfd_sched_policy { | ||
123 | KFD_SCHED_POLICY_HWS = 0, | ||
124 | KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION, | ||
125 | KFD_SCHED_POLICY_NO_HWS | ||
126 | }; | ||
127 | |||
101 | struct kgd2kfd_shared_resources { | 128 | struct kgd2kfd_shared_resources { |
102 | /* Bit n == 1 means VMID n is available for KFD. */ | 129 | /* Bit n == 1 means VMID n is available for KFD. */ |
103 | unsigned int compute_vmid_bitmap; | 130 | unsigned int compute_vmid_bitmap; |
@@ -153,6 +180,7 @@ struct tile_config { | |||
153 | uint32_t num_ranks; | 180 | uint32_t num_ranks; |
154 | }; | 181 | }; |
155 | 182 | ||
183 | #define KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT 4096 | ||
156 | 184 | ||
157 | /* | 185 | /* |
158 | * Allocation flag domains | 186 | * Allocation flag domains |