[PATCH 3/4] drm/amdgpu:protect cs submit

2017-03-07 Thread Monk Liu
to prevent submit two or more IBs with PREEMPT flags. Change-Id: Icdac89ddc525436905b3544635fd8cfd9146cdfd Signed-off-by: Monk Liu --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

[PATCH 4/4] drm/amdgpu:enable MCBP for SR-IOV

2017-03-07 Thread Monk Liu
Change-Id: I779abc6a47593be0ff5234c3e2f2cdfd25ba70ca Signed-off-by: Monk Liu --- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 8dba5ff..be49c30 100644 --- a/drivers

[PATCH 2/4] uapi/drm:add new flag for Preemption

2017-03-07 Thread Monk Liu
when MCBP supported, we will set pre_enb bit for those IBs with PREEMPT flag tagged Change-Id: I753a850e6acdce56e22f873bc7fee8874c5a1a12 Signed-off-by: Monk Liu --- include/uapi/drm/amdgpu_drm.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/d

[PATCH 1/4] uapi/drm:change Preamble Description

2017-03-07 Thread Monk Liu
Preamble in linux doesn't mean it is CE PREAMBLE IB, instead it means this IB could be dropped if no ctx switch happens. Change-Id: I2a1e567bccc8abb6d9ce117d3f2eb93dfd649fa1 Signed-off-by: Monk Liu --- include/uapi/drm/amdgpu_drm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --gi

Re: [PATCH 4/5] drm/radeon: Don't register Thunderbolt eGPU with vga_switcheroo

2017-03-07 Thread Lukas Wunner
On Tue, Mar 07, 2017 at 03:30:30PM -0500, Alex Deucher wrote: > On Fri, Feb 24, 2017 at 2:19 PM, Lukas Wunner wrote: > > An external Thunderbolt GPU can neither drive the laptop's panel nor be > > powered off by the platform, so there's no point in registering it with > > vga_switcheroo. In fact,

Re: Add support for high priority scheduling in amdgpu v6

2017-03-07 Thread Andres Rodriguez
Forgot to mention, lockdep was clean with the following options enabled: [*] Spinlock and rw-lock debugging: basic checks [*] Mutex debugging: basic checks [*] Sleep inside atomic section checking Regards, Andres On 2017-03-07 06:50 PM, Andres Rodriguez wrote: Updated with Christian and Alex's

[PATCH 18/22] drm/amdgpu: add framework for HW specific priority settings v6

2017-03-07 Thread Andres Rodriguez
Add an initial framework for changing the HW priorities of rings. The framework allows requesting priority changes for the lifetime of an amdgpu_job. After the job completes the priority will decay to the next lowest priority for which a request is still valid. A new ring function set_priority() c

[PATCH 16/22] drm/amdgpu: implement lru amdgpu_queue_mgr policy for compute v4

2017-03-07 Thread Andres Rodriguez
Use an LRU policy to map usermode rings to HW compute queues. Most compute clients use one queue, and usually the first queue available. This results in poor pipe/queue work distribution when multiple compute apps are running. In most cases pipe 0 queue 0 is the only queue that gets used. In orde

[PATCH 21/22] drm/amdgpu: condense mqd programming sequence

2017-03-07 Thread Andres Rodriguez
The MQD structure matches the reg layout. Take advantage of this to simplify HQD programming. Note that the ACTIVE field still needs to be programmed last. Suggested-by: Felix Kuehling Signed-off-by: Andres Rodriguez --- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 44 +-- drivers/g

[PATCH 15/22] drm/amdgpu: untie user ring ids from kernel ring ids v4

