drm/amdgpu: add scheduler initialization
authorAlex Deucher <alexander.deucher@amd.com>
Mon, 17 Aug 2015 02:55:02 +0000 (22:55 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 17 Aug 2015 20:50:31 +0000 (16:50 -0400)
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>
drivers/gpu/drm/amd/amdgpu/Makefile
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c

index 4c75e1c0156faba63f846d0694065b2c1c08fe8d..2800cf70b557a6255d3025db19c9c07b0029ca5f 100644 (file)
@@ -4,7 +4,8 @@
 
 ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/asic_reg \
        -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
 
@@ -82,6 +83,10 @@ amdgpu-y += \
 # add cgs
 amdgpu-y += amdgpu_cgs.o
 
+# GPU scheduler
+amdgpu-y += \
+       ../scheduler/gpu_scheduler.o
+
 amdgpu-$(CONFIG_COMPAT) += amdgpu_ioc32.o
 amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o
 amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o
index a9ead9731b35a638275ffcdb3a3124db9041439a..815d40f5e6e126b539cc83031845448d854f8b9f 100644 (file)
@@ -53,6 +53,8 @@
 #include "amdgpu_ucode.h"
 #include "amdgpu_gds.h"
 
+#include "gpu_scheduler.h"
+
 /*
  * Modules parameters.
  */
@@ -77,6 +79,7 @@ extern int amdgpu_bapm;
 extern int amdgpu_deep_color;
 extern int amdgpu_vm_size;
 extern int amdgpu_vm_block_size;
+extern int amdgpu_enable_scheduler;
 
 #define AMDGPU_MAX_USEC_TIMEOUT                        100000  /* 100 ms */
 #define AMDGPU_FENCE_JIFFIES_TIMEOUT           (HZ / 2)
@@ -860,6 +863,7 @@ struct amdgpu_ring {
        struct amdgpu_device            *adev;
        const struct amdgpu_ring_funcs  *funcs;
        struct amdgpu_fence_driver      fence_drv;
+       struct amd_gpu_scheduler        *scheduler;
 
        struct mutex            *ring_lock;
        struct amdgpu_bo        *ring_obj;
index e6f2aca898295a7b0857a9b54638241ab5401da7..5feea44f4c330c5481e97b6c6dea16a63ed9d898 100644 (file)
@@ -75,6 +75,7 @@ int amdgpu_deep_color = 0;
 int amdgpu_vm_size = 8;
 int amdgpu_vm_block_size = -1;
 int amdgpu_exp_hw_support = 0;
+int amdgpu_enable_scheduler = 0;
 
 MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
 module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
index 1b0bc07d0c01e82191633cb34102c46a42032cc9..4edeb90e7227aa19c7563c8728a95f8a4c05dd9f 100644 (file)
@@ -902,6 +902,14 @@ void amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring)
        INIT_DELAYED_WORK(&ring->fence_drv.lockup_work,
                        amdgpu_fence_check_lockup);
        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)
                wake_up_all(&adev->fence_queue);
                amdgpu_irq_put(adev, ring->fence_drv.irq_src,
                               ring->fence_drv.irq_type);
+               if (ring->scheduler)
+                       amd_sched_destroy(ring->scheduler);
                ring->fence_drv.initialized = false;
        }
        mutex_unlock(&adev->ring_lock);