firefly-linux-kernel-4.4.55.git
9 years agodrm/amdgpu: remove amdgpu_fence_wait
Christian König [Fri, 7 Aug 2015 11:53:36 +0000 (13:53 +0200)]
drm/amdgpu: remove amdgpu_fence_wait

It was just a wrapper for fence_wait anyway.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: use the reservation obj wait for the UVD msg
Christian König [Thu, 6 Aug 2015 18:44:47 +0000 (20:44 +0200)]
drm/amdgpu: use the reservation obj wait for the UVD msg

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: remove amdgpu_fence_signaled
Christian König [Thu, 6 Aug 2015 15:49:25 +0000 (17:49 +0200)]
drm/amdgpu: remove amdgpu_fence_signaled

The common kernel function does the same thing.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amd: add scheduler fence implementation (v2)
Chunming Zhou [Sun, 2 Aug 2015 03:18:04 +0000 (11:18 +0800)]
drm/amd: add scheduler fence implementation (v2)

scheduler fence is based on kernel fence framework.

v2: squash in Christian's build fix

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
9 years agodrm/amdgpu: use kernel submit helper in vm
Chunming Zhou [Mon, 3 Aug 2015 04:57:31 +0000 (12:57 +0800)]
drm/amdgpu: use kernel submit helper in vm

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
9 years agodrm/amdgpu: use amd_sched_job in its backend ops
Chunming Zhou [Thu, 6 Aug 2015 07:19:12 +0000 (15:19 +0800)]
drm/amdgpu: use amd_sched_job in its backend ops

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
9 years agodrm/amdgpu: cleanup and fix scheduler fence handling v2
Christian König [Wed, 5 Aug 2015 19:22:10 +0000 (21:22 +0200)]
drm/amdgpu: cleanup and fix scheduler fence handling v2

v2: rebased

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: merge amd_sched_entity and amd_context_entity v2
Christian König [Wed, 5 Aug 2015 16:33:21 +0000 (18:33 +0200)]
drm/amdgpu: merge amd_sched_entity and amd_context_entity v2

Avoiding a couple of casts.

v2: rename c_entity to entity as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: fix coding style in a couple of places
Christian König [Wed, 5 Aug 2015 16:18:52 +0000 (18:18 +0200)]
drm/amdgpu: fix coding style in a couple of places

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: remove unused parent entity
Christian König [Wed, 5 Aug 2015 16:11:14 +0000 (18:11 +0200)]
drm/amdgpu: remove unused parent entity

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: process sched job exactly triggered by fence signal
Chunming Zhou [Wed, 5 Aug 2015 11:52:14 +0000 (19:52 +0800)]
drm/amdgpu: process sched job exactly triggered by fence signal

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
9 years agoRevert "drm/amdgpu: return new seq_no for amd_sched_push_job"
Chunming Zhou [Wed, 5 Aug 2015 11:07:08 +0000 (19:07 +0800)]
Revert "drm/amdgpu: return new seq_no for amd_sched_push_job"

This reverts commit d1d33da8eb86b8ca41dd9ed95738030df5267b95.

Reviewed-by: Christian K?nig <christian.koenig@amd.com>
Conflicts:
drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

9 years agodrm/amdgpu: cleanup amdgpu_ctx inti/fini v2
Christian König [Tue, 4 Aug 2015 15:51:05 +0000 (17:51 +0200)]
drm/amdgpu: cleanup amdgpu_ctx inti/fini v2

Cleanup the kernel context handling.

v2: rebased

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com> (v1)
9 years agodrm/amdgpu: stop leaking the ctx id into the scheduler v2
Christian König [Tue, 4 Aug 2015 14:58:36 +0000 (16:58 +0200)]
drm/amdgpu: stop leaking the ctx id into the scheduler v2

Id's are for the IOCTL ABI only.