2017-03-07 Thread Andres Rodriguez
Add amdgpu_queue_mgr, a mechanism that allows disjointing usermode's ring ids from the kernel's ring ids. The queue manager maintains a per-file descriptor map of user ring ids to amdgpu_ring pointers. Once a map is created it is permanent (this is required to maintain FIFO execution guarantees fo

[PATCH 17/22] drm/amdgpu: add parameter to allocate high priority contexts v7

2017-03-07 Thread Andres Rodriguez
Add a new context creation parameter to express a global context priority. Contexts allocated with AMDGPU_CTX_PRIORITY_HIGH will receive higher priority to schedule their work than AMDGPU_CTX_PRIORITY_NORMAL (default) contexts. v2: Instead of using flags, repurpose __pad v3: Swap enum values of _

[PATCH 20/22] drm/amdgpu: implement ring set_priority for gfx_v8 compute v5

2017-03-07 Thread Andres Rodriguez
Programming CP_HQD_QUEUE_PRIORITY enables a queue to take priority over other queues on the same pipe. Multiple queues on a pipe are timesliced so this gives us full precedence over other queues. Programming CP_HQD_PIPE_PRIORITY changes the SPI_ARB_PRIORITY of the wave as follows: 0x2: CS_

[PATCH 22/22] drm/amdgpu: workaround tonga HW bug in HQD programming sequence

2017-03-07 Thread Andres Rodriguez
Tonga based asics may experience hangs when an HQD's EOP parameters are modified. Workaround this HW issue by avoiding writes to these registers for tonga asics. Based on the following ROCm commit: 2a0fb8 - drm/amdgpu: Synchronize KFD HQD load protocol with CP scheduler From the ROCm git reposit

[PATCH 19/22] drm/amdgpu: convert srbm lock to a spinlock

2017-03-07 Thread Andres Rodriguez
Replace adev->srbm_mutex with a spinlock adev->srbm_lock Signed-off-by: Andres Rodriguez --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c | 4 ++-- drivers/gpu/drm/amd/am

[PATCH 07/22] drm/amdgpu: take ownership of per-pipe configuration

2017-03-07 Thread Andres Rodriguez
Make amdgpu the owner of all per-pipe state of the HQDs. This change will allow us to split the queues between kfd and amdgpu with a queue granularity instead of pipe granularity. This patch fixes kfd allocating an HDP_EOP region for its 3 pipes which goes unused. Reviewed-by: Edward O'Callaghan

[PATCH 05/22] drm/amdgpu: unify MQD programming sequence for kfd and amdgpu

2017-03-07 Thread Andres Rodriguez
Use the same gfx_*_mqd_commit function for kfd and amdgpu codepaths. This removes the last duplicates of this programming sequence. Reviewed-by: Edward O'Callaghan Acked-by: Christian König Signed-off-by: Andres Rodriguez --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 51 ++--

[PATCH 12/22] drm/amdgpu: remove duplicate magic constants from amdgpu_amdkfd_gfx*.c

2017-03-07 Thread Andres Rodriguez
This information is already available in adev. Reviewed-by: Edward O'Callaghan Acked-by: Christian König Signed-off-by: Andres Rodriguez --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 12 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c | 12 ++-- 2 files changed

[PATCH 10/22] drm/amdgpu: teach amdgpu how to enable interrupts for any pipe

2017-03-07 Thread Andres Rodriguez
The current implementation is hardcoded to enable ME1/PIPE0 interrupts only. This patch allows amdgpu to enable interrupts for any pipe of ME1. Signed-off-by: Andres Rodriguez --- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 48 +-- drivers/gpu/drm/amd/amdgpu/gfx_v8_0

[PATCH 11/22] drm/amdkfd: allow split HQD on per-queue granularity v4

2017-03-07 Thread Andres Rodriguez
Update the KGD to KFD interface to allow sharing pipes with queue granularity instead of pipe granularity. This allows for more interesting pipe/queue splits. v2: fix overflow check for res.queue_mask v3: fix shift overflow when setting res.queue_mask v4: fix comment in is_pipeline_enabled() Rev

[PATCH 14/22] drm/amdgpu: new queue policy, take first 2 queues of each pipe

2017-03-07 Thread Andres Rodriguez
Instead of taking the first pipe and giving the rest to kfd, take the first 2 queues of each pipe. Effectively, amdgpu and amdkfd own the same number of queues. But because the queues are spread over multiple pipes the hardware will be able to better handle concurrent compute workloads. amdgpu go

[PATCH 13/22] drm/amdgpu: allocate queues horizontally across pipes

2017-03-07 Thread Andres Rodriguez
Pipes provide better concurrency than queues, therefore we want to make sure that apps use queues from different pipes whenever possible. Optimize for the trivial case where an app will consume rings in order, therefore we don't want adjacent rings to belong to the same pipe. Reviewed-by: Edward

[PATCH 02/22] drm/amdgpu: doorbell registers need only be set once v2

2017-03-07 Thread Andres Rodriguez
The CP_MEC_DOORBELL_RANGE_* and CP_PQ_STATUS.DOORBELL_ENABLE registers are not HQD specific. They only need to be set once if at least 1 pipe requested doorbell support. v2: move doorbell_enable to amdgpu_gfx instead of amdgpu_device Reviewed-by: Edward O'Callaghan Acked-by: Christian König Si

[PATCH 06/22] drm/amdgpu: rename rdev to adev

2017-03-07 Thread Andres Rodriguez
Rename straggler instances of r(adeon)dev to a(mdgpu)dev Reviewed-by: Edward O'Callaghan Acked-by: Christian König Signed-off-by: Andres Rodriguez --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 70 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 14 +++--- drivers

[PATCH 04/22] drm/amdgpu: remove duplicate definition of cik_mqd

2017-03-07 Thread Andres Rodriguez
The gfxv7 contains a slightly different version of cik_mqd called bonaire_mqd. This can introduce subtle bugs if fixes are not applied in both places. Reviewed-by: Edward O'Callaghan Acked-by: Christian König Signed-off-by: Andres Rodriguez --- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 135 +

[PATCH 08/22] drm/radeon: take ownership of pipe initialization

2017-03-07 Thread Andres Rodriguez
Take ownership of pipe initialization away from KFD. Note that hpd_eop_gpu_addr was already large enough to accomodate all pipes. Reviewed-by: Edward O'Callaghan Acked-by: Christian König Signed-off-by: Andres Rodriguez --- drivers/gpu/drm/radeon/cik.c| 27 ++-

[PATCH 01/22] drm/amdgpu: refactor MQD/HQD initialization

2017-03-07 Thread Andres Rodriguez
The MQD programming sequence currently exists in 3 different places. Refactor it to absorb all the duplicates. The success path remains mostly identical except for a slightly different order in the non-kiq case. This shouldn't matter if the HQD is disabled. The error handling paths have been upda

[PATCH 03/22] drm/amdgpu: detect timeout error when deactivating hqd

2017-03-07 Thread Andres Rodriguez
Handle HQD deactivation timeouts instead of ignoring them. Reviewed-by: Edward O'Callaghan Acked-by: Christian König Signed-off-by: Andres Rodriguez --- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/gpu

[PATCH 09/22] drm/amdgpu: allow split of queues with kfd at queue granularity

2017-03-07 Thread Andres Rodriguez
Previously the queue/pipe split with kfd operated with pipe granularity. This patch allows amdgpu to take ownership of an arbitrary set of queues. It also consolidates the last few magic numbers in the compute initialization process into mec_init. Reviewed-by: Edward O'Callaghan Acked-by: Christ

Add support for high priority scheduling in amdgpu v6

2017-03-07 Thread Andres Rodriguez
Updated with Christian and Alex's feedback. Also added missing initialization of ring->num_jobs[] to PATCH 18 Added a new patch: [PATCH 19/22] drm/amdgpu: convert srbm lock to a spinlock Also some new benchmarks for the high priority queue using a modified computeparticles that only takes 0.2ms

Re: [PATCH 4/5] drm/radeon: Don't register Thunderbolt eGPU with vga_switcheroo

2017-03-07 Thread Alex Deucher
On Fri, Feb 24, 2017 at 2:19 PM, Lukas Wunner wrote: > An external Thunderbolt GPU can neither drive the laptop's panel nor be > powered off by the platform, so there's no point in registering it with > vga_switcheroo. In fact, when the external GPU is runtime suspended, > vga_switcheroo will cut

Re: [PATCH 18/21] drm/amdgpu: add framework for HW specific priority settings v4

2017-03-07 Thread Andres Rodriguez
On 2017-03-07 06:00 AM, Christian König wrote: Am 07.03.2017 um 02:10 schrieb Andres Rodriguez: Add an initial framework for changing the HW priorities of rings. The framework allows requesting priority changes for the lifetime of an amdgpu_job. After the job completes the priority will decay

Re: [PATCH 18/21] drm/amdgpu: add framework for HW specific priority settings v4

2017-03-07 Thread Christian König
Am 07.03.2017 um 17:57 schrieb Alex Deucher: On Tue, Mar 7, 2017 at 11:25 AM, Andres Rodriguez wrote: On 2017-03-07 10:19 AM, Deucher, Alexander wrote: -Original Message- From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf Of Christian König Sent: Tuesday, March 07,

Re: [PATCH 18/21] drm/amdgpu: add framework for HW specific priority settings v4

2017-03-07 Thread Alex Deucher
On Tue, Mar 7, 2017 at 11:25 AM, Andres Rodriguez wrote: > > > On 2017-03-07 10:19 AM, Deucher, Alexander wrote: >>> >>> -Original Message- >>> From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf >>> Of Christian König >>> Sent: Tuesday, March 07, 2017 6:00 AM >>> To: An

Re: [PATCH 18/21] drm/amdgpu: add framework for HW specific priority settings v4

2017-03-07 Thread Andres Rodriguez
On 2017-03-07 10:19 AM, Deucher, Alexander wrote: -Original Message- From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf Of Christian König Sent: Tuesday, March 07, 2017 6:00 AM To: Andres Rodriguez; amd-gfx@lists.freedesktop.org Subject: Re: [PATCH 18/21] drm/amdgpu:

Re: [PATCH 15/21] drm/amdgpu: untie user ring ids from kernel ring ids v3

2017-03-07 Thread Andres Rodriguez
On 2017-03-07 05:31 AM, Christian König wrote: Am 07.03.2017 um 02:10 schrieb Andres Rodriguez: Add amdgpu_queue_mgr, a mechanism that allows disjointing usermode's ring ids from the kernel's ring ids. The queue manager maintains a per-file descriptor map of user ring ids to amdgpu_ring point

RE: [PATCH 18/21] drm/amdgpu: add framework for HW specific priority settings v4

2017-03-07 Thread Deucher, Alexander
> -Original Message- > From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf > Of Christian König > Sent: Tuesday, March 07, 2017 6:00 AM > To: Andres Rodriguez; amd-gfx@lists.freedesktop.org > Subject: Re: [PATCH 18/21] drm/amdgpu: add framework for HW specific > priority

Re: [PATCH 18/21] drm/amdgpu: add framework for HW specific priority settings v4

2017-03-07 Thread Christian König
Am 07.03.2017 um 02:10 schrieb Andres Rodriguez: Add an initial framework for changing the HW priorities of rings. The framework allows requesting priority changes for the lifetime of an amdgpu_job. After the job completes the priority will decay to the next lowest priority for which a request is

Re: [PATCH] Add support for high priority scheduling in amdgpu v5

2017-03-07 Thread Christian König
Patches #10 and #16 are Reviewed-by: Christian König . Patches #20 and #21 are Acked-by: Christian König . Give me a second to go through patch #18 once more, but apart from that the series is ready to land if Felix and Alex don't have more comments. Regards, Christian. Am 07.03.2017 um 0

Re: [PATCH 15/21] drm/amdgpu: untie user ring ids from kernel ring ids v3

2017-03-07 Thread Christian König
Am 07.03.2017 um 02:10 schrieb Andres Rodriguez: Add amdgpu_queue_mgr, a mechanism that allows disjointing usermode's ring ids from the kernel's ring ids. The queue manager maintains a per-file descriptor map of user ring ids to amdgpu_ring pointers. Once a map is created it is permanent (this i