Skip to content

Commit b946798

Browse files
committed
drm/amdgpu: add dynamic workload profile switching for gfx10
Enable dynamic workload profile switching for gfx10. Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 8fdb395 commit b946798

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4701,6 +4701,8 @@ static int gfx_v10_0_sw_init(struct amdgpu_ip_block *ip_block)
47014701
int xcc_id = 0;
47024702
struct amdgpu_device *adev = ip_block->adev;
47034703

4704+
INIT_DELAYED_WORK(&adev->gfx.idle_work, amdgpu_gfx_profile_idle_work_handler);
4705+
47044706
switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
47054707
case IP_VERSION(10, 1, 10):
47064708
case IP_VERSION(10, 1, 1):
@@ -7467,6 +7469,8 @@ static int gfx_v10_0_hw_fini(struct amdgpu_ip_block *ip_block)
74677469
{
74687470
struct amdgpu_device *adev = ip_block->adev;
74697471

7472+
cancel_delayed_work_sync(&adev->gfx.idle_work);
7473+
74707474
amdgpu_irq_put(adev, &adev->gfx.priv_reg_irq, 0);
74717475
amdgpu_irq_put(adev, &adev->gfx.priv_inst_irq, 0);
74727476
amdgpu_irq_put(adev, &adev->gfx.bad_op_irq, 0);
@@ -9748,6 +9752,20 @@ static void gfx_v10_0_ring_emit_cleaner_shader(struct amdgpu_ring *ring)
97489752
amdgpu_ring_write(ring, 0); /* RESERVED field, programmed to zero */
97499753
}
97509754

9755+
static void gfx_v10_0_ring_begin_use(struct amdgpu_ring *ring)
9756+
{
9757+
amdgpu_gfx_profile_ring_begin_use(ring);
9758+
9759+
amdgpu_gfx_enforce_isolation_ring_begin_use(ring);
9760+
}
9761+
9762+
static void gfx_v10_0_ring_end_use(struct amdgpu_ring *ring)
9763+
{
9764+
amdgpu_gfx_profile_ring_end_use(ring);
9765+
9766+
amdgpu_gfx_enforce_isolation_ring_end_use(ring);
9767+
}
9768+
97519769
static const struct amd_ip_funcs gfx_v10_0_ip_funcs = {
97529770
.name = "gfx_v10_0",
97539771
.early_init = gfx_v10_0_early_init,
@@ -9823,8 +9841,8 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
98239841
.emit_mem_sync = gfx_v10_0_emit_mem_sync,
98249842
.reset = gfx_v10_0_reset_kgq,
98259843
.emit_cleaner_shader = gfx_v10_0_ring_emit_cleaner_shader,
9826-
.begin_use = amdgpu_gfx_enforce_isolation_ring_begin_use,
9827-
.end_use = amdgpu_gfx_enforce_isolation_ring_end_use,
9844+
.begin_use = gfx_v10_0_ring_begin_use,
9845+
.end_use = gfx_v10_0_ring_end_use,
98289846
};
98299847

98309848
static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {
@@ -9864,8 +9882,8 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {
98649882
.emit_mem_sync = gfx_v10_0_emit_mem_sync,
98659883
.reset = gfx_v10_0_reset_kcq,
98669884
.emit_cleaner_shader = gfx_v10_0_ring_emit_cleaner_shader,
9867-
.begin_use = amdgpu_gfx_enforce_isolation_ring_begin_use,
9868-
.end_use = amdgpu_gfx_enforce_isolation_ring_end_use,
9885+
.begin_use = gfx_v10_0_ring_begin_use,
9886+
.end_use = gfx_v10_0_ring_end_use,
98699887
};
98709888

98719889
static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_kiq = {

0 commit comments

Comments
 (0)