v2: remove tgid as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: cleanup ctx_mgr init/fini
Christian König [Tue, 4 Aug 2015 14:20:31 +0000 (16:20 +0200)]
drm/amdgpu: cleanup ctx_mgr init/fini

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: fix bo list handling in CS
Christian König [Tue, 4 Aug 2015 09:54:48 +0000 (11:54 +0200)]
drm/amdgpu: fix bo list handling in CS

We didn't initialized the mutex in the cloned bo list resulting in nice
warnings from lockdep. Also fixes error handling in this function.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: reorder the code to avoid forward declerations
Christian König [Mon, 3 Aug 2015 18:39:12 +0000 (20:39 +0200)]
drm/amdgpu: reorder the code to avoid forward declerations

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: move sched job process from isr to fence callback
Chunming Zhou [Tue, 4 Aug 2015 03:30:09 +0000 (11:30 +0800)]
drm/amdgpu: move sched job process from isr to fence callback

This way can avoid interrupt lost, and can process sched job exactly.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: add amd_sched_next_queued_seq function
Jammy Zhou [Mon, 3 Aug 2015 02:27:57 +0000 (10:27 +0800)]
drm/amdgpu: add amd_sched_next_queued_seq function

This function is used to get the next queued sequence number

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: make last_handled_seq atomic
Jammy Zhou [Fri, 31 Jul 2015 09:54:29 +0000 (17:54 +0800)]
drm/amdgpu: make last_handled_seq atomic

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: add amd_sched_commit
Jammy Zhou [Fri, 31 Jul 2015 09:18:15 +0000 (17:18 +0800)]
drm/amdgpu: add amd_sched_commit

This function is to update last_emitted_v_seq and wake up the waiters.

It should be called by driver in the run_job backend function

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: return new seq_no for amd_sched_push_job
Jammy Zhou [Fri, 31 Jul 2015 08:47:28 +0000 (16:47 +0800)]
drm/amdgpu: return new seq_no for amd_sched_push_job

It is clean to update last_queued_v_seq in the scheduler module

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: some code refinement v2
Jammy Zhou [Thu, 30 Jul 2015 09:19:52 +0000 (17:19 +0800)]
drm/amdgpu: some code refinement v2

Fix the code alignment, etc.

v2: rebase the code

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: fix null pointer by previous cleanup
Chunming Zhou [Mon, 3 Aug 2015 12:02:43 +0000 (20:02 +0800)]
drm/amdgpu: fix null pointer by previous cleanup

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
9 years agodrm/amdgpu: add kernel fence in ib_submit_kernel_helper
Chunming Zhou [Mon, 3 Aug 2015 03:43:19 +0000 (11:43 +0800)]
drm/amdgpu: add kernel fence in ib_submit_kernel_helper

every sbumission should be able to get a fence.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
9 years agodrm/amdgpu: use kernel fence for sdma ib test
Chunming Zhou [Mon, 3 Aug 2015 05:22:35 +0000 (13:22 +0800)]
drm/amdgpu: use kernel fence for sdma ib test

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
9 years agodrm/amdgpu: use kernel fence for gfx ib test
Chunming Zhou [Mon, 3 Aug 2015 05:19:43 +0000 (13:19 +0800)]
drm/amdgpu: use kernel fence for gfx ib test

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
9 years agodrm/amdgpu: use kernel fence in amdgpu_test
Chunming Zhou [Mon, 3 Aug 2015 08:19:29 +0000 (16:19 +0800)]
drm/amdgpu: use kernel fence in amdgpu_test

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
9 years agodrm/amdgpu: use kernel fence for vce ib test
Chunming Zhou [Mon, 3 Aug 2015 05:28:16 +0000 (13:28 +0800)]
drm/amdgpu: use kernel fence for vce ib test

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
9 years agodrm/amdgpu: change uvd ib test to use kernel fence directly
Chunming Zhou [Mon, 3 Aug 2015 05:11:04 +0000 (13:11 +0800)]
drm/amdgpu: change uvd ib test to use kernel fence directly

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
9 years agodrm/amdgpu: use kernel fence for last_pt_update
Chunming Zhou [Mon, 3 Aug 2015 10:19:38 +0000 (18:19 +0800)]
drm/amdgpu: use kernel fence for last_pt_update

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
9 years agodrm/amdgpu: use kernel fence diretly in amdgpu_bo_fence
Chunming Zhou [Mon, 3 Aug 2015 03:38:09 +0000 (11:38 +0800)]
drm/amdgpu: use kernel fence diretly in amdgpu_bo_fence

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
9 years agodrm/amdgpu: clean up amd sched wait_ts and wait_signal
Christian König [Fri, 31 Jul 2015 12:31:49 +0000 (14:31 +0200)]
drm/amdgpu: clean up amd sched wait_ts and wait_signal

