]> Git Repo - linux.git/log
linux.git
8 years agodrm/amd/amdgpu: Add wave reader to debugfs
Tom St Denis [Tue, 11 Oct 2016 18:48:55 +0000 (14:48 -0400)]
drm/amd/amdgpu: Add wave reader to debugfs

Currently supports CZ/VI.  Allows nearly atomic read
of wave data from GPU.

Signed-off-by: Tom St Denis <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: rework IP block registration (v2)
Alex Deucher [Thu, 13 Oct 2016 21:41:13 +0000 (17:41 -0400)]
drm/amdgpu: rework IP block registration (v2)

This makes it easier to replace specific IP blocks on
asics for handling virtual_dce, DAL, etc. and for building
IP lists for hw or tables.  This also stored the status
information in the same structure.

v2: split out spelling fix into a separate patch
    add a function to add IPs to the list

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/powerplay: fix spelling in amdgpu_powerplay.h
Alex Deucher [Fri, 14 Oct 2016 15:27:15 +0000 (11:27 -0400)]
drm/amdgpu/powerplay: fix spelling in amdgpu_powerplay.h

and update a comment as well.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/virtual_dce: move define into source file
Alex Deucher [Thu, 13 Oct 2016 21:36:46 +0000 (17:36 -0400)]
drm/amdgpu/virtual_dce: move define into source file

It's not used outside the file.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: enable virtual dce on SI
Alex Deucher [Thu, 13 Oct 2016 20:01:18 +0000 (16:01 -0400)]
drm/amdgpu: enable virtual dce on SI

Add the proper IP module when requested.

Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: fill in vce clock info ioctl query (v2)
Alex Deucher [Fri, 7 Oct 2016 16:22:02 +0000 (12:22 -0400)]
drm/amdgpu: fill in vce clock info ioctl query (v2)

Returns the vce clock table for the user mode driver.
The user mode driver can fill this data into vce clock
data packet for optimal VCE DPM.

v2: update to the new API

Reviewed-by: Rex Zhu <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/powerplay: add an implementation for get_vce_clock_state (v3)
Alex Deucher [Fri, 7 Oct 2016 17:52:43 +0000 (13:52 -0400)]
drm/amdgpu/powerplay: add an implementation for get_vce_clock_state (v3)

Used by the powerplay dpm code.

v2: update to the new API
v3: drop old include

Reviewed-by: Rex Zhu <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/dpm: add an implementation for get_vce_clock_state (v2)
Alex Deucher [Fri, 7 Oct 2016 16:38:04 +0000 (12:38 -0400)]
drm/amdgpu/dpm: add an implementation for get_vce_clock_state (v2)

Used by the non-powerplay dpm code.

v2: update to the new API

Reviewed-by: Rex Zhu <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/dpm: add new callback to fetch vce clock state (v2)
Alex Deucher [Fri, 7 Oct 2016 18:10:15 +0000 (14:10 -0400)]
drm/amdgpu/dpm: add new callback to fetch vce clock state (v2)

Will be used by the new info ioctl query.

v2: fetch a single state per request

Reviewed-by: Rex Zhu <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: add info ioctl query for vce clock info (v3)
Alex Deucher [Fri, 7 Oct 2016 16:12:46 +0000 (12:12 -0400)]
drm/amdgpu: add info ioctl query for vce clock info (v3)

This is needed to set up the vce clock table in userspace
for proper VCE DPM.

v2: fix copy paste typo in comment
v3: track number of valid states

Reviewed-by: Rex Zhu <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: save number of vce states in dpm struct.
Rex Zhu [Wed, 12 Oct 2016 07:38:56 +0000 (15:38 +0800)]
drm/amdgpu: save number of vce states in dpm struct.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Rex Zhu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: use same vce state definition in dpm and powerplay
Rex Zhu [Wed, 12 Oct 2016 07:13:29 +0000 (15:13 +0800)]
drm/amdgpu: use same vce state definition in dpm and powerplay

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Rex Zhu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: move dpm related definitions to amdgpu_dpm.h
Alex Deucher [Fri, 7 Oct 2016 15:40:09 +0000 (11:40 -0400)]
drm/amdgpu: move dpm related definitions to amdgpu_dpm.h

No intended functional change.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: move align_mask and nop into ring funcs as well (v2)
Christian König [Wed, 5 Oct 2016 14:09:32 +0000 (16:09 +0200)]
drm/amdgpu: move align_mask and nop into ring funcs as well (v2)

They are constant as well.

v2: update uvd and vce phys ring structures as well

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: move the ring type into the funcs structure (v2)
Christian König [Wed, 5 Oct 2016 13:36:39 +0000 (15:36 +0200)]
drm/amdgpu: move the ring type into the funcs structure (v2)

It's constant, so it doesn't make to much sense to keep it
with the variable data.

v2: update vce and uvd phys mode ring structures as well

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: move IB and frame size directly into the engine description
Christian König [Wed, 5 Oct 2016 12:29:38 +0000 (14:29 +0200)]
drm/amdgpu: move IB and frame size directly into the engine description

I should have suggested that on the initial patchset. This saves us a
few CPU cycles during CS and a bunch of loc.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: remove explicit NULL init for parse_cs
Christian König [Wed, 5 Oct 2016 12:23:00 +0000 (14:23 +0200)]
drm/amdgpu: remove explicit NULL init for parse_cs

