platform/kernel/linux-starfive.git
7 years agodrm/amdgpu: add 64bit wb functions
Ken Wang [Fri, 18 Mar 2016 07:08:49 +0000 (15:08 +0800)]
drm/amdgpu: add 64bit wb functions

Newer asics need 64 bit writeback slots.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: change wptr to 64 bits (v2)
Ken Wang [Sat, 12 Mar 2016 01:32:30 +0000 (09:32 +0800)]
drm/amdgpu: change wptr to 64 bits (v2)

Newer asics need 64 bit wptrs.  If the wptr is now
smaller than the rptr that doesn't indicate a wrap-around
anymore.

v2: integrate Christian's comments.

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: init aperture definitions (v2)
Junwei Zhang [Thu, 10 Mar 2016 06:20:39 +0000 (14:20 +0800)]
drm/amdgpu: init aperture definitions (v2)

v2: agd: move apertures to mc structure

Signed-off-by: Flora Cui <Flora.Cui@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: Merge pre/postclose hooks
Daniel Vetter [Wed, 8 Mar 2017 14:12:52 +0000 (15:12 +0100)]
drm/amdgpu: Merge pre/postclose hooks

Again no apparent explanation for the split except hysterical raisins.
Merging them also makes it a bit more obviuos what's going on wrt the
runtime pm refdancing.

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/radeon: Merge pre/postclose hooks
Daniel Vetter [Wed, 8 Mar 2017 14:12:48 +0000 (15:12 +0100)]
drm/radeon: Merge pre/postclose hooks

Again no apparent explanation for the split except hysterical raisins.
Merging them also makes it a bit more obviuos what's going on wrt the
runtime pm refdancing.

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: trace fence details in amdgpu_sched_run_job
Andres Rodriguez [Fri, 24 Feb 2017 18:20:58 +0000 (13:20 -0500)]
drm/amdgpu: trace fence details in amdgpu_sched_run_job

This information is intended to provide the required data to associate
amdgpu tracepoints with their corresponding dma_fence_* events.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: make trace format uniform csv name=value
Andres Rodriguez [Fri, 24 Feb 2017 18:20:57 +0000 (13:20 -0500)]
drm/amdgpu: make trace format uniform csv name=value

Most of the traces have uniform format except for two of them. Having
all the traces match makes it simple to run awk on the ftrace output.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/gfx8: move CE&DE meta data structure to vi_structs.h
Xiangliang Yu [Mon, 6 Mar 2017 07:27:51 +0000 (15:27 +0800)]
drm/amdgpu/gfx8: move CE&DE meta data structure to vi_structs.h

Because different HWs have different definition for CE & DE meta
data, follow mqd design to move the structures to vi_structs.h.

And change the prefix from amdgpu to vi as the structures is only
for VI family.

Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: add DID for Polaris10
Junshan Fang [Thu, 19 Jan 2017 02:36:18 +0000 (10:36 +0800)]
drm/amd/amdgpu: add DID for Polaris10

Signed-off-by: Junshan Fang <Junshan.Fang@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add polaris12 to virtual dce handling
Alex Deucher [Fri, 3 Mar 2017 17:57:37 +0000 (12:57 -0500)]
drm/amdgpu: add polaris12 to virtual dce handling

Was missed when polaris12 support was added.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: remove unused sync testing
Christian König [Tue, 15 Nov 2016 13:15:28 +0000 (08:15 -0500)]
drm/amdgpu: remove unused sync testing

Not used in a while.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: simplify avfs control code in smu7
Eric Huang [Wed, 1 Mar 2017 21:49:06 +0000 (16:49 -0500)]
drm/amd/powerplay: simplify avfs control code in smu7

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add function avfs control in smu7
Eric Huang [Wed, 1 Mar 2017 20:56:17 +0000 (15:56 -0500)]
drm/amd/powerplay: add function avfs control in smu7

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add voltage change support through pp_table
Eric Huang [Wed, 1 Mar 2017 20:49:31 +0000 (15:49 -0500)]
drm/amd/powerplay: add voltage change support through pp_table

Disable avfs to make voltage change take effect.

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/radeon: remove useless and potentially wrong message
Andy Shevchenko [Thu, 1 Dec 2016 01:21:10 +0000 (03:21 +0200)]
drm/radeon: remove useless and potentially wrong message

There is no need to repeat information that printed by PCI core at boot time.

Besides that printing was potentially wrong since resource_size_t might be
bigger than 32 bits and there is a dedicated specifier for such type, i.e.
%pap. Someone can fix it and use even better approach, i.e. %pR.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: print full bios version in dmesg.
Rex Zhu [Mon, 6 Mar 2017 03:33:25 +0000 (11:33 +0800)]
drm/amdgpu: print full bios version in dmesg.

v2: fix merge error.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Xiaojie Yuan <Xiaojie.Yuan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: disable HDP flushes on APUs
Christian König [Fri, 17 Feb 2017 14:04:31 +0000 (15:04 +0100)]
drm/amdgpu: disable HDP flushes on APUs

