aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@amd.com>2014-10-26 04:12:22 -0400
committerOded Gabbay <oded.gabbay@amd.com>2015-01-09 15:26:09 -0500
commite18e794e6ba02e94edb386e6fcd4217773cb0ac8 (patch)
tree1c33d97806db32f1ffc5b62ab0a0ee6fc17f31e1 /drivers/gpu/drm
parent6e81090b2ec4db256b08fab232e0d247aadf1bc5 (diff)
drm/amdkfd: Fixed calculation of gart buffer size
This patch makes the gart's buffer size calculation more accurate. This buffer is needed per GPU. It takes into account maximum number of MQDs, runlist packets, kernel queues and reserves 512KB for other misc allocations. The total size is just shy of 4MB, for 32 processes and 128 queues per process, which are the defaults for amdkfd kernel module parameters. Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Reviewed-by: Alexey Skidanov <Alexey.skidanov@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_device.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 33c30dc21d67..fdc7dff2bfa0 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -26,6 +26,7 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include "kfd_priv.h" 27#include "kfd_priv.h"
28#include "kfd_device_queue_manager.h" 28#include "kfd_device_queue_manager.h"
29#include "kfd_pm4_headers.h"
29 30
30#define MQD_SIZE_ALIGNED 768 31#define MQD_SIZE_ALIGNED 768
31 32
@@ -178,16 +179,31 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
178 max_num_of_queues_per_process * 179 max_num_of_queues_per_process *
179 kfd->device_info->mqd_size_aligned; 180 kfd->device_info->mqd_size_aligned;
180 181
181 /* add another 512KB for all other allocations on gart */ 182 /*
183 * calculate max size of runlist packet.
184 * There can be only 2 packets at once
185 */
186 size += (max_num_of_processes * sizeof(struct pm4_map_process) +
187 max_num_of_processes * max_num_of_queues_per_process *
188 sizeof(struct pm4_map_queues) + sizeof(struct pm4_runlist)) * 2;
189
190 /* Add size of HIQ & DIQ */
191 size += KFD_KERNEL_QUEUE_SIZE * 2;
192
193 /* add another 512KB for all other allocations on gart (HPD, fences) */
182 size += 512 * 1024; 194 size += 512 * 1024;
183 195
184 if (kfd2kgd->init_sa_manager(kfd->kgd, size)) { 196 if (kfd2kgd->init_sa_manager(kfd->kgd, size)) {
185 dev_err(kfd_device, 197 dev_err(kfd_device,
186 "Error initializing sa manager for device (%x:%x)\n", 198 "Could not allocate %d bytes for device (%x:%x)\n",
187 kfd->pdev->vendor, kfd->pdev->device); 199 size, kfd->pdev->vendor, kfd->pdev->device);
188 goto out; 200 goto out;
189 } 201 }
190 202
203 dev_info(kfd_device,
204 "Allocated %d bytes on gart for device(%x:%x)\n",
205 size, kfd->pdev->vendor, kfd->pdev->device);
206
191 kfd_doorbell_init(kfd); 207 kfd_doorbell_init(kfd);
192 208
193 if (kfd_topology_add_device(kfd) != 0) { 209 if (kfd_topology_add_device(kfd) != 0) {