sed -i "/\.parse_cs = NULL,/d" drivers/gpu/drm/amd/amdgpu/*.c

That's just a leftover from radeon.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: remove 128 NOP hack from vm_flush v2
Christian König [Wed, 5 Oct 2016 10:59:20 +0000 (12:59 +0200)]
drm/amdgpu: remove 128 NOP hack from vm_flush v2

With the padding raised to 256 DW that shouldn't be needed any more.

v2: reduce estimation as well

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: remove ring type check for conditional execution
Christian König [Wed, 5 Oct 2016 10:51:57 +0000 (12:51 +0200)]
drm/amdgpu: remove ring type check for conditional execution

If a ring doesn't support that it shouldn't implement the function.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: pad gfx and compute rings to 256 dw
Christian König [Wed, 5 Oct 2016 10:38:21 +0000 (12:38 +0200)]
drm/amdgpu: pad gfx and compute rings to 256 dw

The same as on windows to avoid further problems with CE/DE
command submission overlaps.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/radeon: clarify why we evict vram twice on suspend
Alex Deucher [Mon, 10 Oct 2016 16:42:33 +0000 (12:42 -0400)]
drm/radeon: clarify why we evict vram twice on suspend

Update the comment to explain why we do this.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: clarify why we evict vram twice on suspend
Alex Deucher [Mon, 10 Oct 2016 16:41:36 +0000 (12:41 -0400)]
drm/amdgpu: clarify why we evict vram twice on suspend

Update the comment to explain why we do this.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: used cached gca values for vi_read_register (v2)
Alex Deucher [Mon, 10 Oct 2016 16:05:32 +0000 (12:05 -0400)]
drm/amdgpu: used cached gca values for vi_read_register (v2)

Using the cached values has less latency for bare metal
and SR-IOV, and prevents reading back bogus values if the
engine is powergated.

v2: fix typo in tile idx calculation

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/gfx8: use cached raster config values in csb setup
Alex Deucher [Mon, 10 Oct 2016 15:17:58 +0000 (11:17 -0400)]
drm/amdgpu/gfx8: use cached raster config values in csb setup

Simplify the code and properly set the csb for harvest values.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/gfx8: cache rb config values
Alex Deucher [Mon, 10 Oct 2016 15:15:24 +0000 (11:15 -0400)]
drm/amdgpu/gfx8: cache rb config values

Needed when for SR-IOV and when PG is enabled.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: add additional cached gca config variables
Alex Deucher [Mon, 10 Oct 2016 14:56:21 +0000 (10:56 -0400)]
drm/amdgpu: add additional cached gca config variables

We need to cache some additional values to handle SR-IOV
and PG.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: use amdgpu_vm_get_pd_bo in the GEM code
Christian König [Wed, 28 Sep 2016 14:33:01 +0000 (16:33 +0200)]
drm/amdgpu: use amdgpu_vm_get_pd_bo in the GEM code

Instead of messing with the PD directly.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: move VM defines into amdgpu_vm.h
Christian König [Wed, 28 Sep 2016 13:41:50 +0000 (15:41 +0200)]
drm/amdgpu: move VM defines into amdgpu_vm.h

Only cleanup, no intended functional change.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: move fence and ring defines into amdgpu_ring.h
Christian König [Wed, 28 Sep 2016 13:33:18 +0000 (15:33 +0200)]
drm/amdgpu: move fence and ring defines into amdgpu_ring.h

Only cleanup, no intended functional change.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: move sync handling into a separate header
Christian König [Wed, 28 Sep 2016 10:36:44 +0000 (12:36 +0200)]
drm/amdgpu: move sync handling into a separate header

Only cleanup, no intended functional change.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: stop using a bo list entry for the VM PTs
Christian König [Wed, 28 Sep 2016 10:27:37 +0000 (12:27 +0200)]
drm/amdgpu: stop using a bo list entry for the VM PTs

Saves us a bit of memory.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: move PT validation back into VM code v2
Christian König [Wed, 28 Sep 2016 10:03:04 +0000 (12:03 +0200)]
drm/amdgpu: move PT validation back into VM code v2

Saves a bunch of CPU cycles when swapping things back in and
allows us to split the VM headers into a separate file.

v2: rename parameters

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: remove adev pointer from struct amdgpu_bo v2
Christian König [Thu, 15 Sep 2016 12:58:48 +0000 (14:58 +0200)]
drm/amdgpu: remove adev pointer from struct amdgpu_bo v2

It's completely pointless to have two pointers to the
device in the same structure.

v2: rename function to amdgpu_ttm_adev, fix typos

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amd/amdgpu: Enable UVD PG on Tonga
Tom St Denis [Fri, 30 Sep 2016 15:00:16 +0000 (11:00 -0400)]
drm/amd/amdgpu: Enable UVD PG on Tonga

Tested by reading tile/clk bits during load/idle.

Signed-off-by: Tom St Denis <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amd/powerplay: Enable UVD powergating for SMU7
Tom St Denis [Fri, 30 Sep 2016 14:58:44 +0000 (10:58 -0400)]
drm/amd/powerplay: Enable UVD powergating for SMU7

This patch enables detecting VCE/UVD PG features and fixes the
UVD powergate function.

Tested on a Tonga (by reading UVD tile/clk bits during playback/idle).

Signed-off-by: Tom St Denis <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: update the shadow PD together with the real one v2
Christian König [Fri, 16 Sep 2016 13:36:49 +0000 (15:36 +0200)]
drm/amdgpu: update the shadow PD together with the real one v2

Far less CPU cycles needed for this approach.

v2: fix typo

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu:wptr poll address of gfx8 is needed
Frank Min [Wed, 27 Apr 2016 11:44:56 +0000 (19:44 +0800)]
drm/amdgpu:wptr poll address of gfx8 is needed

for GFX8, gfx ring's wptr_addr is needed by SRIOV & CP for polling.

Signed-off-by: Frank Min <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu:properly fix some JumpTable issues
Monk Liu [Tue, 27 Sep 2016 08:39:58 +0000 (16:39 +0800)]
drm/amdgpu:properly fix some JumpTable issues

we found some MEC ucode leads to IB test fail or even
ring test fail if Jump Table of it is not start in
FW bo with page aligned address, fixed by always make
JT address page aligned.

we don't need to patch JT2 for MEC2, because for VI,
MEC2 is a copy of MEC1, thus when converting fw_type
for MEC_JT2 we just return MEC1,hw can use the same
JT for both MEC1 & MEC2.

above two change fixed some ring/ib test failure issue
for some version of MEC ucode.

Signed-off-by: Frank Min <[email protected]>
Signed-off-by: Monk Liu <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu:add MEC_STORAGE ucode id for sriov
Monk Liu [Mon, 26 Sep 2016 08:35:03 +0000 (16:35 +0800)]
drm/amdgpu:add MEC_STORAGE ucode id for sriov

for sriov, SMC need MEC_STORAGE reserved in fw bo.

Signed-off-by: Monk Liu <[email protected]>
Signed-off-by: Frank Min <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu:add callback in cgs for sriov detect
Frank Min [Wed, 27 Apr 2016 12:04:58 +0000 (20:04 +0800)]
drm/amdgpu:add callback in cgs for sriov detect

Signed-off-by: Frank Min <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu:fw bo should be in VRAM for SRIOV
Frank Min [Wed, 27 Apr 2016 12:02:57 +0000 (20:02 +0800)]
drm/amdgpu:fw bo should be in VRAM for SRIOV

for GTT memory SMC can only access it within PF space, which is not
used for SRIOV case, thus for SRIOV case, we let SMC use FB space for
ucode bo.

Signed-off-by: Frank Min <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu:keep bo pinned in prefered domain
Frank Min [Wed, 27 Apr 2016 10:33:35 +0000 (18:33 +0800)]
drm/amdgpu:keep bo pinned in prefered domain

Signed-off-by: Frank Min <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu:use smc_index_11 for VI
Monk Liu [Tue, 29 Mar 2016 03:01:51 +0000 (11:01 +0800)]
drm/amdgpu:use smc_index_11 for VI

for VI smc, index_0 to index_8 are all not safe,
they may used by BIOS/FW, and index_11 is reserved
only for driver.

Signed-off-by: Monk Liu <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu:add one more fiji device id
Frank Min [Wed, 27 Apr 2016 11:07:18 +0000 (19:07 +0800)]
drm/amdgpu:add one more fiji device id

Signed-off-by: Frank Min <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amd/powerplay: mark symbols static where possible
Baoyou Xie [Fri, 30 Sep 2016 09:58:42 +0000 (17:58 +0800)]
drm/amd/powerplay: mark symbols static where possible

We get a few warnings when building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/fiji_smumgr.c:162:5: warning: no previous prototype for 'fiji_setup_pwr_virus' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/fiji_smc.c:2052:5: warning: no previous prototype for 'fiji_program_mem_timing_parameters' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/polaris10_smumgr.c:175:5: warning: no previous prototype for 'polaris10_avfs_event_mgr' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/cz_hwmgr.c:69:10: warning: no previous prototype for 'cz_get_eclk_level' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c:92:26: warning: no previous prototype for 'cast_phw_smu7_power_state' [-Wmissing-prototypes]
....

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Acked-by: Christian König <[email protected]>
Signed-off-by: Baoyou Xie <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/radeon: mark symbols static where possible
Baoyou Xie [Fri, 30 Sep 2016 08:13:02 +0000 (16:13 +0800)]
drm/radeon: mark symbols static where possible

We get 4 warnings when building kernel with W=1:
drivers/gpu/drm/radeon/si.c:7850:5: warning: no previous prototype for 'si_vce_send_vcepll_ctlreq' [-Wmissing-prototypes]
drivers/gpu/drm/radeon/radeon_dp_mst.c:226:21: warning: no previous prototype for 'radeon_mst_best_encoder' [-Wmissing-prototypes]
drivers/gpu/drm/radeon/radeon_dp_mst.c:344:26: warning: no previous prototype for 'radeon_mst_find_connector' [-Wmissing-prototypes]
drivers/gpu/drm/radeon/radeon_dp_mst.c:600:6: warning: no previous prototype for 'radeon_dp_mst_encoder_destroy' [-Wmissing-prototypes]

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Baoyou Xie <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/radeon: add missing header dependencies
Baoyou Xie [Fri, 30 Sep 2016 08:13:01 +0000 (16:13 +0800)]
drm/radeon: add missing header dependencies

We get a few warnings when building kernel with W=1:
drivers/gpu/drm/radeon/radeon_clocks.c:35:10: warning: no previous prototype for 'radeon_legacy_get_engine_clock' [-Wmissing-prototypes]
drivers/gpu/drm/radeon/atombios_encoders.c:75:1: warning: no previous prototype for 'atombios_get_backlight_level' [-Wmissing-prototypes]
drivers/gpu/drm/radeon/r600_cs.c:2268:5: warning: no previous prototype for 'r600_cs_parse' [-Wmissing-prototypes]
drivers/gpu/drm/radeon/evergreen_cs.c:2671:5: warning: no previous prototype for 'evergreen_cs_parse' [-Wmissing-prototypes]
....

In fact, these functions are declared
in drivers/gpu/drm/radeon/radeon_asic.h,
so this patch adds missing header dependencies.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Baoyou Xie <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amd/amdgpu: bump version for memory query info
Junwei Zhang [Wed, 28 Sep 2016 05:27:15 +0000 (13:27 +0800)]
drm/amd/amdgpu: bump version for memory query info

Signed-off-by: Junwei Zhang <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amd/amdgpu: unify memory query info interface
Junwei Zhang [Thu, 29 Sep 2016 01:39:10 +0000 (09:39 +0800)]
drm/amd/amdgpu: unify memory query info interface

Signed-off-by: Junwei Zhang <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: add VRAM manager v2
Christian König [Wed, 24 Aug 2016 13:51:49 +0000 (15:51 +0200)]
drm/amdgpu: add VRAM manager v2

Split VRAM allocations into 4MB blocks.

v2: fix typo in comment, some suggested cleanups
v3: document how to disable the feature, fix rebase issue

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Edward O'Callaghan <[email protected]>
Tested-by: Mike Lothian <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: enable amdgpu_move_blit to handle multiple MM nodes v2
Christian König [Wed, 17 Aug 2016 08:46:52 +0000 (10:46 +0200)]
drm/amdgpu: enable amdgpu_move_blit to handle multiple MM nodes v2

This allows us to move scattered buffers around.

v2: fix a couple of typos, handle scattered to scattered moves as well.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Edward O'Callaghan <[email protected]>
Tested-by: Mike Lothian <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: handle multiple MM nodes in the VMs v2
Christian König [Tue, 16 Aug 2016 15:38:37 +0000 (17:38 +0200)]
drm/amdgpu: handle multiple MM nodes in the VMs v2

This allows us to map scattered VRAM BOs to the VMs.

v2: fix offset handling, use pfn instead of offset,
    fix PAGE_SIZE != AMDGPU_GPU_PAGE_SIZE case

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Edward O'Callaghan <[email protected]>
Tested-by: Mike Lothian <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: set at least the node size in the gtt manager
Christian König [Wed, 14 Sep 2016 08:35:19 +0000 (10:35 +0200)]
drm/amdgpu: set at least the node size in the gtt manager

Otherwise the new VM code becomes confused.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Edward O'Callaghan <[email protected]>
Tested-by: Mike Lothian <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: use explicit limit for VRAM_CONTIGUOUS
Christian König [Wed, 24 Aug 2016 12:30:21 +0000 (14:30 +0200)]
drm/amdgpu: use explicit limit for VRAM_CONTIGUOUS

Split VRAM won't have a valid offset, so just set an explicit limit
when the flag is given to trigger reallocation if necessary.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Edward O'Callaghan <[email protected]>
Tested-by: Mike Lothian <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: add AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS flag v3
Christian König [Mon, 15 Aug 2016 15:00:22 +0000 (17:00 +0200)]
drm/amdgpu: add AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS flag v3

Add a flag noting that a BO must be created using linear VRAM
and set this flag on all in kernel users where appropriate.

Hopefully I haven't missed anything.

v2: add it in a few more places, fix CPU mapping.
v3: rename to VRAM_CONTIGUOUS, fix typo in CS code.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Edward O'Callaghan <[email protected]>
Tested-by: Mike Lothian <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amd/amdgpu: add info about vram and gtt max allocation size
Junwei Zhang [Wed, 21 Sep 2016 02:33:26 +0000 (10:33 +0800)]
drm/amd/amdgpu: add info about vram and gtt max allocation size

Signed-off-by: Junwei Zhang <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amd/amdgpu: add info about vram and gtt total size
Junwei Zhang [Wed, 21 Sep 2016 02:17:22 +0000 (10:17 +0800)]
drm/amd/amdgpu: add info about vram and gtt total size

Signed-off-by: Junwei Zhang <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/dce6: don't enable HPD Rx interrupts
Alex Deucher [Wed, 28 Sep 2016 18:23:49 +0000 (14:23 -0400)]
drm/amdgpu/dce6: don't enable HPD Rx interrupts

Not used currently.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/dce6: RMW hpd registers
Alex Deucher [Wed, 28 Sep 2016 18:21:55 +0000 (14:21 -0400)]
drm/amdgpu/dce6: RMW hpd registers

No need to hard code the entire register to just
set/clear one bit.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/dce6: simplify hpd code
Alex Deucher [Wed, 28 Sep 2016 18:15:24 +0000 (14:15 -0400)]
drm/amdgpu/dce6: simplify hpd code

Use an address offset like other dce code.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/dce11: simplify hpd code
Alex Deucher [Wed, 28 Sep 2016 17:56:50 +0000 (13:56 -0400)]
drm/amdgpu/dce11: simplify hpd code

use the hpd enum directly as an index

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/dce8: RMW hpd registers
Alex Deucher [Wed, 28 Sep 2016 17:50:27 +0000 (13:50 -0400)]
drm/amdgpu/dce8: RMW hpd registers

No need to hard code the entire register to just
set/clear one bit.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/dce10: simplify hpd code
Alex Deucher [Wed, 28 Sep 2016 17:44:00 +0000 (13:44 -0400)]
drm/amdgpu/dce10: simplify hpd code

use the hpd enum directly as an index

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/dce8: simplify hpd code
Alex Deucher [Wed, 28 Sep 2016 16:59:11 +0000 (12:59 -0400)]
drm/amdgpu/dce8: simplify hpd code

Use an address offset like other dce code.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amd/amdgpu: For virtual display, enable multi crtcs. (v3)
Emily Deng [Fri, 30 Sep 2016 17:02:18 +0000 (13:02 -0400)]
drm/amd/amdgpu: For virtual display, enable multi crtcs. (v3)

Enable multi crtcs for virtual display, user can set the number of crtcs
by amdgpu module parameter  virtual_display.

v2: make timers per crtc
v3: agd: simplify implementation

Signed-off-by: Emily Deng <[email protected]>
Reviewed-By: Emily Deng <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu: rename amdgpu_whether_enable_virtual_display
Alex Deucher [Fri, 30 Sep 2016 16:43:04 +0000 (12:43 -0400)]
drm/amdgpu: rename amdgpu_whether_enable_virtual_display

to match the other functions in that file.

Reviewed-By: Emily Deng <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agoRevert "drm/amdgpu: Add virtual connector and encoder macros."
Alex Deucher [Fri, 30 Sep 2016 16:38:20 +0000 (12:38 -0400)]
Revert "drm/amdgpu: Add virtual connector and encoder macros."

This reverts commit 16925c92dbd97524655525b6816625e1f0063d12.

This is no longer necessary.

Reviewed-By: Emily Deng <[email protected]>
8 years agodrm/amdgpu: simplify encoder and connector setup (v2)
Alex Deucher [Fri, 30 Sep 2016 16:37:36 +0000 (12:37 -0400)]
drm/amdgpu: simplify encoder and connector setup (v2)

No need to emulate all of the stuff for real hw.

v2: warning fix

Reviewed-By: Emily Deng <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/virtual_dce: clean up interrupt handling
Alex Deucher [Fri, 30 Sep 2016 15:41:37 +0000 (11:41 -0400)]
drm/amdgpu/virtual_dce: clean up interrupt handling

We handle the virtual interrupts from a timer so no
need to try an look like we are handling IV ring events.

Reviewed-By: Emily Deng <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/virtual_dce: no need to an irq process callback
Alex Deucher [Fri, 30 Sep 2016 15:23:30 +0000 (11:23 -0400)]
drm/amdgpu/virtual_dce: no need to an irq process callback

Virtual crtcs interrupts do not show up in the IV ring,
so it will never be called.

Reviewed-By: Emily Deng <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/virtual_dce: drop pageflip_irq funcs
Alex Deucher [Fri, 30 Sep 2016 15:19:41 +0000 (11:19 -0400)]
drm/amdgpu/virtual_dce: drop pageflip_irq funcs

Never used.

Reviewed-By: Emily Deng <[email protected]>
Acked-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/virtual_dce: drop empty function
Alex Deucher [Fri, 30 Sep 2016 03:19:25 +0000 (23:19 -0400)]
drm/amdgpu/virtual_dce: drop empty function

No need to ack non-existent interrupts.

Reviewed-By: Emily Deng <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/virtual_dce: add dce6 support
Alex Deucher [Fri, 30 Sep 2016 03:36:12 +0000 (23:36 -0400)]
drm/amdgpu/virtual_dce: add dce6 support

disable the real dce hw if the asic supports dce.

Reviewed-By: Emily Deng <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm/amdgpu/dce6: add dce_v6_0_disable_dce
Alex Deucher [Fri, 30 Sep 2016 03:30:21 +0000 (23:30 -0400)]
drm/amdgpu/dce6: add dce_v6_0_disable_dce

Needed for virtual dce support

Reviewed-By: Emily Deng <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
8 years agodrm: convert DT component matching to component_match_add_release()
Russell King [Wed, 19 Oct 2016 10:28:27 +0000 (11:28 +0100)]
drm: convert DT component matching to component_match_add_release()

Convert DT component matching to use component_match_add_release().

Acked-by: Jyri Sarha <[email protected]>
Reviewed-by: Jyri Sarha <[email protected]>
Signed-off-by: Russell King <[email protected]>
Signed-off-by: Sean Paul <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
8 years agodma-buf: Rename struct fence to dma_fence
Chris Wilson [Tue, 25 Oct 2016 12:00:45 +0000 (13:00 +0100)]
dma-buf: Rename struct fence to dma_fence

I plan to usurp the short name of struct fence for a core kernel struct,
and so I need to rename the specialised fence/timeline for DMA
operations to make room.

A consensus was reached in
https://lists.freedesktop.org/archives/dri-devel/2016-July/113083.html
that making clear this fence applies to DMA operations was a good thing.
Since then the patch has grown a bit as usage increases, so hopefully it
remains a good thing!

(v2...: rebase, rerun spatch)
v3: Compile on msm, spotted a manual fixup that I broke.
v4: Try again for msm, sorry Daniel

coccinelle script:
@@

@@
- struct fence
+ struct dma_fence
@@

@@
- struct fence_ops
+ struct dma_fence_ops
@@

@@
- struct fence_cb
+ struct dma_fence_cb
@@

@@
- struct fence_array
+ struct dma_fence_array
@@

@@
- enum fence_flag_bits
+ enum dma_fence_flag_bits
@@

@@
(
- fence_init
+ dma_fence_init
|
- fence_release
+ dma_fence_release
|
- fence_free
+ dma_fence_free
|
- fence_get
+ dma_fence_get
|
- fence_get_rcu
+ dma_fence_get_rcu
|
- fence_put
+ dma_fence_put
|
- fence_signal
+ dma_fence_signal
|
- fence_signal_locked
+ dma_fence_signal_locked
|
- fence_default_wait
+ dma_fence_default_wait
|
- fence_add_callback
+ dma_fence_add_callback
|
- fence_remove_callback
+ dma_fence_remove_callback
|
- fence_enable_sw_signaling
+ dma_fence_enable_sw_signaling
|
- fence_is_signaled_locked
+ dma_fence_is_signaled_locked
|
- fence_is_signaled
+ dma_fence_is_signaled
|
- fence_is_later
+ dma_fence_is_later
|
- fence_later
+ dma_fence_later
|
- fence_wait_timeout
+ dma_fence_wait_timeout
|
- fence_wait_any_timeout
+ dma_fence_wait_any_timeout
|
- fence_wait
+ dma_fence_wait
|
- fence_context_alloc
+ dma_fence_context_alloc
|
- fence_array_create
+ dma_fence_array_create
|
- to_fence_array
+ to_dma_fence_array
|
- fence_is_array
+ dma_fence_is_array
|
- trace_fence_emit
+ trace_dma_fence_emit
|
- FENCE_TRACE
+ DMA_FENCE_TRACE
|
- FENCE_WARN
+ DMA_FENCE_WARN
|
- FENCE_ERR
+ DMA_FENCE_ERR
)
 (
 ...
 )

Signed-off-by: Chris Wilson <[email protected]>
Reviewed-by: Gustavo Padovan <[email protected]>
Acked-by: Sumit Semwal <[email protected]>
Acked-by: Christian König <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
8 years agodrm/i915: Include the kernel uptime in the error state
Chris Wilson [Tue, 25 Oct 2016 12:16:02 +0000 (13:16 +0100)]
drm/i915: Include the kernel uptime in the error state

As well as knowing when the error occurred, it is more interesting to me
to know how long after booting the error occurred, and for good measure
record the time since last hw initialisation.

Signed-off-by: Chris Wilson <[email protected]>
Reviewed-by: Matthew Auld <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
8 years agodrm/i915: Mark the GuC log buffer flush interrupts handling WQ as freezable
Akash Goel [Wed, 12 Oct 2016 16:24:44 +0000 (21:54 +0530)]
drm/i915: Mark the GuC log buffer flush interrupts handling WQ as freezable

The GuC log buffer flush work item has to do a register access to send the
ack to GuC and this work item, if not synced before suspend, can potentially
get executed after the GFX device is suspended. This work item function uses
rpm get/put calls around the Hw access, which covers the rpm suspend case
but for system suspend a sync would be required as kernel can potentially
schedule the work items even after some devices, including GFX, have been
put to suspend. But sync has to be done only for the system suspend case,
as sync along with rpm get/put can cause a deadlock for rpm suspend path.
To have the sync, but like a NOOP, for rpm suspend path also this work
item could have been queued from the irq handler only when the device is
runtime active & kept active while that work item is pending or getting
executed but an interrupt can come even after the device is out of use and
so can potentially lead to missing of this work item.

By marking the workqueue, dedicated for handling GuC log buffer flush
interrupts, as freezable we don't have to bother about flushing of this
work item from the suspend hooks, the pending work item if any will be
either executed before the suspend or scheduled later on resume. This way
the handling of log buffer flush work item can be kept same between system
suspend & rpm suspend.

Suggested-by: Imre Deak <[email protected]>
Cc: Imre Deak <[email protected]>
Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Imre Deak <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Early creation of relay channel for capturing boot time logs
Akash Goel [Wed, 12 Oct 2016 16:24:43 +0000 (21:54 +0530)]
drm/i915: Early creation of relay channel for capturing boot time logs

As per the current i915 Driver load sequence, debugfs registration is done
at the end and so the relay channel debugfs file is also created after that
but the GuC firmware is loaded much earlier in the sequence.
As a result Driver could miss capturing the boot-time logs of GuC firmware
if there are flush interrupts from the GuC side.
Relay has a provision to support early logging where initially only relay
channel can be created, to have buffers for storing logs, and later on
channel can be associated with a debugfs file at appropriate time.
Have availed that, which allows Driver to capture boot time logs also,
which can be collected once Userspace comes up.

v2:
- Remove the couple of FIXMEs, as now the relay channel will be created
  early before enabling the flush interrupts, so no possibility of relay
  channel pointer being modified & read at the same time from 2 different
  execution contexts.
- Rebase.

v3:
- Add a comment to justiy setting 'is_global' before the NULL check on the
  parent directory dentry pointer.

Suggested-by: Chris Wilson <[email protected]>
Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Use SSE4.1 movntdqa based memcpy for sampling GuC log buffer
Akash Goel [Wed, 12 Oct 2016 16:24:42 +0000 (21:54 +0530)]
drm/i915: Use SSE4.1 movntdqa based memcpy for sampling GuC log buffer

To ensure that we always get the up-to-date data from log buffer, its
better to access the buffer through an uncached CPU mapping. Also the way
buffer is accessed from GuC & Host side, manually doing cache flush may
not be effective always if cached CPU mapping is used. In order to avoid
any performance drop & have fast reads from the GuC log buffer, used SSE4.1
movntdqa based memcpy function i915_memcpy_from_wc, as copying using
movntqda from WC type memory is almost as fast as reading from WB memory.
This way log buffer sampling time will not get increased and so would be
able to deal with the flush interrupt storm when GuC is generating logs at
a very high rate.
Ideally SSE 4.1 should be present on all chipsets supporting GuC based
submisssions, but if not then logging will not be enabled.

v2: Rebase.

v3: Squash the WC type vmalloc mapping patch with this patch. (Chris)

Suggested-by: Chris Wilson <[email protected]>
Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Debugfs support for GuC logging control
Sagar Arun Kamble [Wed, 12 Oct 2016 16:24:41 +0000 (21:54 +0530)]
drm/i915: Debugfs support for GuC logging control

This patch provides debugfs interface i915_guc_output_control for
on the fly enabling/disabling of logging in GuC firmware and controlling
the verbosity level of logs.
The value written to the file, should have bit 0 set to enable logging and
bits 4-7 should contain the verbosity info.

v2: Add a forceful flush, to collect left over logs, on disabling logging.
    Useful for Validation.

v3: Besides minor cleanup, implement read method for the debugfs file and
    set the guc_log_level to -1 when logging is disabled. (Tvrtko)

v4: Minor cleanup & rebase. (Tvrtko)

v5:
- Lock struct_mutex after the NULL check for guc log buffer vma. (Chris)
- Rebase.

Signed-off-by: Sagar Arun Kamble <[email protected]>
Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Support for forceful flush of GuC log buffer
Sagar Arun Kamble [Wed, 12 Oct 2016 16:24:40 +0000 (21:54 +0530)]
drm/i915: Support for forceful flush of GuC log buffer

GuC firmware sends a flush interrupt to Host when the log buffer is half
full and at that time only it updates the log buffer state.
But in certain cases, as described below, it could be useful to have all
that even when log buffer is only partially full. For that there is a force
log buffer flush Host2GuC action supported by GuC firmware.

For Validation requirements, a forceful flush is needed to collect the
left over logs on disabling logging. The same can be done before proceeding
with GPU/GuC reset as there could be some data in log buffer which is yet
to be captured and those logs would be particularly useful to understand
that why the reset was initiated.

Signed-off-by: Sagar Arun Kamble <[email protected]>
Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Augment i915 error state to include the dump of GuC log buffer
Akash Goel [Wed, 12 Oct 2016 16:24:39 +0000 (21:54 +0530)]
drm/i915: Augment i915 error state to include the dump of GuC log buffer

Added the dump of GuC log buffer to i915 error state, as the contents of
GuC log buffer would also be useful to determine that why the GPU reset
was triggered.

v2:
- For uniformity use existing helper function print_error_obj() to
  dump out contents of GuC log buffer, pretty printing is better left
  to userspace. (Chris)
- Skip the dumping of GuC log buffer when logging is disabled as it
  won't be of any use.
- Rebase.

v3: Rebase.

Suggested-by: Chris Wilson <[email protected]>
Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Increase GuC log buffer size to reduce flush interrupts
Akash Goel [Wed, 12 Oct 2016 16:24:38 +0000 (21:54 +0530)]
drm/i915: Increase GuC log buffer size to reduce flush interrupts

In cases where GuC generate logs at a very high rate, correspondingly
the rate of flush interrupts is also very high.
So far total 8 pages were allocated for storing both ISR & DPC logs.
As per the half-full draining protocol followed by GuC, by doubling
the number of pages, the frequency of flush interrupts can be cut down
to almost half, which then helps in reducing the logging overhead.
So now allocating 8 pages apiece for ISR & DPC logs.
This also helps in reducing the output log file size, apart from
reducing the flush interrupt count. With the original settings,
44 KB was needed for one snapshot. With modified settings, 76 KB is
needed for a snapshot which will be equivalent to 2 snapshots of the
original setting. So 12KB saving, every 88 KB, over the original setting.

Suggested-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Optimization to reduce the sampling time of GuC log buffer
Akash Goel [Wed, 12 Oct 2016 16:24:37 +0000 (21:54 +0530)]
drm/i915: Optimization to reduce the sampling time of GuC log buffer

GuC firmware sends an interrupt to flush the log buffer when it becomes
half full, so Driver doesn't really need to sample the complete buffer
and can just copy only the newly written data by GuC into the local
buffer, i.e. as per the read & write pointer values.
Moreover the flush interrupt would generally come for one type of log
buffer, when it becomes half full, so at that time the other 2 types of
log buffer would comparatively have much lesser unread data in them.
In case of overflow reported by GuC, Driver do need to copy the entire
buffer as the whole buffer would contain the unread data.

v2: Rebase.

v3: Fix the blooper of doing the copy twice. (Tvrtko)

v4: Add curlies for 'else' case also, matching the 'if'. (Tvrtko)

Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Add stats for GuC log buffer flush interrupts
Akash Goel [Wed, 12 Oct 2016 16:24:36 +0000 (21:54 +0530)]
drm/i915: Add stats for GuC log buffer flush interrupts

GuC firmware sends an interrupt to flush the log buffer when it
becomes half full. GuC firmware also tracks how many times the
buffer overflowed.
It would be useful to maintain a statistics of how many flush
interrupts were received and for which type of log buffer,
along with the overflow count of each buffer type.
Augmented i915_log_info debugfs to report back these statistics.

v2:
- Update the logic to detect multiple overflows between the 2
  flush interrupts and also log a message for overflow (Tvrtko)
- Track the number of times there was no free sub buffer to capture
  the GuC log buffer. (Tvrtko)

v3:
- Fix the printf field width for overflow counter, set it to 10 as per the
  max value of u32, which takes 10 digits in decimal form. (Tvrtko)

v4:
- Move the log buffer overflow handling to a new function for better
  readability. (Tvrtko)

Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: New lock to serialize the Host2GuC actions
Akash Goel [Wed, 12 Oct 2016 16:24:35 +0000 (21:54 +0530)]
drm/i915: New lock to serialize the Host2GuC actions

With the addition of new Host2GuC actions related to GuC logging, there
is a need of a lock to serialize them, as they can execute concurrently
with each other and also with other existing actions.

v2: Use mutex in place of spinlock to serialize, as sleep can happen
    while waiting for the action's response from GuC. (Tvrtko)

v3: To conform to the general rules, acquire mutex before taking the
    forcewake. (Tvrtko)

Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Add a relay backed debugfs interface for capturing GuC logs
Akash Goel [Wed, 12 Oct 2016 16:24:34 +0000 (21:54 +0530)]
drm/i915: Add a relay backed debugfs interface for capturing GuC logs

Added a new debugfs interface '/sys/kernel/debug/dri/guc_log' for the
User to capture GuC firmware logs. Availed relay framework to implement
the interface, where Driver will have to just use a relay API to store
snapshots of the GuC log buffer in the buffer managed by relay.
The snapshot will be taken when GuC firmware sends a log buffer flush
interrupt and up to four snapshots could be stored in the relay buffer.
The relay buffer will be operated in a mode where it will overwrite the
data not yet collected by User.
Besides mmap method, through which User can directly access the relay
buffer contents, relay also supports the 'poll' method. Through the 'poll'
call on log file, User can come to know whenever a new snapshot of the
log buffer is taken by Driver, so can run in tandem with the Driver and
capture the logs in a sustained/streaming manner, without any loss of data.

v2: Defer the creation of relay channel & associated debugfs file, as
    debugfs setup is now done at the end of i915 Driver load. (Chris)

v3:
- Switch to no-overwrite mode for relay.
- Fix the relay sub buffer switching sequence.

v4:
- Update i915 Kconfig to select RELAY config. (TvrtKo)
- Log a message when there is no sub buffer available to capture
  the GuC log buffer. (Tvrtko)
- Increase the number of relay sub buffers to 8 from 4, to have
  sufficient buffering for boot time logs

v5:
- Fix the alignment, indentation issues and some minor cleanup. (Tvrtko)
- Update the comment to elaborate on why a relay channel has to be
  associated with the debugfs file. (Tvrtko)

v6:
- Move the write to 'is_global' after the NULL check on parent directory
  dentry pointer. (Tvrtko)

v7: Add a BUG_ON to validate relay buffer allocation size. (Chris)

Testcase: igt/tools/intel_guc_logger

Suggested-by: Chris Wilson <[email protected]>
Signed-off-by: Sourab Gupta <[email protected]>
Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Handle log buffer flush interrupt event from GuC
Sagar Arun Kamble [Wed, 12 Oct 2016 16:24:32 +0000 (21:54 +0530)]
drm/i915: Handle log buffer flush interrupt event from GuC

GuC ukernel sends an interrupt to Host to flush the log buffer
and expects Host to correspondingly update the read pointer
information in the state structure, once it has consumed the
log buffer contents by copying them to a file or buffer.
Even if Host couldn't copy the contents, it can still update the
read pointer so that logging state is not disturbed on GuC side.

v2:
- Use a dedicated workqueue for handling flush interrupt. (Tvrtko)
- Reduce the overall log buffer copying time by skipping the copy of
  crash buffer area for regular cases and copying only the state
  structure data in first page.

v3:
 - Create a vmalloc mapping of log buffer. (Chris)
 - Cover the flush acknowledgment under rpm get & put.(Chris)
 - Revert the change of skipping the copy of crash dump area, as
   not really needed, will be covered by subsequent patch.

v4:
 - Destroy the wq under the same condition in which it was created,
   pass dev_piv pointer instead of dev to newly added GuC function,
   add more comments & rename variable for clarity. (Tvrtko)

v5:
- Allocate & destroy the dedicated wq, for handling flush interrupt,
  from the setup/teardown routines of GuC logging. (Chris)
- Validate the log buffer size value retrieved from state structure
  and do some minor cleanup. (Tvrtko)
- Fix error/warnings reported by checkpatch. (Tvrtko)
- Rebase.

v6:
 - Remove the interrupts_enabled check from guc_capture_logs_work, need
   to process that last work item also, queued just before disabling the
   interrupt as log buffer flush interrupt handling is a bit different
   case where GuC is actually expecting an ACK from host, which should be
   provided to keep the logging going.
   Sync against the work will be done by caller disabling the interrupt.
 - Don't sample the log buffer size value from state structure, directly
   use the expected value to move the pointer & do the copy and that cannot
   go wrong (out of bounds) as Driver only allocated the log buffer and the
   relay buffers. Driver should refrain from interpreting the log packet,
   as much possible and let Userspace parser detect the anomaly. (Chris)

v7:
- Use switch statement instead of 'if else' for retrieving the GuC log
  buffer size. (Tvrtko)
- Refactored the log buffer copying function and shortended the name of
  couple of variables for better readability. (Tvrtko)

v8:
- Make the dedicated wq as a high priority one to further reduce the
  turnaround time of handing log buffer flush event from GuC.

Signed-off-by: Sagar Arun Kamble <[email protected]>
Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Support for GuC interrupts
Sagar Arun Kamble [Wed, 12 Oct 2016 16:24:31 +0000 (21:54 +0530)]
drm/i915: Support for GuC interrupts

There are certain types of interrupts which Host can receive from GuC.
GuC ukernel sends an interrupt to Host for certain events, like for
example retrieve/consume the logs generated by ukernel.
This patch adds support to receive interrupts from GuC but currently
enables & partially handles only the interrupt sent by GuC ukernel.
Future patches will add support for handling other interrupt types.

v2:
- Use common low level routines for PM IER/IIR programming (Chris)
- Rename interrupt functions to gen9_xxx from gen8_xxx (Chris)
- Replace disabling of wake ref asserts with rpm get/put (Chris)

v3:
- Update comments for more clarity. (Tvrtko)
- Remove the masking of GuC interrupt, which was kept masked till the
  start of bottom half, its not really needed as there is only a
  single instance of work item & wq is ordered. (Tvrtko)

v4:
- Rebase.
- Rename guc_events to pm_guc_events so as to be indicative of the
  register/control block it is associated with. (Chris)
- Add handling for back to back log buffer flush interrupts.

v5:
- Move the read & clearing of register, containing Guc2Host message
  bits, outside the irq spinlock. (Tvrtko)

v6:
- Move the log buffer flush interrupt related stuff to the following
  patch so as to do only generic bits in this patch. (Tvrtko)
- Rebase.

v7:
- Remove the interrupts_enabled check from gen9_guc_irq_handler, want to
  process that last interrupt also before disabling the interrupt, sync
  against the work queued by irq handler will be done by caller disabling
  the interrupt.

Signed-off-by: Sagar Arun Kamble <[email protected]>
Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Add low level set of routines for programming PM IER/IIR/IMR register set
Akash Goel [Wed, 12 Oct 2016 16:24:30 +0000 (21:54 +0530)]
drm/i915: Add low level set of routines for programming PM IER/IIR/IMR register set

So far PM IER/IIR/IMR registers were being used only for Turbo related
interrupts. But interrupts coming from GuC also use the same set.
As a precursor to supporting GuC interrupts, added new low level routines
so as to allow sharing the programming of PM IER/IIR/IMR registers between
Turbo & GuC.
Also similar to PM IMR, maintaining a bitmask for PM IER register, to allow
easy sharing of it between Turbo & GuC without involving a rmw operation.

v2:
- For appropriateness & avoid any ambiguity, rename old functions
  enable/disable pm_irq to mask/unmask pm_irq and rename new functions
  enable/disable pm_interrupts to enable/disable pm_irq. (Tvrtko)
- Use u32 in place of uint32_t. (Tvrtko)

v3:
- Rename the fields pm_irq_mask & pm_ier_mask and do some cleanup. (Chris)
- Rebase.

v4: Fix the inadvertent disabling of User interrupt for VECS ring causing
    failure for certain IGTs.

v5: Use dev_priv with HAS_VEBOX macro. (Tvrtko)

Suggested-by: Chris Wilson <[email protected]>
Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: New structure to contain GuC logging related fields
Akash Goel [Wed, 12 Oct 2016 16:24:29 +0000 (21:54 +0530)]
drm/i915: New structure to contain GuC logging related fields

So far there were 2 fields related to GuC logs in 'intel_guc' structure.
For the support of capturing GuC logs & storing them in a local buffer,
multiple new fields would have to be added. This warrants a separate
structure to contain the fields related to GuC logging state.
Added a new structure 'intel_guc_log' and instance of it inside
'intel_guc' structure.

v2: Rebase.

Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Add GuC ukernel logging related fields to fw interface file
Sagar Arun Kamble [Wed, 12 Oct 2016 16:24:28 +0000 (21:54 +0530)]
drm/i915: Add GuC ukernel logging related fields to fw interface file

The first page of the GuC log buffer contains state info or meta data
which is required to parse the logs contained in the subsequent pages.
The structure representing the state info is added to interface file
as Driver would need to handle log buffer flush interrupts from GuC.
Added an enum for the different message/event types that can be send
by the GuC ukernel to Host.
Also added 2 new Host to GuC action types to inform GuC when Host has
flushed the log buffer and forcefuly cause the GuC to send a new
log buffer flush interrupt.

v2:
- Make documentation of log buffer state structure more elaborate &
  rename LOGBUFFERFLUSH action to LOG_BUFFER_FLUSH for consistency.(Tvrtko)

v3: Add GuC log buffer layout diagram for more clarity.

Signed-off-by: Sagar Arun Kamble <[email protected]>
Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agodrm/i915: Decouple GuC log setup from verbosity parameter
Sagar Arun Kamble [Wed, 12 Oct 2016 16:24:27 +0000 (21:54 +0530)]
drm/i915: Decouple GuC log setup from verbosity parameter

GuC Log buffer allocation was tied up with verbosity level module param
i915.guc_log_level. User would be given a provision to enable firmware
logging at runtime, through a host2guc action, and not necessarily during
Driver load time. But the address of log buffer can be passed only in
init params, at firmware load time, so GuC has to be reset and firmware
needs to be reloaded to pass the log buffer address at runtime.
To avoid reset of GuC & reload of firmware, allocation of log buffer will
be done always but logging would be enabled initially on GuC side based on
the value of module parameter guc_log_level.

v2: Update commit message to describe the constraint with allocation of
    log buffer at runtime. (Tvrtko)

v3: Rebase.

Signed-off-by: Sagar Arun Kamble <[email protected]>
Signed-off-by: Akash Goel <[email protected]>
Reviewed-by: Tvrtko Ursulin <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
8 years agoMerge remote-tracking branch 'airlied/drm-next' into topic/drm-misc
Daniel Vetter [Tue, 25 Oct 2016 08:06:04 +0000 (10:06 +0200)]
Merge remote-tracking branch 'airlied/drm-next' into topic/drm-misc

Backmerge latest drm-next to have a baseline for the
s/fence/dma_fence/ patch from Chris.

Signed-off-by: Daniel Vetter <[email protected]>
8 years agoMerge remote-tracking branch 'airlied/drm-next' into drm-intel-next-queued
Daniel Vetter [Tue, 25 Oct 2016 06:57:53 +0000 (08:57 +0200)]
Merge remote-tracking branch 'airlied/drm-next' into drm-intel-next-queued

Backmerge because Chris Wilson needs the very latest&greates of
Gustavo Padovan's sync_file work, specifically the refcounting changes
from:

commit 30cd85dd6edc86ea8d8589efb813f1fad41ef233
Author: Gustavo Padovan <[email protected]>
Date:   Wed Oct 19 15:48:32 2016 -0200

    dma-buf/sync_file: hold reference to fence when creating sync_file

Also good to sync in general since git tends to get confused with the
cherry-picking going on.

Signed-off-by: Daniel Vetter <[email protected]>
8 years agodma-buf/fence: add an lockdep_assert_held()
Rob Clark [Mon, 24 Oct 2016 19:57:10 +0000 (15:57 -0400)]
dma-buf/fence: add an lockdep_assert_held()

Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Chris Wilson <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
8 years agodrm/dp: Factor out helper to distinguish between branch and sink devices
Imre Deak [Mon, 24 Oct 2016 16:33:24 +0000 (19:33 +0300)]
drm/dp: Factor out helper to distinguish between branch and sink devices

This check is open-coded in a few places, so it makes sense to simplify
things by having a helper for it similar to the rest of DPCD feature
helpers.

v2: (Jani)
- Move the helper to drm_dp_helper.h.
- Split out this change to a separate patch.

Cc: Jani Nikula <[email protected]>
Cc: [email protected]
Signed-off-by: Imre Deak <[email protected]>
Reviewed-by: Jani Nikula <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
8 years agoMerge tag 'drm-intel-next-2016-10-24' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Tue, 25 Oct 2016 06:36:13 +0000 (16:36 +1000)]
Merge tag 'drm-intel-next-2016-10-24' of git://anongit.freedesktop.org/drm-intel into drm-next

- first slice of the gvt device model (Zhenyu et al)
- compression support for gpu error states (Chris)
- sunset clause on gpu errors resulting in dmesg noise telling users
  how to report them
- .rodata diet from Tvrtko
- switch over lots of macros to only take dev_priv (Tvrtko)
- underrun suppression for dp link training (Ville)
- lspcon (hmdi 2.0 on skl/bxt) support from Shashank Sharma, polish
  from Jani
- gen9 wm fixes from Paulo&Lyude
- updated ddi programming for kbl (Rodrigo)
- respect alternate aux/ddc pins (from vbt) for all ddi ports (Ville)

* tag 'drm-intel-next-2016-10-24' of git://anongit.freedesktop.org/drm-intel: (227 commits)
  drm/i915: Update DRIVER_DATE to 20161024
  drm/i915: Stop setting SNB min-freq-table 0 on powersave setup
  drm/i915/dp: add lane_count check in intel_dp_check_link_status
  drm/i915: Fix whitespace issues
  drm/i915: Clean up DDI DDC/AUX CH sanitation
  drm/i915: Respect alternate_ddc_pin for all DDI ports
  drm/i915: Respect alternate_aux_channel for all DDI ports
  drm/i915/gen9: Remove WaEnableYV12BugFixInHalfSliceChicken7
  drm/i915: KBL - Recommended buffer translation programming for DisplayPort
  drm/i915: Move down skl/kbl ddi iboost and n_edp_entires fixup
  drm/i915: Add a sunset clause to GPU hang logging
  drm/i915: Stop reporting error details in dmesg as well as the error-state
  drm/i915/gvt: do not ignore return value of create_scratch_page
  drm/i915/gvt: fix spare warnings on odd constant _Bool cast
  drm/i915/gvt: mark symbols static where possible
  drm/i915/gvt: fix sparse warnings on different address spaces
  drm/i915/gvt: properly access enabled intel_engine_cs
  drm/i915/gvt: Remove defunct vmap_batch()
  drm/i915/gvt: Use common mapping routines for shadow_bb object
  drm/i915/gvt: Use common mapping routines for indirect_ctx object
  ...

8 years agoMerge tag 'topic/drm-misc-2016-10-24' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Tue, 25 Oct 2016 06:35:20 +0000 (16:35 +1000)]
Merge tag 'topic/drm-misc-2016-10-24' of git://anongit.freedesktop.org/drm-intel into drm-next

First -misc pull for 4.10:
- drm_format rework from Laurent
- reservation patches from Chris that missed 4.9.
- aspect ratio support in infoframe helpers and drm mode/edid code
  (Shashank Sharma)
- rotation rework from Ville (first parts at least)
- another attempt at the CRC debugfs interface from Tomeu
- piles and piles of misc patches all over

* tag 'topic/drm-misc-2016-10-24' of git://anongit.freedesktop.org/drm-intel: (55 commits)
  drm: Use u64 for intermediate dotclock calculations
  drm/i915: Use the per-plane rotation property
  drm/omap: Use per-plane rotation property
  drm/omap: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0
  drm/atmel-hlcdc: Use per-plane rotation property
  drm/arm: Use per-plane rotation property
  drm: Add support for optional per-plane rotation property
  drm/atomic: Reject attempts to use multiple rotation angles at once
  drm: Add drm_rotation_90_or_270()
  dma-buf/sync_file: hold reference to fence when creating sync_file
  drm/virtio: kconfig: Fixup white space.
  drm/fence: release fence reference when canceling event
  drm/i915: Handle early failure during intel_get_load_detect_pipe
  drm/fb_cma_helper: do not free fbdev if there is none
  drm: fix sparse warnings on undeclared symbols in crc debugfs
  gpu: Remove depends on RESET_CONTROLLER when not a provider
  i915: don't call drm_atomic_state_put on invalid pointer
  drm: Don't export the drm_fb_get_bpp_depth() function
  drm/arm: mali-dp: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()
  drm: vmwgfx: Replace drm_fb_get_bpp_depth() with drm_format_info()
  ...

This page took 0.106827 seconds and 4 git commands to generate.