We completely bypass the HDP now.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agogpu: drm: amd/radeon: Convert printk(KERN_<LEVEL> to pr_<level>
Joe Perches [Tue, 28 Feb 2017 12:55:52 +0000 (04:55 -0800)]
gpu: drm: amd/radeon: Convert printk(KERN_<LEVEL> to pr_<level>

Use a more common logging style.

Miscellanea:

o Coalesce formats and realign arguments
o Neaten a few macros now using pr_<level>

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm: Use pr_cont where appropriate
Joe Perches [Tue, 28 Feb 2017 01:31:03 +0000 (17:31 -0800)]
drm: Use pr_cont where appropriate

Using 'printk("\n")' is not preferred anymore and
using printk to continue logging messages now produces
multiple line logging output unless the continuations
use KERN_CONT.

Convert these uses to appropriately use pr_cont or a
single printk where possible.

Miscellanea:

o Use a temporary const char * instead of multiple printks
o Remove trailing space from logging by using a leading space instead

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: put gtt at 0 in the internal address space
Alex Deucher [Thu, 17 Nov 2016 20:40:22 +0000 (15:40 -0500)]
drm/amdgpu: put gtt at 0 in the internal address space

There still seem to be some blocks that make accesses
in the lower part of the address space.  This works around
this.

Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/vce2: fix vce bar programming
Alex Deucher [Fri, 17 Feb 2017 18:50:15 +0000 (13:50 -0500)]
drm/amdgpu/vce2: fix vce bar programming

Program the VCE BAR and offsets properly.  The current code
was carried over from a limitation from older VCE versions.

Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrivers/gpu: Convert remaining uses of pr_warning to pr_warn
Joe Perches [Fri, 17 Feb 2017 07:11:30 +0000 (23:11 -0800)]
drivers/gpu: Convert remaining uses of pr_warning to pr_warn

To enable eventual removal of pr_warning

This makes pr_warn use consistent for drivers/gpu

Prior to this patch, there were 15 uses of pr_warning and
20 uses of pr_warn in drivers/gpu

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd: Spelling s/SDMA_WRTIE_SUB_OPCODE_TILED/SDMA_WRITE_SUB_OPCODE_TILED/
Geert Uytterhoeven [Fri, 17 Feb 2017 15:36:38 +0000 (16:36 +0100)]
drm/amd: Spelling s/SDMA_WRTIE_SUB_OPCODE_TILED/SDMA_WRITE_SUB_OPCODE_TILED/

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: dri-devel@lists.freedesktop.orgamd-gfx@lists.freedesktop.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/radeon/dp_auxch: Ratelimit aux transfer debug messages
Lyude [Wed, 22 Feb 2017 21:34:53 +0000 (16:34 -0500)]
drm/radeon/dp_auxch: Ratelimit aux transfer debug messages

Aux transfers always fail with non-zero status flags when there's
nothing connected on the port, so we don't usually need to see all of
the debugging information from it. Also, we try reprobing a -lot-, so
without ratelimiting most of the kernel log is filled up with messages
from radeon_dp_aux_transfer_native.

Signed-off-by: Lyude <lyude@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/powerplay: enable LEDs on Fiji boards
Alex Deucher [Wed, 22 Feb 2017 16:20:17 +0000 (11:20 -0500)]
drm/amdgpu/powerplay: enable LEDs on Fiji boards

This enables the LEDs that light up based on DPM states
on some Fiji boards.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=97590

Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: rename amdgpu_gca_config to amdgpu_gfx_config
Junwei Zhang [Tue, 21 Feb 2017 02:32:37 +0000 (10:32 +0800)]
drm/amdgpu: rename amdgpu_gca_config to amdgpu_gfx_config

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: Fix module unload hang by KIQ IRQ set
Trigger Huang [Mon, 20 Feb 2017 02:57:39 +0000 (21:57 -0500)]
drm/amdgpu: Fix module unload hang by KIQ IRQ set

In some cases, manually insmod/rmmod amdgpu is necessary. When
unloading amdgpu, the KIQ IRQ enable/disable function will case
system hang. The root cause is, in the sequence of function
amdgpu_fini, the sw_fini of IP block AMD_IP_BLOCK_TYPE_GFX will be
invoked earlier than that of AMD_IP_BLOCK_TYPE_IH. So continue to use
the variable freed by AMD_IP_BLOCK_TYPE_GFX will cause system hang.

Signed-off-by: Trigger Huang <trigger.huang@amd.com>
Reviewed-by: Xiangliang Yu < Xiangliang.Yu@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: bump driver version for new lds buffer query
Alex Deucher [Wed, 8 Mar 2017 23:27:07 +0000 (18:27 -0500)]
drm/amdgpu: bump driver version for new lds buffer query

v2: agd: bump version

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: export gfx config double offchip LDS buffers (v3)
Junwei Zhang [Fri, 17 Feb 2017 03:05:49 +0000 (11:05 +0800)]
drm/amdgpu: export gfx config double offchip LDS buffers (v3)

v2: move the config struct to drm_amdgpu_info_device
v3: move the config feature to amdgpu_gca_config

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/gfx: free memory of mqd backup
Xiangliang Yu [Thu, 16 Feb 2017 07:20:04 +0000 (15:20 +0800)]
drm/amdgpu/gfx: free memory of mqd backup

Need to free mqd backup when destroying ring.

Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Monk Liu <Monk.Liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/virt: fix typo
Xiangliang Yu [Thu, 16 Feb 2017 07:07:06 +0000 (15:07 +0800)]
drm/amdgpu/virt: fix typo

When send messages to hypervior, the messages format should be is
idh_request, not idh_event.

Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Monk Liu <Monk.Liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: change pointer of mqd_ptr & mqd_backup to void
Xiangliang Yu [Fri, 17 Feb 2017 08:03:10 +0000 (16:03 +0800)]
drm/amdgpu: change pointer of mqd_ptr & mqd_backup to void

vi_mqd is only used by VI family but mqd_ptr and mqd_backup is
common for all ASIC, so change the pointer to void.

Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Monk Liu <Monk.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:fix kiq_resume routine (V2)
Monk Liu [Thu, 26 Jan 2017 07:36:37 +0000 (15:36 +0800)]
drm/amdgpu:fix kiq_resume routine (V2)

v2:
use in_rest to fix compute ring test failure issue
which occured after FLR/gpu_reset.

we need backup a clean status of MQD which was created in drv load
stage, and use it in resume stage, otherwise KCQ and KIQ all may
faild in ring/ib test.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:use clear_ring to clr RB
Monk Liu [Wed, 8 Feb 2017 08:51:06 +0000 (16:51 +0800)]
drm/amdgpu:use clear_ring to clr RB

In resume routine, we need clr RB prior to the
ring test of engine, otherwise some engine hang
duplicated during GPU reset.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:imple ring clear
Monk Liu [Wed, 8 Feb 2017 08:49:46 +0000 (16:49 +0800)]
drm/amdgpu:imple ring clear

we can use it clear ring buffer instead of fullfill
0, which is not correct for engine

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:alloc mqd backup
Monk Liu [Thu, 26 Jan 2017 07:33:52 +0000 (15:33 +0800)]
drm/amdgpu:alloc mqd backup

this is required for restoring the mqds after GPU reset.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:new field in_reset introduced for gfx
Monk Liu [Thu, 26 Jan 2017 07:32:16 +0000 (15:32 +0800)]
drm/amdgpu:new field in_reset introduced for gfx

use it to seperate driver load and gpu reset/resume
because gfx IP need different approach for different
hw_init trigger source

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:RUNTIME flag should clr later
Monk Liu [Thu, 26 Jan 2017 07:31:15 +0000 (15:31 +0800)]
drm/amdgpu:RUNTIME flag should clr later

this flag will get cleared by request gpu access

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:use work instead of delay-work
Monk Liu [Mon, 6 Feb 2017 05:56:47 +0000 (13:56 +0800)]
drm/amdgpu:use work instead of delay-work

no need to use a delay work since we don't know how
much time hypervisor takes on FLR, so just polling
and waiting in a work.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:no kiq for mailbox registers access
Monk Liu [Wed, 25 Jan 2017 08:49:32 +0000 (16:49 +0800)]
drm/amdgpu:no kiq for mailbox registers access

Use no kiq version reg access due to:
1) better performance
2) INTR context consideration (some routine in mailbox is in
   INTR context e.g.xgpu_vi_mailbox_rcv_irq)

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:Refine handshake of mailbox
Ken Xue [Wed, 25 Jan 2017 05:14:17 +0000 (13:14 +0800)]
drm/amdgpu:Refine handshake of mailbox