Remove code not used at the moment.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: stop using addr to check for BO move v3
Christian König [Thu, 30 Jul 2015 09:53:42 +0000 (11:53 +0200)]
drm/amdgpu: stop using addr to check for BO move v3

It is theoretically possible that a swapped out BO gets the
same GTT address, but different backing pages while being swapped in.

Instead just use another VA state to note updated areas.
Ported from not upstream yet radeon commit with the same name.

v2: fix some bugs in the original implementation found in the radeon code.
v3: squash in VCE/UVD fix

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: move wait_queue_head from adev to ring (v2)
monk.liu [Thu, 30 Jul 2015 10:28:12 +0000 (18:28 +0800)]
drm/amdgpu: move wait_queue_head from adev to ring (v2)

thus unnecessary wake up could be avoid between rings
v2:
move wait_queue_head to fence_drv from ring

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: re-implement fence_default_wait
monk.liu [Thu, 30 Jul 2015 10:26:18 +0000 (18:26 +0800)]
drm/amdgpu: re-implement fence_default_wait

use fence_wait_any to implement fence_default_wait

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: new implement for fence_wait_any (v2)
monk.liu [Thu, 30 Jul 2015 07:19:05 +0000 (15:19 +0800)]
drm/amdgpu: new implement for fence_wait_any (v2)

origninal method will sleep/schedule at the granurarity of HZ/2 and
based on seq signal method, the new implement is based on kernel fance
interface, no unnecessary schedule at all

v2: replace logic of original amdgpu_fence_wait_any

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: use kernel fence interface when possible
monk.liu [Thu, 30 Jul 2015 06:56:18 +0000 (14:56 +0800)]
drm/amdgpu: use kernel fence interface when possible

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: use scheduler for VCE ib test
Chunming Zhou [Fri, 3 Jul 2015 06:18:26 +0000 (14:18 +0800)]
drm/amdgpu: use scheduler for VCE ib test

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
9 years agodrm/amdgpu: use scheduler for UVD ib test
Chunming Zhou [Fri, 3 Jul 2015 06:08:18 +0000 (14:08 +0800)]
drm/amdgpu: use scheduler for UVD ib test

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
9 years agodrm/amdgpu: use gpu scheduler for sdma ib test
Chunming Zhou [Mon, 1 Jun 2015 07:33:20 +0000 (15:33 +0800)]
drm/amdgpu: use gpu scheduler for sdma ib test

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
9 years agodrm/amdgpu: Use gpu scheduler for gfx ring ib test
Chunming Zhou [Mon, 1 Jun 2015 07:16:03 +0000 (15:16 +0800)]
drm/amdgpu: Use gpu scheduler for gfx ring ib test

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
9 years agodrm/amdgpu: add helper function for kernel submission
Chunming Zhou [Wed, 29 Jul 2015 02:33:14 +0000 (10:33 +0800)]
drm/amdgpu: add helper function for kernel submission

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
9 years agodrm/amdgpu: fix seq in ctx_add_fence
Chunming Zhou [Thu, 30 Jul 2015 09:59:43 +0000 (17:59 +0800)]
drm/amdgpu: fix seq in ctx_add_fence

