diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2015-08-16 22:55:02 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-08-17 16:50:31 -0400 |
commit | b80d8475c1fdf5f4bcabb65168b2e8a9c3d77731 (patch) | |
tree | 0e07771878992e8e4d5bd5a3c2cc7c7f810aad4c /drivers/gpu/drm/amd | |
parent | a72ce6f84109c1dec1ab236d65979d3250668af3 (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/Makefile | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 10 |
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 | ||
5 | ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/asic_reg \ | 5 | ccflags-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 | ||
9 | amdgpu-y := amdgpu_drv.o | 10 | amdgpu-y := amdgpu_drv.o |
10 | 11 | ||
@@ -82,6 +83,10 @@ amdgpu-y += \ | |||
82 | # add cgs | 83 | # add cgs |
83 | amdgpu-y += amdgpu_cgs.o | 84 | amdgpu-y += amdgpu_cgs.o |
84 | 85 | ||
86 | # GPU scheduler | ||
87 | amdgpu-y += \ | ||
88 | ../scheduler/gpu_scheduler.o | ||
89 | |||
85 | amdgpu-$(CONFIG_COMPAT) += amdgpu_ioc32.o | 90 | amdgpu-$(CONFIG_COMPAT) += amdgpu_ioc32.o |
86 | amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o | 91 | amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o |
87 | amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o | 92 | amdgpu-$(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; | |||
77 | extern int amdgpu_deep_color; | 79 | extern int amdgpu_deep_color; |
78 | extern int amdgpu_vm_size; | 80 | extern int amdgpu_vm_size; |
79 | extern int amdgpu_vm_block_size; | 81 | extern int amdgpu_vm_block_size; |
82 | extern 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; | |||
75 | int amdgpu_vm_size = 8; | 75 | int amdgpu_vm_size = 8; |
76 | int amdgpu_vm_block_size = -1; | 76 | int amdgpu_vm_block_size = -1; |
77 | int amdgpu_exp_hw_support = 0; | 77 | int amdgpu_exp_hw_support = 0; |
78 | int amdgpu_enable_scheduler = 0; | ||
78 | 79 | ||
79 | MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); | 80 | MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); |
80 | module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); | 81 | module_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); |