Signed-off-by: Ken Xue <Ken.Xue@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:impl RREG32 no kiq version
Monk Liu [Wed, 25 Jan 2017 07:07:40 +0000 (15:07 +0800)]
drm/amdgpu:impl RREG32 no kiq version

some registers are PF & VF copy, and we can safely use
mmio method to access them.

and sometime we are forbid to use kiq to access registers
for example in INTR context.

we need a MACRO that always disable KIQ for regs accessing

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:use MACRO like other places
Monk Liu [Wed, 8 Feb 2017 07:10:24 +0000 (15:10 +0800)]
drm/amdgpu:use MACRO like other places

Change-Id: Ica8f86577a50d817119de4b4fb95068dc72652a9
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: simplify reservation handling during buffer creation
Nicolai Hähnle [Thu, 16 Feb 2017 10:01:44 +0000 (11:01 +0100)]
drm/amdgpu: simplify reservation handling during buffer creation

By using ttm_bo_init_reserved instead of the manual initialization of
the reservation object, the reservation lock will be properly unlocked
and destroyed when the TTM BO initialization fails.

Actual deadlocks caused by the missing unlock should have been fixed
by "drm/ttm: never add BO that failed to validate to the LRU list",
superseding the flawed fix in commit 38fc4856ad98 ("drm/amdgpu: fix
a potential deadlock in amdgpu_bo_create_restricted()").

This change fixes remaining recursive locking errors that can be seen
with lock debugging enabled, and avoids the error of freeing a locked
mutex.

As an additional minor bonus, buffers created with resv == NULL and
the AMDGPU_GEM_CREATE_VRAM_CLEARED flag are now only added to the
global LRU list after the fill commands have been issued.

v2: use amdgpu_bo_unreserve instead of ttm_bo_unreserve

Fixes: 12a852219583 ("drm/amdgpu: improve AMDGPU_GEM_CREATE_VRAM_CLEARED handling (v2)")
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/ttm: add ttm_bo_init_reserved
Nicolai Hähnle [Thu, 16 Feb 2017 09:56:40 +0000 (10:56 +0100)]
drm/ttm: add ttm_bo_init_reserved

This variant of ttm_bo_init returns the validated buffer object with
the reservation lock held when resv == NULL. This is convenient for
callers that want to use the BO immediately, e.g. for initializing its
contents.

Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/ttm: fix the documentation of ttm_bo_init
Nicolai Hähnle [Tue, 14 Feb 2017 09:37:41 +0000 (10:37 +0100)]
drm/ttm: fix the documentation of ttm_bo_init

As the comment says: callers of ttm_bo_init cannot rely on having the
only reference to the BO when the function returns successfully.

Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoRevert "drm/amdgpu: fix a potential deadlock in amdgpu_bo_create_restricted()"
Nicolai Hähnle [Tue, 14 Feb 2017 08:47:36 +0000 (09:47 +0100)]
Revert "drm/amdgpu: fix a potential deadlock in amdgpu_bo_create_restricted()"

This reverts commit 38fc4856ad98f230bc91da0421dec69e4aee40f8, which
introduces a use-after-free.

The underlying bug should be properly fixed with "drm/ttm: never add BO
that failed to validate to the LRU list".

Cc: zhoucm1 <david1.zhou@amd.com>
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/ttm: never add BO that failed to validate to the LRU list
Nicolai Hähnle [Tue, 14 Feb 2017 08:37:12 +0000 (09:37 +0100)]
drm/ttm: never add BO that failed to validate to the LRU list

Fixes a potential race condition in amdgpu that looks as follows:

Task 1: attempt ttm_bo_init, but ttm_bo_validate fails
Task 1: add BO to global list anyway
Task 2: grabs hold of the BO, waits on its reservation lock
Task 1: releases its reference of the BO; never gives up the
        reservation lock

The patch "drm/amdgpu: fix a potential deadlock in
amdgpu_bo_create_restricted()" attempts to fix that by releasing
the reservation lock in amdgpu code; unfortunately, it introduces
a use-after-free when this race _doesn't_ happen.

This patch should fix the race properly by never adding the BO
to the global list in the first place.

Cc: zhoucm1 <david1.zhou@amd.com>
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: expose GPU sensor related information
Alex Deucher [Wed, 8 Mar 2017 23:25:15 +0000 (18:25 -0500)]
drm/amdgpu: expose GPU sensor related information

This includes shader/memory clocks, temperature, GPU load, etc.

v2: - add sub-queries for AMDPGU_INFO_GPU_SENSOR_*
    - do not break the ABI
v3: - return -ENOENT when amdgpu_dpm == 0
    - expose more sensor queries
v4: - s/GPU_POWER/GPU_AVG_POWER/
    - improve VDDNB/VDDGFX query description
    - fix amdgpu_dpm check
v5: - agd: fix warning
v6: - agd: bump version

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: expose amdgpu_sensors on pre-powerplay chips
Samuel Pitoiset [Wed, 15 Feb 2017 18:32:29 +0000 (19:32 +0100)]
drm/amdgpu: expose amdgpu_sensors on pre-powerplay chips

read_sensor() has been recently implemented for dpm based boards
which means amdgpu_sensors can now be exposed.

v2: - make sure read_sensor is not NULL on dpm chips
    - keep sanity check for powerplay chips
v3: - make sure amdgpu_dpm != 0

Cc: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Tom St Denis <tom.stdenis@amd.com>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: implement read_sensor() for pre-powerplay chips
Samuel Pitoiset [Tue, 14 Feb 2017 00:00:49 +0000 (01:00 +0100)]
drm/amdgpu: implement read_sensor() for pre-powerplay chips

Add the GPU temperature, the shader clock and eventually the
memory clock (as well as the GPU load on CI). The main goal is
to expose this info to the userspace like Radeon.

v2: - add AMDGPU_PP_SENSOR_GPU_LOAD on CI
    - update the commit description

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/radeon: allow unaligned shader loads on CIK
Marek Olšák [Mon, 13 Feb 2017 16:37:05 +0000 (17:37 +0100)]
drm/radeon: allow unaligned shader loads on CIK

Set alignment mode to unaligned on CIK to align with amdgpu.  This is
needed for unaligned loads to work properly in mesa.  The current setting
requires dword alignment.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: fix PRT teardown on VM fini v3
Christian König [Tue, 14 Feb 2017 15:02:52 +0000 (16:02 +0100)]
drm/amdgpu: fix PRT teardown on VM fini v3

v2: new approach fixing this by registering a fence callback for
    all users of the VM on teardown
v3: agd: rebase

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add OOM fallback on PRT teardown (v2)
Christian König [Tue, 14 Feb 2017 14:47:03 +0000 (15:47 +0100)]
drm/amdgpu: add OOM fallback on PRT teardown (v2)

Don't assume kmalloc will always succeed.

v2: agd: rebase

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: minor PRT turnoff fix (v2)
Christian König [Tue, 14 Feb 2017 13:50:50 +0000 (14:50 +0100)]
drm/amdgpu: minor PRT turnoff fix (v2)

When two VMs stop using PRT support at the same time we might
not disable it in the right order otherwise.

v2: agd: rebase

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: change pte definitions to 64 bit
Alex Xie [Wed, 15 Feb 2017 19:10:19 +0000 (14:10 -0500)]
drm/amdgpu: change pte definitions to 64 bit

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: fix PTE defines
Christian König [Mon, 13 Feb 2017 13:22:58 +0000 (14:22 +0100)]
drm/amdgpu: fix PTE defines

Those should be 64bit, even on a 32bit system.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Update read_sensor calls to have size parameter (v3)
Tom St Denis [Thu, 9 Feb 2017 19:29:01 +0000 (14:29 -0500)]
drm/amd/amdgpu: Update read_sensor calls to have size parameter (v3)

This update allows sensors to return more than 1 value and
indicates to the caller how many bytes are written.

The debugfs interface has been updated to handle reading all
of the values.  Simply seek to the enum value (multiplied
by 4) and then read as many bytes as the sensor provides.

(v2):  Don't set size to 4 before reading GPU_POWER
(v3): agd: rebase

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: implement PRT for GFX8 v2
Christian König [Wed, 18 Jan 2017 12:40:48 +0000 (13:40 +0100)]
drm/amdgpu: implement PRT for GFX8 v2

Enable/disable the handling globally for now and
print a warning when we enable it for the first time.

v2: set correct register

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: implement PRT for GFX7 v2
Christian König [Wed, 18 Jan 2017 12:37:21 +0000 (13:37 +0100)]
drm/amdgpu: implement PRT for GFX7 v2

Enable/disable the handling globally for now and
print a warning when we enable it for the first time.

v2: set correct register

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: implement PRT for GFX6 v2
Christian König [Fri, 27 Jan 2017 10:56:05 +0000 (11:56 +0100)]
drm/amdgpu: implement PRT for GFX6 v2

Enable/disable the handling globally for now and
print a warning when we enable it for the first time.

v2: write to the correct register, adjust bits to that hw generation
v3: fix compilation, add the missing register bit definitions

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: IOCTL interface for PRT support v4
Junwei Zhang [Mon, 16 Jan 2017 05:59:01 +0000 (13:59 +0800)]
drm/amdgpu: IOCTL interface for PRT support v4

Till GFX8 we can only enable PRT support globally, but with the next hardware
generation we can do this on a per page basis.

Keep the interface consistent by adding PRT mappings and enable
support globally on current hardware when the first mapping is made.

v2: disable PRT support delayed and on all error paths
v3: PRT and other permissions are mutal exclusive,
    PRT mappings don't need a BO.
v4: update PRT mappings durign CS as well, make va_flags 64bit

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add basic PRT support (v2)
Christian König [Mon, 30 Jan 2017 10:09:31 +0000 (11:09 +0100)]
drm/amdgpu: add basic PRT support (v2)

Future hardware generations can handle PRT flags on a per page basis,
but current hardware can only turn it on globally.

Add the basic handling for both, a global callback to enable/disable
triggered by setting a per mapping flag.

v2: agd: rebase fixes

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add support for BO_VAs without BO v2
Christian König [Mon, 30 Jan 2017 10:01:38 +0000 (11:01 +0100)]
drm/amdgpu: add support for BO_VAs without BO v2

For PRT support we need mappings which aren't backed by any memory.

v2: fix parameter checking

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:use hw_init for sriov_gpu_reset
Monk Liu [Thu, 9 Feb 2017 03:55:49 +0000 (11:55 +0800)]
drm/amdgpu:use hw_init for sriov_gpu_reset

no suspend invoked so after VF FLR by host, we just
call hw_init to reinitialize IPs.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: implement gpu power display for smu7_hwmgr
Eric Huang [Tue, 7 Feb 2017 16:46:21 +0000 (11:46 -0500)]
drm/amd/powerplay: implement gpu power display for smu7_hwmgr

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add power consumption display support in debugfs
Eric Huang [Tue, 24 Jan 2017 21:59:27 +0000 (16:59 -0500)]
drm/amd/powerplay: add power consumption display support in debugfs

The additional output are:
vddc power in Watt;
vddci power in Watt;
max gpu power in Watt;
average gpu power in Watt.

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: change parameter type pointer from int32_t to void in read sensor
Eric Huang [Tue, 7 Feb 2017 21:37:48 +0000 (16:37 -0500)]
drm/amd/powerplay: change parameter type pointer from int32_t to void in read sensor

As well as fix print format for uint32_t type.

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: add power profile support for CI
Eric Huang [Fri, 14 Oct 2016 18:21:19 +0000 (14:21 -0400)]
drm/amd/amdgpu: add power profile support for CI

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Acked-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add power profile support for Polaris
Eric Huang [Tue, 24 Jan 2017 15:57:22 +0000 (10:57 -0500)]
drm/amd/powerplay: add power profile support for Polaris

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Acked-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add power profile support for Fiji
Eric Huang [Tue, 24 Jan 2017 15:56:21 +0000 (10:56 -0500)]
drm/amd/powerplay: add power profile support for Fiji

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Acked-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add power profile support for tonga
Eric Huang [Tue, 24 Jan 2017 15:53:39 +0000 (10:53 -0500)]
drm/amd/powerplay: add power profile support for tonga

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Acked-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add power profile support for SMU7
Eric Huang [Tue, 24 Jan 2017 15:47:25 +0000 (10:47 -0500)]
drm/amd/powerplay: add power profile support for SMU7

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Acked-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: reapply power profile when force dpm level to auto
Eric Huang [Thu, 6 Oct 2016 21:57:40 +0000 (17:57 -0400)]
drm/amd/powerplay: reapply power profile when force dpm level to auto

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Acked-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: add power profile sysfs entry
Eric Huang [Mon, 12 Sep 2016 20:17:44 +0000 (16:17 -0400)]
drm/amd/amdgpu: add power profile sysfs entry

Add the sysfs entries pp_gfx_power_profile and
pp_compute_power_profile which give user a way to set
power profile through parameters minimum sclk, minimum mclk,
activity threshold, up hysteresis and down hysteresis only
when the entry power_dpm_force_performance_level is in
default value "auto". It is read and write. Example:

echo 500 800 20 0 5 > /sys/class/drm/card0/device/pp_*_power_profile

cat /sys/class/drm/card0/device/pp_*_power_profile
500 800 20 0 5

Note: first parameter is sclk in MHz, second is mclk in MHz,
third is activity threshold in percentage, fourth is up hysteresis
in ms and fifth is down hysteresis in ms.

echo set > /sys/class/drm/card0/device/pp_*_power_profile
To set power profile state if it exists.

echo reset > /sys/class/drm/card0/device/pp_*_power_profile
To restore default state and clear previous setting.

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Acked-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:cleanup no needed braces
Monk Liu [Thu, 9 Feb 2017 05:42:27 +0000 (13:42 +0800)]
drm/amdgpu:cleanup no needed braces

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:don't return error for debugfs failed
Monk Liu [Thu, 9 Feb 2017 05:41:53 +0000 (13:41 +0800)]
drm/amdgpu:don't return error for debugfs failed

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:add lock_reset for SRIOV
Monk Liu [Wed, 25 Jan 2017 07:48:01 +0000 (15:48 +0800)]
drm/amdgpu:add lock_reset for SRIOV

this lock is used for sriov_gpu_reset, only get this mutex
can run into sriov_gpu_reset.

we have couple source triggers gpu_reset for SRIOV:
1) submit timedout and trigger reset voluntarily
2) invalid instruction detected by ENGINE and trigger reset voluntarily
2) hypervisor found world switch hang and trigger flr and notify guest to
   do reset.