if enabling scheduler, then the queued seq is assigned
when pushing job before emitting job.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
9 years agodrm/amdgpu: wait forever for wait emit
Chunming Zhou [Tue, 28 Jul 2015 09:31:04 +0000 (17:31 +0800)]
drm/amdgpu: wait forever for wait emit

the job must be emitted by scheduler, otherwise scheduler is abnormal.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
9 years agodrm/amdgpu: add amdgpu.sched_hw_submission option
Jammy Zhou [Thu, 30 Jul 2015 08:44:05 +0000 (16:44 +0800)]
drm/amdgpu: add amdgpu.sched_hw_submission option

This option can be used to specify the max number of submissions in the
active HW queue. The default value is 2 now.

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: add amdgpu.sched_jobs option
Jammy Zhou [Thu, 30 Jul 2015 08:36:58 +0000 (16:36 +0800)]
drm/amdgpu: add amdgpu.sched_jobs option

This option can be used to specify the max job number in the job queue,
and it is 16 by default.

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: silent the message for GPU scheduler creation
Jammy Zhou [Thu, 30 Jul 2015 08:24:53 +0000 (16:24 +0800)]
drm/amdgpu: silent the message for GPU scheduler creation

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: fix syncing to VM updates
Christian König [Mon, 27 Jul 2015 13:40:35 +0000 (15:40 +0200)]
drm/amdgpu: fix syncing to VM updates

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: add check for callback
Chunming Zhou [Tue, 28 Jul 2015 08:11:52 +0000 (16:11 +0800)]
drm/amdgpu: add check for callback

it is possible that the callback isn't defined sometimes.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
9 years agodrm/amdgpu: add enable_scheduler module option
Jammy Zhou [Wed, 27 May 2015 10:23:34 +0000 (18:23 +0800)]
drm/amdgpu: add enable_scheduler module option

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>
9 years agodrm/amdgpu: protect fence_process from multiple context
Chunming Zhou [Fri, 24 Jul 2015 02:49:47 +0000 (10:49 +0800)]
drm/amdgpu: protect fence_process from multiple context

fence_process may be called from kthread, user thread and interrupt context.
it is possible to called concurrently, then will wake up fence queue multiple times.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: add sched isr to fence process
Chunming Zhou [Tue, 21 Jul 2015 09:43:41 +0000 (17:43 +0800)]
drm/amdgpu: add sched isr to fence process

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: dispatch job for vm
Chunming Zhou [Tue, 21 Jul 2015 08:52:10 +0000 (16:52 +0800)]
drm/amdgpu: dispatch job for vm

use kernel context to submit command for vm

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: add kernel ctx support (v2)
Chunming Zhou [Mon, 6 Jul 2015 05:42:58 +0000 (13:42 +0800)]
drm/amdgpu: add kernel ctx support (v2)

v2: rebase against kfd changes

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: prepare job before push to sw queue for pte ring
Chunming Zhou [Tue, 21 Jul 2015 08:04:39 +0000 (16:04 +0800)]
drm/amdgpu: prepare job before push to sw queue for pte ring

user mode will still use pte ring as a normal ring.
if the prepare job generates another command(update pte) on its ring in scheduler,
then will kill scheduler which is going to waiting later job but pending running job.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: make sure the fence is emitted before ring to get it.
Chunming Zhou [Tue, 21 Jul 2015 07:53:04 +0000 (15:53 +0800)]
drm/amdgpu: make sure the fence is emitted before ring to get it.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: use scheduler user seq instead of previous user seq
Chunming Zhou [Tue, 21 Jul 2015 07:13:53 +0000 (15:13 +0800)]
drm/amdgpu: use scheduler user seq instead of previous user seq

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: dispatch jobs in cs
Chunming Zhou [Tue, 21 Jul 2015 06:36:51 +0000 (14:36 +0800)]
drm/amdgpu: dispatch jobs in cs

