Commit b80d8475 authored by Alex Deucher's avatar Alex Deucher

drm/amdgpu: add scheduler initialization

1. Add kernel parameter option, default 0
2. Add scheduler initialization for amdgpu
Signed-off-by: default avatarChunming Zhou <David1.Zhou@amd.com>
Signed-off-by: default avatarJammy Zhou <Jammy.Zhou@amd.com>
Acked-by: default avatarChristian K?nig <christian.koenig@amd.com>
Reviewed-by: default avatarJammy Zhou <Jammy.Zhou@amd.com>
parent a72ce6f8
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/asic_reg \ ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/asic_reg \
-Idrivers/gpu/drm/amd/include \ -Idrivers/gpu/drm/amd/include \
-Idrivers/gpu/drm/amd/amdgpu -Idrivers/gpu/drm/amd/amdgpu \
-Idrivers/gpu/drm/amd/scheduler
amdgpu-y := amdgpu_drv.o amdgpu-y := amdgpu_drv.o
...@@ -82,6 +83,10 @@ amdgpu-y += \ ...@@ -82,6 +83,10 @@ amdgpu-y += \
# add cgs # add cgs
amdgpu-y += amdgpu_cgs.o amdgpu-y += amdgpu_cgs.o
# GPU scheduler
amdgpu-y += \
../scheduler/gpu_scheduler.o
amdgpu-$(CONFIG_COMPAT) += amdgpu_ioc32.o amdgpu-$(CONFIG_COMPAT) += amdgpu_ioc32.o
amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o
amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o
......
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
#include "amdgpu_ucode.h" #include "amdgpu_ucode.h"
#include "amdgpu_gds.h" #include "amdgpu_gds.h"
#include "gpu_scheduler.h"
/* /*
* Modules parameters. * Modules parameters.
*/ */
...@@ -77,6 +79,7 @@ extern int amdgpu_bapm; ...@@ -77,6 +79,7 @@ extern int amdgpu_bapm;
extern int amdgpu_deep_color; extern int amdgpu_deep_color;
extern int amdgpu_vm_size; extern int amdgpu_vm_size;
extern int amdgpu_vm_block_size; extern int amdgpu_vm_block_size;
extern int amdgpu_enable_scheduler;
#define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */ #define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */
#define AMDGPU_FENCE_JIFFIES_TIMEOUT (HZ / 2) #define AMDGPU_FENCE_JIFFIES_TIMEOUT (HZ / 2)
...@@ -860,6 +863,7 @@ struct amdgpu_ring { ...@@ -860,6 +863,7 @@ struct amdgpu_ring {
struct amdgpu_device *adev; struct amdgpu_device *adev;
const struct amdgpu_ring_funcs *funcs; const struct amdgpu_ring_funcs *funcs;
struct amdgpu_fence_driver fence_drv; struct amdgpu_fence_driver fence_drv;
struct amd_gpu_scheduler *scheduler;
struct mutex *ring_lock; struct mutex *ring_lock;
struct amdgpu_bo *ring_obj; struct amdgpu_bo *ring_obj;
......
...@@ -75,6 +75,7 @@ int amdgpu_deep_color = 0; ...@@ -75,6 +75,7 @@ int amdgpu_deep_color = 0;
int amdgpu_vm_size = 8; int amdgpu_vm_size = 8;
int amdgpu_vm_block_size = -1; int amdgpu_vm_block_size = -1;
int amdgpu_exp_hw_support = 0; int amdgpu_exp_hw_support = 0;
int amdgpu_enable_scheduler = 0;
MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
......
...@@ -902,6 +902,14 @@ void amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring) ...@@ -902,6 +902,14 @@ void amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring)
INIT_DELAYED_WORK(&ring->fence_drv.lockup_work, INIT_DELAYED_WORK(&ring->fence_drv.lockup_work,
amdgpu_fence_check_lockup); amdgpu_fence_check_lockup);
ring->fence_drv.ring = ring; ring->fence_drv.ring = ring;
if (amdgpu_enable_scheduler) {
ring->scheduler = amd_sched_create((void *)ring->adev,
NULL, ring->idx, 5, 0);
if (!ring->scheduler)
DRM_ERROR("Failed to create scheduler on ring %d.\n",
ring->idx);
}
} }
/** /**
...@@ -950,6 +958,8 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) ...@@ -950,6 +958,8 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev)
wake_up_all(&adev->fence_queue); wake_up_all(&adev->fence_queue);
amdgpu_irq_put(adev, ring->fence_drv.irq_src, amdgpu_irq_put(adev, ring->fence_drv.irq_src,
ring->fence_drv.irq_type); ring->fence_drv.irq_type);
if (ring->scheduler)
amd_sched_destroy(ring->scheduler);
ring->fence_drv.initialized = false; ring->fence_drv.initialized = false;
} }
mutex_unlock(&adev->ring_lock); mutex_unlock(&adev->ring_lock);
......
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