all need take care and we need a mutex to protect the consistency of
reset routine.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:change kiq lock name
Monk Liu [Wed, 25 Jan 2017 07:33:56 +0000 (15:33 +0800)]
drm/amdgpu:change kiq lock name

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:implement SRIOV gpu_reset (v2)
Monk Liu [Mon, 23 Jan 2017 06:22:08 +0000 (14:22 +0800)]
drm/amdgpu:implement SRIOV gpu_reset (v2)

implement SRIOV gpu_reset for future use.
it wil be called from:
1) job timeout
2) privl access or instruction error interrupt
3) hypervisor detect VF hang

v2: agd: rebase on upstream

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:divide KCQ mqd init to sw and hw
Monk Liu [Mon, 6 Feb 2017 08:46:36 +0000 (16:46 +0800)]
drm/amdgpu:divide KCQ mqd init to sw and hw

sw part only invoked once during sw_init.
hw part invoked during first drv load and resume later.

that way we cannot alloc mqd in hw/resume, we only keep
mqd allocted in sw_init routine.
and hw_init routine only kmap and set it.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:minor cleanup
Monk Liu [Mon, 6 Feb 2017 08:35:54 +0000 (16:35 +0800)]
drm/amdgpu:minor cleanup

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:no need use sriov vf checks
Monk Liu [Mon, 6 Feb 2017 08:34:04 +0000 (16:34 +0800)]
drm/amdgpu:no need use sriov vf checks