BO validation is moved to scheduler except usrptr which must be validated
in user process

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: add bo list copy
Chunming Zhou [Tue, 21 Jul 2015 05:47:05 +0000 (13:47 +0800)]
drm/amdgpu: add bo list copy

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: add backend implementation of gpu scheduler (v2)
Chunming Zhou [Tue, 21 Jul 2015 05:45:14 +0000 (13:45 +0800)]
drm/amdgpu: add backend implementation of gpu scheduler (v2)

v2: fix rebase breakage

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: disable hw semaphore with scheduler
Chunming Zhou [Tue, 21 Jul 2015 05:19:45 +0000 (13:19 +0800)]
drm/amdgpu: disable hw semaphore with scheduler

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: add context entity init
Chunming Zhou [Tue, 21 Jul 2015 05:17:19 +0000 (13:17 +0800)]
drm/amdgpu: add context entity init

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Christian K?nig <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: add scheduler initialization
Alex Deucher [Mon, 17 Aug 2015 02:55:02 +0000 (22:55 -0400)]
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>
9 years agodrm/amd: add basic scheduling framework
Jammy Zhou [Fri, 22 May 2015 10:55:07 +0000 (18:55 +0800)]
drm/amd: add basic scheduling framework

run queue:
A set of entities scheduling commands for the same ring. It
implements the scheduling policy that selects the next entity to
emit commands from.

entity:
A scheduler entity is a wrapper around a job queue or a group of
other entities. This can be used to build hierarchies of entities.
For example all job queue entities belonging to the same process
may be placed in a higher level entity and scheduled against other
process entities.
Entities take turns emitting jobs from their job queue to the
corresponding hardware ring, in accordance with the scheduler policy.

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
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>
9 years agodrm/amdgpu: Enable the Fiji DID 0x7300 support
David Zhang [Sat, 11 Jul 2015 15:13:40 +0000 (23:13 +0800)]
drm/amdgpu: Enable the Fiji DID 0x7300 support

Signed-off-by: David Zhang <david1.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: remove VM workaround for Fiji
Alex Deucher [Thu, 6 Aug 2015 15:51:23 +0000 (11:51 -0400)]
drm/amdgpu: remove VM workaround for Fiji

The bug is fixed in fiji.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: add support for VCE 3.x on Fiji
Alex Deucher [Mon, 27 Jul 2015 18:24:14 +0000 (14:24 -0400)]
drm/amdgpu: add support for VCE 3.x on Fiji

VCE on fiji is single pipe only.

Reviewed-by: David Zhang <david1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: Add Fiji support to the UVD 6.0 IP module
David Zhang [Wed, 8 Jul 2015 09:32:15 +0000 (17:32 +0800)]
drm/amdgpu: Add Fiji support to the UVD 6.0 IP module

Signed-off-by: David Zhang <david1.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: Add Fiji support to the SDMA 3.0 IP module
David Zhang [Wed, 8 Jul 2015 09:29:27 +0000 (17:29 +0800)]
drm/amdgpu: Add Fiji support to the SDMA 3.0 IP module

Signed-off-by: David Zhang <david1.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: Add Fiji support to the GFX 8.0 IP module (v2)
David Zhang [Thu, 30 Jul 2015 23:42:11 +0000 (19:42 -0400)]
drm/amdgpu: Add Fiji support to the GFX 8.0 IP module (v2)

v2: agd5f: fix the rb setup.

Signed-off-by: David Zhang <david1.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: Add Fiji support to the DCE 10.0 IP module (v2)
David Zhang [Tue, 7 Jul 2015 17:28:20 +0000 (01:28 +0800)]
drm/amdgpu: Add Fiji support to the DCE 10.0 IP module (v2)

v2: agd5f: fix up XDMA golden settings

Signed-off-by: David Zhang <david1.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: Add Fiji support to SMC and DPM (v2)
David Zhang [Tue, 7 Jul 2015 17:23:25 +0000 (01:23 +0800)]
drm/amdgpu: Add Fiji support to SMC and DPM (v2)

v2: agd5f: prepare for release

