aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2015-08-16 22:55:02 -0400
committerAlex Deucher <alexander.deucher@amd.com>2015-08-17 16:50:31 -0400
commitb80d8475c1fdf5f4bcabb65168b2e8a9c3d77731 (patch)
tree0e07771878992e8e4d5bd5a3c2cc7c7f810aad4c /drivers/gpu/drm/amd
parenta72ce6f84109c1dec1ab236d65979d3250668af3 (diff)
drm/amdgpu: add scheduler initialization
1. Add kernel parameter option, default 0 2. Add scheduler initialization for amdgpu Signed-off-by: Chunming Zhou <David1.Zhou@amd.com> Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com> Acked-by: Christian K?nig <christian.koenig@amd.com> Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/Makefile7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c10
4 files changed, 21 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile
index 4c75e1c0156f..2800cf70b557 100644
--- a/drivers/gpu/drm/amd/amdgpu/Makefile
+++ b/drivers/gpu/drm/amd/amdgpu/Makefile
@@ -4,7 +4,8 @@
4 4
5ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/asic_reg \ 5ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/asic_reg \
6 -Idrivers/gpu/drm/amd/include \ 6 -Idrivers/gpu/drm/amd/include \
7 -Idrivers/gpu/drm/amd/amdgpu 7 -Idrivers/gpu/drm/amd/amdgpu \
8 -Idrivers/gpu/drm/amd/scheduler
8 9
9amdgpu-y := amdgpu_drv.o 10amdgpu-y := amdgpu_drv.o
10 11
@@ -82,6 +83,10 @@ amdgpu-y += \
82# add cgs 83# add cgs
83amdgpu-y += amdgpu_cgs.o 84amdgpu-y += amdgpu_cgs.o
84 85
86# GPU scheduler
87amdgpu-y += \
88 ../scheduler/gpu_scheduler.o
89
85amdgpu-$(CONFIG_COMPAT) += amdgpu_ioc32.o 90amdgpu-$(CONFIG_COMPAT) += amdgpu_ioc32.o
86amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o 91amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o
87amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o 92amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index a9ead9731b35..815d40f5e6e1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -53,6 +53,8 @@
53#include "amdgpu_ucode.h" 53#include "amdgpu_ucode.h"
54#include "amdgpu_gds.h" 54#include "amdgpu_gds.h"
55 55
56#include "gpu_scheduler.h"
57
56/* 58/*
57 * Modules parameters. 59 * Modules parameters.
58 */ 60 */
@@ -77,6 +79,7 @@ extern int amdgpu_bapm;
77extern int amdgpu_deep_color; 79extern int amdgpu_deep_color;
78extern int amdgpu_vm_size; 80extern int amdgpu_vm_size;
79extern int amdgpu_vm_block_size; 81extern int amdgpu_vm_block_size;
82extern int amdgpu_enable_scheduler;
80 83
81#define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */ 84#define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */
82#define AMDGPU_FENCE_JIFFIES_TIMEOUT (HZ / 2) 85#define AMDGPU_FENCE_JIFFIES_TIMEOUT (HZ / 2)
@@ -860,6 +863,7 @@ struct amdgpu_ring {
860 struct amdgpu_device *adev; 863 struct amdgpu_device *adev;
861 const struct amdgpu_ring_funcs *funcs; 864 const struct amdgpu_ring_funcs *funcs;
862 struct amdgpu_fence_driver fence_drv; 865 struct amdgpu_fence_driver fence_drv;
866 struct amd_gpu_scheduler *scheduler;
863 867
864 struct mutex *ring_lock; 868 struct mutex *ring_lock;
865 struct amdgpu_bo *ring_obj; 869 struct amdgpu_bo *ring_obj;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index e6f2aca89829..5feea44f4c33 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -75,6 +75,7 @@ int amdgpu_deep_color = 0;
75int amdgpu_vm_size = 8; 75int amdgpu_vm_size = 8;
76int amdgpu_vm_block_size = -1; 76int amdgpu_vm_block_size = -1;
77int amdgpu_exp_hw_support = 0; 77int amdgpu_exp_hw_support = 0;
78int amdgpu_enable_scheduler = 0;
78 79
79MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); 80MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
80module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); 81module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index 1b0bc07d0c01..4edeb90e7227 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -902,6 +902,14 @@ void amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring)
902 INIT_DELAYED_WORK(&ring->fence_drv.lockup_work, 902 INIT_DELAYED_WORK(&ring->fence_drv.lockup_work,
903 amdgpu_fence_check_lockup); 903 amdgpu_fence_check_lockup);
904 ring->fence_drv.ring = ring; 904 ring->fence_drv.ring = ring;
905
906 if (amdgpu_enable_scheduler) {
907 ring->scheduler = amd_sched_create((void *)ring->adev,
908 NULL, ring->idx, 5, 0);
909 if (!ring->scheduler)
910 DRM_ERROR("Failed to create scheduler on ring %d.\n",
911 ring->idx);
912 }
905} 913}
906 914
907/** 915/**
@@ -950,6 +958,8 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev)
950 wake_up_all(&adev->fence_queue); 958 wake_up_all(&adev->fence_queue);
951 amdgpu_irq_put(adev, ring->fence_drv.irq_src, 959 amdgpu_irq_put(adev, ring->fence_drv.irq_src,
952 ring->fence_drv.irq_type); 960 ring->fence_drv.irq_type);
961 if (ring->scheduler)
962 amd_sched_destroy(ring->scheduler);
953 ring->fence_drv.initialized = false; 963 ring->fence_drv.initialized = false;
954 } 964 }
955 mutex_unlock(&adev->ring_lock); 965 mutex_unlock(&adev->ring_lock);