We ultimately want to re-use this for bare metal,
so no need to have vf checks in the KIQ code itself
since kiq itself is currently only used in VF cases.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:bo_free_kernel will set ptr to NULL if freed
Monk Liu [Mon, 6 Feb 2017 08:31:08 +0000 (16:31 +0800)]
drm/amdgpu:bo_free_kernel will set ptr to NULL if freed

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:imple mqd soft ini/fini
Monk Liu [Mon, 6 Feb 2017 08:28:53 +0000 (16:28 +0800)]
drm/amdgpu:imple mqd soft ini/fini

this is for SRIOV fix:
mqd soft init/fini will be invoked by sw_init to
allocate BO for compute MQD resource, instead of
original scheme that hw_init allocates MQD.

because if hw_init allocates MQD, then resume will
allocate MQD, and that lead to memory leak after
driver recovered from hang.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/damdgpu:add new mqd member in ring
Monk Liu [Tue, 24 Jan 2017 10:33:22 +0000 (18:33 +0800)]
drm/damdgpu:add new mqd member in ring

introduce a new mqd member in ring is for later usage.
we need keep a clean version of MQD for the purpose
of recovering compute rings from hang.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:cg & pg shouldn't active on VF device
Monk Liu [Mon, 23 Jan 2017 02:49:33 +0000 (10:49 +0800)]
drm/amdgpu:cg & pg shouldn't active on VF device