Signed-off-by: David Zhang <david1.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: Add Fiji smu 7.1.3 headers (v2)
David Zhang [Wed, 8 Jul 2015 11:13:25 +0000 (19:13 +0800)]
drm/amdgpu: Add Fiji smu 7.1.3 headers (v2)

v2: agd5f: prepare for release

Signed-off-by: David Zhang <david1.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: Add Fiji support to IH module
David Zhang [Wed, 8 Jul 2015 13:40:31 +0000 (21:40 +0800)]
drm/amdgpu: Add Fiji support to IH module

Signed-off-by: David Zhang <david1.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: Add Fiji support to the GMC 8.5 IP module
David Zhang [Tue, 7 Jul 2015 17:11:52 +0000 (01:11 +0800)]
drm/amdgpu: Add Fiji support to the GMC 8.5 IP module

Signed-off-by: David Zhang <david1.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: Add Fiji DID 0x7300 common support
David Zhang [Tue, 7 Jul 2015 17:05:16 +0000 (01:05 +0800)]
drm/amdgpu: Add Fiji DID 0x7300 common support

Signed-off-by: David Zhang <david1.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: handle conditional support for CIK properly
Alex Deucher [Fri, 31 Jul 2015 21:20:14 +0000 (17:20 -0400)]
drm/amdgpu: handle conditional support for CIK properly

gfx7 support is not necessary or available if CIK support
is not enabled.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: optimize amdgpu_parser_init
monk.liu [Fri, 17 Jul 2015 10:39:25 +0000 (18:39 +0800)]
drm/amdgpu: optimize amdgpu_parser_init

use kmalloc_array instead of kcalloc where appropriate and other
cleanups.

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: merge amdgpu_family.h into amd_shared.h (v2)
Jammy Zhou [Wed, 22 Jul 2015 03:29:01 +0000 (11:29 +0800)]
drm/amdgpu: merge amdgpu_family.h into amd_shared.h (v2)

Make the definitions common for all driver components

v2: fix kfd

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: add some pptable definitions
Jammy Zhou [Tue, 21 Jul 2015 13:17:16 +0000 (21:17 +0800)]
drm/amdgpu: add some pptable definitions

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: add some common definitions to amd_shared.h
Jammy Zhou [Tue, 21 Jul 2015 09:41:48 +0000 (17:41 +0800)]
drm/amdgpu: add some common definitions to amd_shared.h

Add GPU family definitions and timeout value for IP components.

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: allow userspace to read more debug registers
Marek Olšák [Sat, 11 Jul 2015 10:08:46 +0000 (12:08 +0200)]
drm/amdgpu: allow userspace to read more debug registers

Feel free to suggest more.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: move some atombios definitions to common folder (v2)
Alex Deucher [Mon, 17 Aug 2015 02:51:50 +0000 (22:51 -0400)]
drm/amdgpu: move some atombios definitions to common folder (v2)

the definitions can be shared by different IP components.

v2: fix include path

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: fix UVD/VCE fence handling
Christian König [Tue, 21 Jul 2015 16:02:21 +0000 (18:02 +0200)]
drm/amdgpu: fix UVD/VCE fence handling

We need to return the sequence number to userspace
even when we don't use user fences.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: add fence suspend/resume functions
Alex Deucher [Wed, 5 Aug 2015 16:41:48 +0000 (12:41 -0400)]
drm/amdgpu: add fence suspend/resume functions

Added to:
- handle draining the ring on suspend
- properly enable/disable interrupts on suspend and resume

Fix breakages from:
commit 467ee3be53d240d08beed2e82a941e820c1ac323
Author: Chunming Zhou <david1.zhou@amd.com>
Date:   Mon Jun 1 14:14:32 2015 +0800

    drm/amdgpu: always enable EOP interrupt v2

Tested-by: Audrey Grodzovsky <audrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: always enable EOP interrupt v2
Chunming Zhou [Mon, 1 Jun 2015 06:14:32 +0000 (14:14 +0800)]
drm/amdgpu: always enable EOP interrupt v2