CG & PG function changes engine clock/gating, which is
not appropriate for VF device, because one vf doesn't know
the whole picture of engine's overall workload.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: clean framebuffer with GPU
Pixel Ding [Tue, 24 Jan 2017 03:39:48 +0000 (11:39 +0800)]
drm/amdgpu: clean framebuffer with GPU

CPU is not efficient to clean framebuffer especially under
virtualization, then loading driver takes long time which causes
timeout of mailbox handshake.

Signed-off-by: Pixel Ding <Pixel.Ding@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:fix amdgpu_sa_bo_new error(v2)
Monk Liu [Wed, 8 Feb 2017 09:38:13 +0000 (17:38 +0800)]
drm/amdgpu:fix amdgpu_sa_bo_new error(v2)

ib_pool init should prior to fbdev_init, otherwise
there will be error from amdgpu_sa_bo_new
(amdgpu_sa.c:323)

fbdev_init will call ttm_validate which further call
amdgpu_sa_bo_new.

v2:
move fbdev_init behind ib test.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/virt: skip VM fault handler for VF
Pixel Ding [Mon, 6 Feb 2017 09:32:22 +0000 (17:32 +0800)]
drm/amdgpu/virt: skip VM fault handler for VF

VF uses KIQ to access registers. When VM fault occurs, the driver
can't get back the fence of KIQ submission and runs into CPU soft
lockup.