v2 (chk): always enable EOP interrupt, independent of scheduler,
  remove now unused delayed_irq handling.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: rework vm_grab_id interface
Christian König [Mon, 20 Jul 2015 14:09:40 +0000 (16:09 +0200)]
drm/amdgpu: rework vm_grab_id interface

This makes assigning VM IDs independent from the use of VM IDs.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: no updates shouldn't cause vm flush v2
Christian König [Mon, 20 Jul 2015 13:47:30 +0000 (15:47 +0200)]
drm/amdgpu: no updates shouldn't cause vm flush v2

v2 (chk): split fix from original patch

Signed-off-by: monk.liu <monk.liu@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: fix signed overrun in amdgpu_ctx_get_fence
Christian König [Sat, 18 Jul 2015 17:20:05 +0000 (19:20 +0200)]
drm/amdgpu: fix signed overrun in amdgpu_ctx_get_fence

Otherwise the first 16 fences of a context will always signal immediately.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: fix context memory leak
Christian König [Thu, 16 Jul 2015 10:01:06 +0000 (12:01 +0200)]
drm/amdgpu: fix context memory leak

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: remove amdgpu_fence_recreate
Christian König [Tue, 7 Jul 2015 16:44:01 +0000 (18:44 +0200)]
drm/amdgpu: remove amdgpu_fence_recreate

It's not used any more.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: add user fence context map v2
Christian König [Tue, 7 Jul 2015 15:24:49 +0000 (17:24 +0200)]
drm/amdgpu: add user fence context map v2

This is a prerequisite for the GPU scheduler to make the order
of submission independent from the order of execution.

v2: properly implement the locking

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: deal with foreign fences in amdgpu_sync
Christian König [Mon, 6 Jul 2015 20:06:40 +0000 (22:06 +0200)]
drm/amdgpu: deal with foreign fences in amdgpu_sync

This also requires some error handling from the callers of that function.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: cleanup context structure v2
Alex Deucher [Mon, 17 Aug 2015 02:48:26 +0000 (22:48 -0400)]
drm/amdgpu: cleanup context structure v2

The comment is misleading and incorrect, remove it.

Printing the id is completely meaningless and this practice
can cause a race conditions on command submission.

The flags and hangs fields are completely unused.

Give all fields a common indentation.

v2: remove fpriv reference and unused flags as well, fix debug message.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
9 years agodrm/amdgpu: add cgs_interface for pg and cg
rezhu [Fri, 7 Aug 2015 05:37:56 +0000 (13:37 +0800)]
drm/amdgpu: add cgs_interface for pg and cg

v3: check whether ip_blocks is enable
v2: add break in the for loop.

Signed-off-by: Rex zhu <rezhu@amd.com>
9 years agodrm/amdgpu: fix some typo for cgs definitions
Jammy Zhou [Tue, 21 Jul 2015 09:02:44 +0000 (17:02 +0800)]
drm/amdgpu: fix some typo for cgs definitions

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: add cgs_get_firmware_info interface v2
Jammy Zhou [Wed, 13 May 2015 10:58:05 +0000 (18:58 +0800)]
drm/amdgpu: add cgs_get_firmware_info interface v2

This new interface can be used by IP components to retrieve the
firmware information from the core driver.

v2: fix one typo

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhou@amd.com>
Signed-off-by: Young Yang <Young.Yang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: implement cgs gpu memory callbacks
Chunming Zhou [Fri, 24 Apr 2015 09:38:20 +0000 (17:38 +0800)]
drm/amdgpu: implement cgs gpu memory callbacks

This implements the cgs interface for allocating
GPU memory.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: add atom interfaces for CGS
Chunming Zhou [Fri, 22 May 2015 16:14:04 +0000 (12:14 -0400)]
drm/amdgpu: add atom interfaces for CGS

This implements the interface for atombios command
and data table access.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>