Signed-off-by: Pixel Ding <Pixel.Ding@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/virt: increase mailbox timeout to 5000ms
Pixel Ding [Tue, 24 Jan 2017 07:04:48 +0000 (15:04 +0800)]
drm/amdgpu/virt: increase mailbox timeout to 5000ms

When multiple VFs try to enter exclusive mode at the same time, the
looping mechansim doesn't help to ensure each can get it because it
only loops active VFs, then the last one has to wait for a long
interval.

Signed-off-by: Pixel Ding <Pixel.Ding@amd.com>
Reviewed-by: Xiangliang.Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:fix powerplay logic
Monk Liu [Wed, 25 Jan 2017 07:55:30 +0000 (15:55 +0800)]
drm/amdgpu:fix powerplay logic

1,like pp_hw_init, we shouldn't report error if PP disabled
2,disable pp_en if sriov

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:fix typo
Monk Liu [Sun, 22 Jan 2017 10:52:56 +0000 (18:52 +0800)]
drm/amdgpu:fix typo

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/i915/gvt: fix error return check for copy_gma_to_hva()
Zhenyu Wang [Wed, 29 Mar 2017 03:07:53 +0000 (11:07 +0800)]
drm/i915/gvt: fix error return check for copy_gma_to_hva()

From commit 73dec95e6ba3 ("drm/i915: Emit to ringbuffer directly"),
copy_gma_to_hva() now returns copied data length instead of 0, so
need to change error return check for that.

Note: Looks this is caused by backmerge conflict resolving, so
4.11-rc4 is not impacted as commit 73dec95e6ba3 ("drm/i915: Emit to
ringbuffer directly") is not in 4.11. But need to fix this before I
can apply 4.12 stuff against drm-intel-next correctly.

Fixes: e5c1ff14757a ("Backmerge tag 'v4.11-rc4' into drm-next")
Cc: Dave Airlie <airlied@redhat.com>
Cc: Tina Zhang <tina.zhang@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoBackmerge tag 'v4.11-rc4' into drm-next
Dave Airlie [Tue, 28 Mar 2017 07:34:19 +0000 (17:34 +1000)]
Backmerge tag 'v4.11-rc4' into drm-next

Linux 4.11-rc4

The i915 GVT team need the rc4 code to base some more code on.

7 years agoLinux 4.11-rc4
Linus Torvalds [Sun, 26 Mar 2017 21:15:16 +0000 (14:15 -0700)]
Linux 4.11-rc4

7 years agoMerge tag 'char-misc-4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregk...
Linus Torvalds [Sun, 26 Mar 2017 18:15:54 +0000 (11:15 -0700)]
Merge tag 'char-misc-4.11-rc4' of git://git./linux/kernel/git/gregkh/char-misc

Pull char/misc driver fixes from Greg KH:
 "A smattering of different small fixes for some random driver
  subsystems. Nothing all that major, just resolutions for reported
  issues and bugs.

  All have been in linux-next with no reported issues"

* tag 'char-misc-4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (21 commits)
  extcon: int3496: Set the id pin to direction-input if necessary
  extcon: int3496: Use gpiod_get instead of gpiod_get_index
  extcon: int3496: Add dependency on X86 as it's Intel specific
  extcon: int3496: Add GPIO ACPI mapping table
  extcon: int3496: Rename GPIO pins in accordance with binding
  vmw_vmci: handle the return value from pci_alloc_irq_vectors correctly
  ppdev: fix registering same device name
  parport: fix attempt to write duplicate procfiles
  auxdisplay: img-ascii-lcd: add missing sentinel entry in img_ascii_lcd_matches
  Drivers: hv: vmbus: Don't leak memory when a channel is rescinded
  Drivers: hv: vmbus: Don't leak channel ids
  Drivers: hv: util: don't forget to init host_ts.lock
  Drivers: hv: util: move waiting for release to hv_utils_transport itself
  vmbus: remove hv_event_tasklet_disable/enable
  vmbus: use rcu for per-cpu channel list
  mei: don't wait for os version message reply
  mei: fix deadlock on mei reset
  intel_th: pci: Add Gemini Lake support
  intel_th: pci: Add Denverton SOC support
  intel_th: Don't leak module refcount on failure to activate
  ...

7 years agoMerge tag 'driver-core-4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 26 Mar 2017 18:05:42 +0000 (11:05 -0700)]
Merge tag 'driver-core-4.11-rc4' of git://git./linux/kernel/git/gregkh/driver-core

Pull driver core fix from Greg KH:
 "Here is a single kernfs fix for 4.11-rc4 that resolves a reported
  issue.

  It has been in linux-next with no reported issues"

* tag 'driver-core-4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  kernfs: Check KERNFS_HAS_RELEASE before calling kernfs_release_file()

7 years agoMerge tag 'tty-4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Linus Torvalds [Sun, 26 Mar 2017 18:03:42 +0000 (11:03 -0700)]
Merge tag 'tty-4.11-rc4' of git://git./linux/kernel/git/gregkh/tty

Pull tty/serial driver fixes from Greg KH:
 "Here are some tty and serial driver fixes for 4.11-rc4.

  One of these fix a long-standing issue in the ldisc code that was
  found by Dmitry Vyukov with his great fuzzing work. The other fixes
  resolve other reported issues, and there is one revert of a patch in
  4.11-rc1 that wasn't correct.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'tty-4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  tty: fix data race in tty_ldisc_ref_wait()
  tty: don't panic on OOM in tty_set_ldisc()
  Revert "tty: serial: pl011: add ttyAMA for matching pl011 console"
  tty: acpi/spcr: QDF2400 E44 checks for wrong OEM revision
  serial: 8250_dw: Fix breakage when HAVE_CLK=n
  serial: 8250_dw: Honor clk_round_rate errors in dw8250_set_termios

7 years agoMerge tag 'staging-4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Sun, 26 Mar 2017 18:02:00 +0000 (11:02 -0700)]
Merge tag 'staging-4.11-rc4' of git://git./linux/kernel/git/gregkh/staging

Pull IIO driver fixes from Greg KH:
 "Here are some small IIO driver fixes for 4.11-rc4 that resolve a
  number of tiny reported issues. All of these have been in linux-next
  for a while with no reported issues"

* tag 'staging-4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  iio: imu: st_lsm6dsx: fix FIFO_CTRL2 overwrite during watermark configuration
  iio: adc: ti_am335x_adc: fix fifo overrun recovery
  iio: sw-device: Fix config group initialization
  iio: magnetometer: ak8974: remove incorrect __exit markups
  iio: hid-sensor-trigger: Change get poll value function order to avoid sensor properties losing after resume from S3