sfrench/cifs-2.6.git
5 years agoMerge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm...
Daniel Vetter [Tue, 18 Dec 2018 13:24:52 +0000 (14:24 +0100)]
Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm-next

Lucas writes:

"nothing major this time, mostly some cleanups that were found on the
way of reworking the code in preparation for new feature additions."

Small conflict in drivers/gpu/drm/etnaviv/etnaviv_drv.c because
drm-misc-next also has a patch to switch over to _put() functions.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
From: Lucas Stach <l.stach@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1545130845.5874.23.camel@pengutronix.de
5 years agodrm/etnaviv: remove lastctx member from gpu struct
Lucas Stach [Thu, 22 Nov 2018 14:29:27 +0000 (15:29 +0100)]
drm/etnaviv: remove lastctx member from gpu struct

It only written and we don't infer any useful information from
it anymore. Remove it.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
5 years agodrm/etnaviv: replace header include with forward declaration
Lucas Stach [Mon, 15 Oct 2018 10:49:07 +0000 (12:49 +0200)]
drm/etnaviv: replace header include with forward declaration

The etnaviv_gpu header only needs to know about the pointer types, so
replace by a forward declaration and only include the headers where needed.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
5 years agodrm/etnaviv: remove unnecessary local irq disable
Lucas Stach [Wed, 12 Sep 2018 10:55:42 +0000 (12:55 +0200)]
drm/etnaviv: remove unnecessary local irq disable

The only event function that is called from IRQ context is event_free,
which is already using atomic bitmap operations, so we can avoid taking
the event spinlock in this function completely. As other the other
functions still using the event spinlock are all called from normal
process context, we can avoid disabling IRQs while holding the spinlock.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
5 years agoMerge tag 'exynos-drm-next-for-v4.21-v2' of git://git.kernel.org/pub/scm/linux/kernel...
Daniel Vetter [Fri, 14 Dec 2018 10:27:24 +0000 (11:27 +0100)]
Merge tag 'exynos-drm-next-for-v4.21-v2' of git://git./linux/kernel/git/daeinki/drm-exynos into drm-next

Add configurable plane alpha and pixel blend mode support
- This patch series adds configurable plane alpha and pixel blend mode
  support for FIMD device driver.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Inki Dae <inki.dae@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1544772430-8295-1-git-send-email-inki.dae@samsung.com
5 years agodrm/exynos: fimd: Make pixel blend mode configurable
Christoph Manszewski [Thu, 25 Oct 2018 15:23:50 +0000 (17:23 +0200)]
drm/exynos: fimd: Make pixel blend mode configurable

The fimd hardware supports different blend modes. Add pixel blend mode
property and make it configurable, by modifying the blend equation.

Tested on TRATS2 with Exynos 4412 CPU, on top of linux-next-20181019.

Signed-off-by: Christoph Manszewski <c.manszewski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos: fimd: Make plane alpha configurable
Christoph Manszewski [Thu, 25 Oct 2018 15:23:49 +0000 (17:23 +0200)]
drm/exynos: fimd: Make plane alpha configurable

The fimd hardware supports variable plane alpha. Currently planes
are opaque, make this configurable.

Tested on TRATS2 with Exynos 4412 CPU, on top of linux-next-20181019.

Signed-off-by: Christoph Manszewski <c.manszewski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agoMerge tag 'vmwgfx-next-2018-12-13' of git://people.freedesktop.org/~thomash/linux...
Dave Airlie [Thu, 13 Dec 2018 18:57:39 +0000 (04:57 +1000)]
Merge tag 'vmwgfx-next-2018-12-13' of git://people.freedesktop.org/~thomash/linux into drm-next

Pull request of 2018-12-13

Two minor fixes for next pull.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Thomas Hellstrom <thellstrom@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181213130848.3080-1-thellstrom@vmware.com
5 years agoMerge tag 'drm-msm-next-2018-12-12' of git://people.freedesktop.org/~robclark/linux...
Dave Airlie [Thu, 13 Dec 2018 00:29:14 +0000 (10:29 +1000)]
Merge tag 'drm-msm-next-2018-12-12' of git://people.freedesktop.org/~robclark/linux into drm-next

This time around, seeing some love for some older hw:

 - a2xx gpu support for apq8060 (hp touchpad) and imx5 (headless
   gpu-only mode)
 - a2xx gpummu support (a2xx was pre-iommu)
 - mdp4 display support for apq8060/touchpad

For display/dpu:

 - a big pile of continuing dpu fixes and cleanups

On the gpu side of things:

 - per-submit statistics and traceevents for better profiling
 - a6xx crashdump support
 - decouple get_iova() and page pinning.. so we can unpin from
   physical memory inactive bo's while using softpin to lower
   cpu overhead
 - new interface to set debug names on GEM BOs and debugfs
   output improvements
 - additional submit flag to indicate buffers that are used
   to dump (so $debugfs/rd cmdstream dumping is useful with
   softpin + state-objects)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Rob Clark <robdclark@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGvVvLPD9_Z4kyfGe98Y--byj6HbxHivEYSgF7Rq7=bFnw@mail.gmail.com
5 years agoMerge branch 'linux-4.21' of git://github.com/skeggsb/linux into drm-next
Dave Airlie [Thu, 13 Dec 2018 00:21:31 +0000 (10:21 +1000)]
Merge branch 'linux-4.21' of git://github.com/skeggsb/linux into drm-next

Mostly just initial support for Turing TU104/TU106 chipsets.  Support
for TU102 is missing as I don't yet have HW, but it should be trivial
to add in later in the merge window (in theory).

It's a bit of a rough first pass that'll get improved in future
releases as a finish figuring out some of the other HW changes, but
it's good enough as it stands for modesetting and suspend/resume etc.

Acceleration bring-up is incomplete due to NVIDIA not yet having
provided FW images for me to use, though command submission and copy
engines are functional already.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Ben Skeggs <skeggsb@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CACAvsv7KmfcQqZcx+wh_1UKjTovp4PH_5UVMfeyxUu-M9WLZfw@mail.gmail.com
5 years agoMerge tag 'drm/tegra/for-4.21-rc1' of git://anongit.freedesktop.org/tegra/linux into...
Dave Airlie [Thu, 13 Dec 2018 00:16:09 +0000 (10:16 +1000)]
Merge tag 'drm/tegra/for-4.21-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/tegra: Changes for v4.21-rc1

These changes contain a couple of minor fixes for host1x and the Falcon
library in Tegra DRM. There are also a couple of missing pieces that
finally enable support for host1x, VIC and display on Tegra194. I've
also added a patch that enables audio over HDMI using the SOR which has
been tested, and works, on both Tegra186 and Tegra194.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Thierry Reding <thierry.reding@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181207134712.32683-1-thierry.reding@gmail.com
5 years agoMerge branch 'drm-next-4.21' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Wed, 12 Dec 2018 23:49:04 +0000 (09:49 +1000)]
Merge branch 'drm-next-4.21' of git://people.freedesktop.org/~agd5f/linux into drm-next

[airlied: make etnaviv build again]

amdgpu:
- DC trace support
- More DC documentation
- XGMI hive reset support
- Rework IH interaction with KFD
- Misc fixes and cleanups
- Powerplay updates for newer polaris variants
- Add cursor plane update fast path
- Enable gpu reset by default on CI parts
- Fix config with KFD/HSA not enabled

amdkfd:
- Limit vram overcommit
- dmabuf support
- Support for doorbell BOs

ttm:
- Support for simultaneous submissions to multiple engines

scheduler:
- Add helpers for hw with preemption support

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181207233119.16861-1-alexander.deucher@amd.com
5 years agodrm/amd/display: Add fast path for cursor plane updates
Nicholas Kazlauskas [Wed, 5 Dec 2018 19:59:07 +0000 (14:59 -0500)]
drm/amd/display: Add fast path for cursor plane updates

[Why]
Legacy cursor plane updates from drm helpers go through the full
atomic codepath. A high volume of cursor updates through this slow
code path can cause subsequent page-flips to skip vblank intervals
since each individual update is slow.

This problem is particularly noticeable for the compton compositor.

[How]
A fast path for cursor plane updates is added by using DRM asynchronous
commit support provided by async_check and async_update. These don't do
a full state/flip_done dependency stall and they don't block other
commit work.

However, DC still expects itself to be single-threaded for anything
that can issue register writes. Screen corruption or hangs can occur
if write sequences overlap. Every call that potentially perform
register writes needs to be guarded for asynchronous updates to work.
The dc_lock mutex was added for this.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106175

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Enable GPU recovery by default for CI
Andrey Grodzovsky [Tue, 11 Dec 2018 20:31:35 +0000 (15:31 -0500)]
drm/amdgpu: Enable GPU recovery by default for CI

I retested Bonaire (gfx7 dGPU) and it works fine.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Fix duplicating scaling/underscan connector state
Nicholas Kazlauskas [Fri, 7 Dec 2018 15:07:09 +0000 (10:07 -0500)]
drm/amd/display: Fix duplicating scaling/underscan connector state

[Why]
These properties aren't being carried over when the atomic state.
This tricks atomic check and commit tail into performing underscan
and scaling operations when they aren't needed.

With the patch that forced scaling/RMX_ASPECT on by default this
results in many unnecessary surface updates and hangs under certain
conditions.

[How]
Duplicate the properties.

Fixes: 91b66c47ba34 ("drm/amd/display: Set RMX_ASPECT as default")
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Fix unintialized max_bpc state values
Nicholas Kazlauskas [Wed, 28 Nov 2018 21:17:50 +0000 (16:17 -0500)]
drm/amd/display: Fix unintialized max_bpc state values

[Why]
If the "max bpc" isn't explicitly set in the atomic state then it
have a value of 0. This has the correct behavior of limiting a panel
to 8bpc in the case where the panel supports 8bpc. In the case of eDP
panels this isn't a true assumption - there are panels that can only
do 6bpc.

Banding occurs for these displays.

[How]
Initialize the max_bpc when the connector resets to 8bpc. Also carry
over the value when the state is duplicated.

Bugzilla: https://bugs.freedesktop.org/108825
Fixes: 307638884f72 ("drm/amd/display: Support amdgpu "max bpc" connector property")
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agoRevert "drm/amd/display: Set RMX_ASPECT as default"
Nicholas Kazlauskas [Fri, 7 Dec 2018 17:15:01 +0000 (12:15 -0500)]
Revert "drm/amd/display: Set RMX_ASPECT as default"

This reverts commit 91b66c47ba3468f7882ea4a84d5e0e0c186b638f.

Forcing RMX_ASPECT as default uses the preferred/native mode's timings
for any mode the user selects and scales the image. This provides a
a consistently nicer result in the case where the selected mode's
refresh rate matches the native mode's refresh but this isn't always
the case.

For example, if the monitor is 1080p@144Hz and the preferred mode is
60Hz then even if the user selects 1080p@144Hz as their selected mode
they'll get 1080p@60Hz.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Fix stub function name
Kuehling, Felix [Mon, 10 Dec 2018 21:29:00 +0000 (21:29 +0000)]
drm/amdgpu: Fix stub function name

This function was renamed in a previous commit. Update the stub
function name for builds with CONFIG_HSA_AMD disabled.

Fixes: 611736d8447c ("drm/amdgpu: Add KFD VRAM limit checking")
Acked-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/msm/dpu: Fix clock issue after bind failure
Jayant Shekhar [Wed, 5 Dec 2018 16:21:47 +0000 (21:51 +0530)]
drm/msm/dpu: Fix clock issue after bind failure

In case of msm drm bind failure, pm runtime put sync
is called from dsi driver which issues an asynchronous
put on mdss device. Subsequently when dpu_mdss_destroy
is triggered the change will make sure to put the mdss
device in suspend and clearing pending work if not
scheduled.

Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/dpu: Clean up dpu_media_info.h static inline functions
Jordan Crouse [Mon, 3 Dec 2018 22:47:23 +0000 (15:47 -0700)]
drm/msm/dpu: Clean up dpu_media_info.h static inline functions

Do some cleanup in the static inline functions defined in
dpu_media_info.h by cleaning up gotos and unneeded local
variables.

v3: Added spaces between operators per Seal Paul and Sam Ravnborg

Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/dpu: Further cleanups for static inline functions
Jordan Crouse [Mon, 3 Dec 2018 22:47:22 +0000 (15:47 -0700)]
drm/msm/dpu: Further cleanups for static inline functions

Remove more static inline functions that are lightly used and/or
very simple and easy to build into the calling functions.

v3: Fix a nit from Sean Paul
v2: Removed another unused function from dpu_hw_lm.c and add back
dpu_crtc_get_client_type() since there was a question regarding
its usefulness.

Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/dpu: Cleanup the debugfs functions
Jordan Crouse [Mon, 3 Dec 2018 22:47:21 +0000 (15:47 -0700)]
drm/msm/dpu: Cleanup the debugfs functions

Do some debugfs cleanups from across the DPU driver. The DRM
destroy functions will do a recursive delete on the entire
debugfs node so there is no need to store dentry pointers for
the debugfs files that are persistent for the life of the
driver. This also means that the destroy functions can go
away too.

Also, use standard API functions where applicable instead of
using hand written code.

v3: No changes
v2: Add more code; most of the dpu debugfs files should be
addressed now.

Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/dpu: Remove dpu_irq and unused functions
Jordan Crouse [Mon, 3 Dec 2018 22:47:20 +0000 (15:47 -0700)]
drm/msm/dpu: Remove dpu_irq and unused functions

dpu_irq.c does some unneeded checks and passes control
to dpu_core_irq.c  The simple functions can be defined
in the same file where we use them and the files and
their associated hangers on can be deleted.

Additionally the postinstall hook isn't used even
in dpu_core_irq.c so zap that entire path.

v3: No changes

Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: Make irq_postinstall optional
Jordan Crouse [Mon, 3 Dec 2018 22:47:19 +0000 (15:47 -0700)]
drm/msm: Make irq_postinstall optional

Allow the KMS operation 'irq_postinstall' to be optional
so that the target display drivers don't need to define
a dummy function if they don't need one.

v3: No changes

Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/dpu: Cleanup callers of dpu_hw_blk_init
Jordan Crouse [Mon, 3 Dec 2018 22:47:18 +0000 (15:47 -0700)]
drm/msm/dpu: Cleanup callers of dpu_hw_blk_init

Outside of superfluous parameter checks the dpu_hw_blk_init()
doesn't have any failure paths. Switch it over to be a void
function and we can remove error handling paths in all the functions
that call it. While we're in those functions remove unneeded
initialization for a static variable.

v3: No changes
v2: Removed a cleanup intended for a different patch

Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/dpu: Remove unused functions
Jordan Crouse [Mon, 3 Dec 2018 22:47:17 +0000 (15:47 -0700)]
drm/msm/dpu: Remove unused functions

Remove some unused container_of() helper functions.

v3: No changes
v2: Retained still used helper functions in the name of readability

Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/dpu: Remove dpu_crtc_is_enabled()
Jordan Crouse [Mon, 3 Dec 2018 22:47:16 +0000 (15:47 -0700)]
drm/msm/dpu: Remove dpu_crtc_is_enabled()

The static inline function dpu_crtc_enabled() is only called once
and the function that calls it in turn is only called once and
the return value can be easily checked in the calling functions
so collapse everything down.

v3: No changes

Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/dpu: Remove dpu_crtc_get_mixer_height
Jordan Crouse [Mon, 3 Dec 2018 22:47:15 +0000 (15:47 -0700)]
drm/msm/dpu: Remove dpu_crtc_get_mixer_height

dpu_crtc_get_mixer_height() is only used once and the value it
returns can be easily derived from the calling function.

v3: No changes

Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/dpu: Remove dpu_dbg
Jordan Crouse [Mon, 3 Dec 2018 22:47:14 +0000 (15:47 -0700)]
drm/msm/dpu: Remove dpu_dbg

The functions in dpu_dbg.c aren't used. The two main dump functions
fail after a lookup from dpu_dbg_base.reg_base_list which turns out
to never be populated and once those are removed the rest of the
file doesn't make any sense.

v3: No changes
v2: Moved some unrelated changes to another patch

Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Remove crtc_lock
Sean Paul [Fri, 16 Nov 2018 18:42:34 +0000 (13:42 -0500)]
drm/msm: dpu: Remove crtc_lock

Each time it's called we're holding the crtc modeset lock, so it's
redundant.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Remove vblank_requested flag from dpu_crtc
Sean Paul [Fri, 16 Nov 2018 18:42:33 +0000 (13:42 -0500)]
drm/msm: dpu: Remove vblank_requested flag from dpu_crtc

It's just for debugfs output, we don't need it

Changes in v2:
- None

Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Separate crtc assignment from vblank enable
Sean Paul [Fri, 16 Nov 2018 18:42:32 +0000 (13:42 -0500)]
drm/msm: dpu: Separate crtc assignment from vblank enable

Instead of assigning/clearing the crtc on vblank enable/disable, we can
just assign and clear the crtc on modeset. That allows us to just toggle
the encoder's vblank interrupts on vblank_enable.

So why is this important? Previously the driver was using the legacy
pointers to assign/clear the crtc. Legacy pointers are cleared _after_
disabling the hardware, so the legacy pointer was valid during
vblank_disable, but that's not something we should rely on.

Instead of relying on the core ordering the legacy pointer assignments
just so, we'll assign the crtc in dpu_crtc enable/disable. This is the
only place that mapping can change, so we're covered there.

We're also taking advantage of drm_crtc_vblank_on/off. By using this, we
ensure that vblank_enable/disable can never be called while the crtc is
off (which means the assigned crtc will always be valid). As such, we
don't need to use modeset locks or the crtc_lock in the
vblank_enable/disable routine to be sure state is consistent.

...I think.

Changes in v2:
- Changed crtc check in toggle_vblank to != (Jeykumar)

Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
[dpu_crtc.c change needed to be manually applied b/c of the dpu_crtc_reset change]

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Don't bother checking ->enabled in dpu_crtc_vblank
Sean Paul [Fri, 16 Nov 2018 18:42:31 +0000 (13:42 -0500)]
drm/msm: dpu: Don't bother checking ->enabled in dpu_crtc_vblank

The drm_crtc_vblank_on/off calls in enable/disable guarantee that we
won't call this function when crtc is not enabled.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Use atomic_disable for dpu_crtc_disable
Sean Paul [Fri, 16 Nov 2018 18:42:30 +0000 (13:42 -0500)]
drm/msm: dpu: Use atomic_disable for dpu_crtc_disable

Matches dpu_crtc_enable and we'll need the old state in a future patch

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Remove vblank_callback from encoder
Sean Paul [Fri, 16 Nov 2018 18:42:29 +0000 (13:42 -0500)]
drm/msm: dpu: Remove vblank_callback from encoder

The indirection of registering a callback and opaque pointer isn't reall
useful when there's only one callsite. So instead of having the
vblank_cb registration, just give encoder a crtc and let it directly
call the vblank handler.

In a later patch, we'll make use of this further.

Changes in v2:
- None

Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Remove crtc_lock from setup_mixers
Sean Paul [Fri, 16 Nov 2018 18:42:28 +0000 (13:42 -0500)]
drm/msm: dpu: Remove crtc_lock from setup_mixers

I think the intention here was to protect the enc->crtc access, but
that's insufficient to avoid enc->crtc changing. Fortunately we're
already holding the modeset lock when this is called (from
atomic_check), so remove the crtc_lock and add a modeset lock check.

While we're at it, use the encoder mask from crtc state instead of
legacy pointer.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Move pm_runtime_(get|put) from vblank_enable
Sean Paul [Fri, 16 Nov 2018 18:42:27 +0000 (13:42 -0500)]
drm/msm: dpu: Move pm_runtime_(get|put) from vblank_enable

There are 4 times that _dpu_crtc_vblank_enable_no_lock() is called:

1- crtc enable
2- crtc disable
3- crtc vblank enable
4- crtc vblank disable

When we enable or disable the crtc, we call drm_crtc_vblank_on and
drm_crtc_vblank_off respectively. That will gate vblank enables and
disables to only being called when the crtc is active. That means that
we can just enable/disable pm runtime in crtc enable/disable. This will
be beneficial in trying to eliminate blocking calls from the vblank call
chain.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Add modeset lock checks where applicable
Sean Paul [Fri, 16 Nov 2018 18:42:26 +0000 (13:42 -0500)]
drm/msm: dpu: Add modeset lock checks where applicable

Add modeset lock checks to functions that could be called outside the
core atomic stack.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Stop using encoder->crtc pointer
Sean Paul [Fri, 16 Nov 2018 18:42:25 +0000 (13:42 -0500)]
drm/msm: dpu: Stop using encoder->crtc pointer

It's for legacy drivers, for atomic drivers crtc->state->encoder_mask
should be used to map encoder to crtc.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
[seanpaul resolved conflict with async param of dpu_encoder_kickoff]

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Grab the modeset locks in frame_event
Sean Paul [Fri, 30 Nov 2018 22:00:02 +0000 (17:00 -0500)]
drm/msm: dpu: Grab the modeset locks in frame_event

This patch wraps dpu_core_perf_crtc_release_bw() with modeset locks
since it digs into the state objects.

Changes in v2:
- None
Changes in v3:
- Use those nifty new DRM_MODESET_LOCK_ALL_* helpers (Daniel)

Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Don't drop locks in crtc_vblank_enable
Sean Paul [Fri, 16 Nov 2018 18:42:23 +0000 (13:42 -0500)]
drm/msm: dpu: Don't drop locks in crtc_vblank_enable

Now that runtime resume is handled in encoder, we don't need to worry
about crtc_lock recursion when calling pm_runtime_(get|put). So drop the
lock drops in _dpu_crtc_vblank_enable_no_lock().

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Move crtc runtime resume to encoder
Sean Paul [Fri, 16 Nov 2018 18:42:22 +0000 (13:42 -0500)]
drm/msm: dpu: Move crtc runtime resume to encoder

The crtc runtime resume doesn't actually operate on the crtc, but rather
its encoders. The problem with this is that we need to inspect the crtc
state to get the currently connected encoders. Since runtime resume
isn't guaranteed to be called while holding the modeset locks (although
it sometimes is), this presents a race condition.

Now that we have ->enabled on the virtual encoders, and a lock to
protect it, just call resume on each encoder and only restore the ones
that are enabled.

Changes in v2:
- None

Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Add ->enabled to dpu_encoder_virt
Sean Paul [Fri, 16 Nov 2018 18:42:21 +0000 (13:42 -0500)]
drm/msm: dpu: Add ->enabled to dpu_encoder_virt

Add a bool to dpu_encoder_virt to track whether the encoder is enabled
or not. Repurpose the enc_lock mutex to ensure that it is consistent
with the hw state.

Changes in v2:
- None

Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Fix typo in dpu_encoder
Sean Paul [Fri, 16 Nov 2018 18:42:20 +0000 (13:42 -0500)]
drm/msm: dpu: Fix typo in dpu_encoder

enc_spinlock instead of enc_spin_lock.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Remove dpu_power_handle
Sean Paul [Fri, 16 Nov 2018 18:42:19 +0000 (13:42 -0500)]
drm/msm: dpu: Remove dpu_power_handle

Now that we don't have any event handlers, remove dpu_power_handle!

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Move DPU_POWER_HANDLE_DBUS_ID to core_perf
Sean Paul [Fri, 16 Nov 2018 18:42:18 +0000 (13:42 -0500)]
drm/msm: dpu: Move DPU_POWER_HANDLE_DBUS_ID to core_perf

It's only used in core_perf, so stick it there (and change the name to
reflect that).

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Include dpu_io_util.h directly in dpu_kms.h
Sean Paul [Fri, 16 Nov 2018 18:42:17 +0000 (13:42 -0500)]
drm/msm: dpu: Include dpu_io_util.h directly in dpu_kms.h

It's needed for struct dss_module_power, and is currently being pulled
in by dpu_power_handle.h

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Remove power_handle from core_perf
Sean Paul [Fri, 16 Nov 2018 18:42:16 +0000 (13:42 -0500)]
drm/msm: dpu: Remove power_handle from core_perf

It's unused

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Handle crtc pm_runtime_resume() directly
Sean Paul [Fri, 16 Nov 2018 18:42:15 +0000 (13:42 -0500)]
drm/msm: dpu: Handle crtc pm_runtime_resume() directly

Instead of registering through dpu_power_handle just to get a call on
runtime_resume, call the crtc function directly.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Don't use power_event for vbif_init_memtypes
Sean Paul [Fri, 16 Nov 2018 18:42:14 +0000 (13:42 -0500)]
drm/msm: dpu: Don't use power_event for vbif_init_memtypes

power_events are only used for pm_runtime, and that's all handled in
dpu_kms. So just call vbif_init_memtypes at the correct times.

Changes in v2:
- Removed obsolete comment (Jeykumar)

Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Remove dpu_power_client
Sean Paul [Fri, 16 Nov 2018 18:42:13 +0000 (13:42 -0500)]
drm/msm: dpu: Remove dpu_power_client

There's only one client -- core, and it's only used for runtime pm which
is already refcounted.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Remove unused trace_dpu_perf_update_bus()
Sean Paul [Fri, 16 Nov 2018 18:42:12 +0000 (13:42 -0500)]
drm/msm: dpu: Remove unused trace_dpu_perf_update_bus()

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Remove dpu_power_handle_get_dbus_name()
Sean Paul [Fri, 16 Nov 2018 18:42:11 +0000 (13:42 -0500)]
drm/msm: dpu: Remove dpu_power_handle_get_dbus_name()

It's only used for debugfs, so just output the enum value instead.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Allocate proper amount for dpu_crtc_state
Sean Paul [Mon, 3 Dec 2018 19:55:56 +0000 (14:55 -0500)]
drm/msm: dpu: Allocate proper amount for dpu_crtc_state

Since dpu_crtc subclasses crtc_state, we need a custom .reset hook in
order to allocate the right amount of memory to accommodate the
additional struct members in dpu_crtc_state. So bring it [partially]
back.

Relevant KASAN splat:
[   10.333382] ==================================================================
[   10.344288] BUG: KASAN: slab-out-of-bounds in kmemdup+0x50/0x80
[   10.350390] Read of size 736 at addr ffffffc0d9f06080 by task frecon/394

[   10.358861] CPU: 6 PID: 394 Comm: frecon Tainted: G        W         4.19.4 #121
[   10.366476] Hardware name: Google Cheza (rev2) (DT)
[   10.371514] Call trace:
[   10.374087]  dump_backtrace+0x0/0x194
[   10.377878]  show_stack+0x20/0x28
[   10.381330]  dump_stack+0xa0/0xc8
[   10.384783]  print_address_description+0x78/0x2e0
[   10.389639]  kasan_report+0x290/0x2d0
[   10.393428]  check_memory_region+0x20/0x14c
[   10.397740]  __asan_loadN+0x14/0x1c
[   10.401345]  kmemdup+0x50/0x80
[   10.404524]  dpu_crtc_duplicate_state+0x58/0xa0
[   10.409228]  drm_atomic_get_crtc_state+0xac/0x178
[   10.414095]  __drm_atomic_helper_set_config+0x54/0x4a4
[   10.419393]  drm_atomic_helper_set_config+0x60/0xb4
[   10.424435]  drm_mode_setcrtc+0x720/0x760
[   10.428570]  drm_ioctl_kernel+0xd8/0x13c
[   10.432617]  drm_ioctl+0x380/0x4f4
[   10.436150]  drm_compat_ioctl+0x54/0x13c
[   10.440219]  __arm64_compat_sys_ioctl+0x1d8/0xef4
[   10.445086]  el0_svc_common+0xd8/0x138
[   10.448961]  el0_svc_compat_handler+0x58/0x68
[   10.453463]  el0_svc_compat+0x8/0x18

[   10.458712] Allocated by task 56:
[   10.462148]  kasan_kmalloc.part.4+0x48/0xf4
[   10.466465]  kasan_kmalloc+0x8c/0xa0
[   10.470165]  kmem_cache_alloc_trace+0x25c/0x27c
[   10.474848]  drm_atomic_helper_crtc_reset+0x68/0x98
[   10.479877]  drm_mode_config_reset+0xc4/0x19c
[   10.484383]  msm_drm_bind+0x814/0x8dc
[   10.488169]  try_to_bring_up_master.part.7+0x48/0xac
[   10.493282]  component_master_add_with_match+0x158/0x198
[   10.498758]  msm_pdev_probe+0x328/0x348
[   10.502736]  platform_drv_probe+0x74/0xc8
[   10.506877]  really_probe+0x1ac/0x35c
[   10.510659]  driver_probe_device+0xd4/0x118
[   10.514975]  __device_attach_driver+0xc8/0xf4
[   10.519477]  bus_for_each_drv+0xb4/0xe4
[   10.523439]  __device_attach+0xd0/0x158
[   10.527394]  device_initial_probe+0x24/0x30
[   10.531715]  bus_probe_device+0x50/0xe4
[   10.535681]  deferred_probe_work_func+0xac/0xdc
[   10.540376]  process_one_work+0x3f0/0x6d4
[   10.544521]  worker_thread+0x3f4/0x520
[   10.548399]  kthread+0x1b4/0x1c8
[   10.551740]  ret_from_fork+0x10/0x18

[   10.556986] Freed by task 0:
[   10.559967] (stack is not available)

[   10.565216] The buggy address belongs to the object at ffffffc0d9f06080
                which belongs to the cache kmalloc-1024 of size 1024
[   10.578268] The buggy address is located 0 bytes inside of
                1024-byte region [ffffffc0d9f06080ffffffc0d9f06480)
[   10.590248] The buggy address belongs to the page:
[   10.595195] page:ffffffbf0367c000 count:1 mapcount:0 mapping:ffffffc0de40f680 index:0x0 compound_mapcount: 0
[   10.605321] flags: 0x4000000000008100(slab|head)
[   10.610100] raw: 4000000000008100 ffffffbf0369fa08 ffffffbf0367f008 ffffffc0de40f680
[   10.618077] raw: 0000000000000000 0000000000150015 00000001ffffffff 0000000000000000
[   10.626049] page dumped because: kasan: bad access detected

[   10.633341] Memory state around the buggy address:
[   10.638282]  ffffffc0d9f06180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   10.645710]  ffffffc0d9f06200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   10.653139] >ffffffc0d9f06280: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
[   10.660571]                                         ^
[   10.665774]  ffffffc0d9f06300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   10.673210]  ffffffc0d9f06380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   10.680639] ==================================================================

Fixes: a6ba45afda41 (drm/msm/dpu: Replace dpu_crtc_reset by atomic helper)
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Bruce Wang <bzwang@chromium.org>
Cc: Rob Clark <robdclark@gmail.com>
Reviewed-by: Bruce Wang <bzwang@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: add headless gpu device for imx5
Jonathan Marek [Tue, 4 Dec 2018 15:16:58 +0000 (10:16 -0500)]
drm/msm: add headless gpu device for imx5

This patch allows using drm/msm without qcom display hardware. It adds a
amd,imageon compatible, which is used instead of qcom,adreno, but does
not require a top level msm node.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodt-bindings: msm/dsi: Add ref clock for PHYs
Matthias Kaehlcke [Tue, 4 Dec 2018 22:42:27 +0000 (14:42 -0800)]
dt-bindings: msm/dsi: Add ref clock for PHYs

Allow the PHY drivers to get the ref clock from the DT.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodt-bindings: display: msm/gpu: document amd,imageon compatible
Jonathan Marek [Tue, 4 Dec 2018 15:17:01 +0000 (10:17 -0500)]
dt-bindings: display: msm/gpu: document amd,imageon compatible

Document the new amd,imageon compatible, used for non-qcom hardware that
uses the drm/msm driver (iMX5).

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/mdp4: add lcdc-align-lsb flag to control lane alignment
Jonathan Marek [Tue, 4 Dec 2018 15:16:57 +0000 (10:16 -0500)]
drm/msm/mdp4: add lcdc-align-lsb flag to control lane alignment

This allows controlling which of the 8 lanes are used for 6 bit color.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: implement a2xx mmu
Jonathan Marek [Wed, 14 Nov 2018 22:08:04 +0000 (17:08 -0500)]
drm/msm: implement a2xx mmu

A2XX has its own very simple MMU.

Added a msm_use_mmu() function because we can't rely on iommu_present to
decide to use MMU or not.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: Only add available components
Douglas Anderson [Tue, 4 Dec 2018 18:04:41 +0000 (10:04 -0800)]
drm/msm: Only add available components

When trying to get the display up on my sdm845 board I noticed that
the display wouldn't probe if I had the dsi1 node marked as "disabled"
even though my board doesn't use dsi1.  It looks like the msm code
adds all nodes to its list of components even if they are disabled.  I
believe this doesn't work because all registered components need to
come up before we finish probing.  Let's do like other DRM code and
only add available components.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/a6xx: Add a name for the crashdumper buffer
Jordan Crouse [Mon, 3 Dec 2018 19:40:31 +0000 (12:40 -0700)]
drm/msm/a6xx: Add a name for the crashdumper buffer

Add a buffer object name for the a6xx crashdumper so it can be
seen with the changes introduced by 7799a98edd
("drm/msm: Add a name field for gem objects").

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/a6xx: Use new kernel API free function for gpu state
Jordan Crouse [Mon, 3 Dec 2018 19:39:45 +0000 (12:39 -0700)]
drm/msm/a6xx: Use new kernel API free function for gpu state

dadb36b7ec42 ("drm/msm: Add a common function to free kernel buffer objects")
missed freeing the crashdumper state for a6xx.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Make legacy cursor updates asynchronous
Sean Paul [Tue, 30 Oct 2018 16:00:09 +0000 (12:00 -0400)]
drm/msm: dpu: Make legacy cursor updates asynchronous

This patch sprinkles a few async/legacy_cursor_update checks
through commit to ensure that cursor updates aren't blocked on vsync.
There are 2 main components to this, the first is that we don't want to
wait_for_commit_done in msm_atomic  before returning from atomic_complete.
The second is that in dpu we don't want to wait for frame_done events when
updating the cursor.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Only check flush register against pending flushes
Sean Paul [Tue, 30 Oct 2018 16:00:08 +0000 (12:00 -0400)]
drm/msm: dpu: Only check flush register against pending flushes

There exists a case where a flush of a plane/dma may have been triggered
& started from an async commit. If that plane/dma is subsequently disabled
by the next commit, the flush register will continue to hold the flush
bit for the disabled plane. Since the bit remains active,
pending_kickoff_cnt will never decrement and we'll miss frame_done
events.

This patch limits the check of flush_register to include only those bits
which have been updated with the latest commit.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/dpu: Correct dpu destroy and disable order
Jayant Shekhar [Fri, 2 Nov 2018 12:49:17 +0000 (18:19 +0530)]
drm/msm/dpu: Correct dpu destroy and disable order

In case of msm drm bind failure, dpu_mdss_destroy is triggered.
In this function, resources are freed and pm runtime disable is
called, which triggers dpu_mdss_disable. Now in dpu_mdss_disable,
driver tries to access a memory which is already freed. This
results in kernel panic. Fix this by ensuring proper sequence
of dpu destroy and disable calls.

Changes in v2:
   - Removed double spacings [Jeykumar]

Tested-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/dsi: fix dsi clock names in DSI 10nm PLL driver
Abhinav Kumar [Thu, 11 Oct 2018 17:18:57 +0000 (10:18 -0700)]
drm/msm/dsi: fix dsi clock names in DSI 10nm PLL driver

Fix the dsi clock names in the DSI 10nm PLL driver to
match the names in the dispcc driver as those are
according to the clock plan of the chipset.

Changes in v2:
- Update the clock diagram with the new clock name

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: set priv->kms to NULL before uninit
Jonathan Marek [Thu, 22 Nov 2018 01:52:35 +0000 (20:52 -0500)]
drm/msm: set priv->kms to NULL before uninit

otherwise, priv->kms is non-NULL and msm_drm_uninit will cause a panic.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/mdp5: add config for msm8917
Jonathan Marek [Thu, 22 Nov 2018 01:52:34 +0000 (20:52 -0500)]
drm/msm/mdp5: add config for msm8917

Add the mdp5_cfg_hw entry for MDP5 version v1.15 found on msm8917.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/adreno: add a2xx
Jonathan Marek [Thu, 22 Nov 2018 01:52:32 +0000 (20:52 -0500)]
drm/msm/adreno: add a2xx

derived from the a3xx driver and tested on the following hardware:
imx51-zii-rdu1 (a200 with 128kb gmem)
imx53-qsrb (a200)
msm8060-tenderloin (a220)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: use contiguous vram for MSM_BO_SCANOUT when possible
Jonathan Marek [Thu, 22 Nov 2018 01:52:30 +0000 (20:52 -0500)]
drm/msm: use contiguous vram for MSM_BO_SCANOUT when possible

Makes it possible to have MMU for GPU but not display.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/mdp4: allocate blank_cursor_no with MSM_BO_SCANOUT flag
Jonathan Marek [Thu, 22 Nov 2018 01:52:28 +0000 (20:52 -0500)]
drm/msm/mdp4: allocate blank_cursor_no with MSM_BO_SCANOUT flag

For allocation in contiguous memory when the GPU has MMU but not mdp4.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/mdp4: only use lut_clk on mdp4.2+
Jonathan Marek [Thu, 22 Nov 2018 01:52:27 +0000 (20:52 -0500)]
drm/msm/mdp4: only use lut_clk on mdp4.2+

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: bump UAPI version
Rob Clark [Thu, 29 Nov 2018 15:30:04 +0000 (10:30 -0500)]
drm/msm: bump UAPI version

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: add uapi to get/set debug name
Rob Clark [Thu, 29 Nov 2018 15:27:22 +0000 (10:27 -0500)]
drm/msm: add uapi to get/set debug name

Add UAPI to get/set GEM objects' debug name.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: rework GEM_INFO ioctl
Rob Clark [Thu, 29 Nov 2018 14:54:42 +0000 (09:54 -0500)]
drm/msm: rework GEM_INFO ioctl

Prep work to add a way to get/set the GEM objects debug name.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/gpu: add submit flag to hint which buffers should be dumped
Rob Clark [Tue, 23 Oct 2018 18:42:37 +0000 (14:42 -0400)]
drm/msm/gpu: add submit flag to hint which buffers should be dumped

To lower CPU  overhead, future userspace will be switching to pinning
iova and avoiding the use of relocs, and only include cmds table entries
for IB1 level cmdstream (but not IB2 or state-groups).

This leaves the kernel unsure what to dump for rd/hangrd cmdstream
dumping.  So add a MSM_SUBMIT_BO_DUMP flag so userspace can indicate
buffers that contain cmdstream (or are otherwise important to dump).

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: Optimize adreno_show_object()
Sharat Masetty [Thu, 1 Nov 2018 14:46:45 +0000 (20:16 +0530)]
drm/msm: Optimize adreno_show_object()

When the userspace tries to read the crashstate dump, the read side
implementation in the driver currently ascii85 encodes all the binary
buffers and it does this each time the read system call is called.
A userspace tool like cat typically does a page by page read and the
number of read calls depends on the size of the data captured by the
driver. This is certainly not desirable and does not scale well with
large captures.

This patch encodes the buffer only once in the read path. With this there
is an immediate >10X speed improvement in crashstate save time.

Signed-off-by: Sharat Masetty <smasetty@codeaurora.org>
Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/gpu: Map the ringbuffer in the iova at create time
Jordan Crouse [Wed, 7 Nov 2018 22:35:54 +0000 (15:35 -0700)]
drm/msm/gpu: Map the ringbuffer in the iova at create time

For reasons that I'm sure made perfect sense at the time we were
opting to defer the iova alloc / pin on the ringbuffer until HW
init time so when we moved to iova reference counting we ended
up adding a reference count every time the hardware started.
Not that it mattered (because the ring is always around) but
it did make the debug output look odd. Allocate and pin the iova
at create time instead.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: Add a name field for gem objects
Jordan Crouse [Wed, 7 Nov 2018 22:35:52 +0000 (15:35 -0700)]
drm/msm: Add a name field for gem objects

For debugging purposes it is useful to assign descriptions
to buffers so that we know what they are used for. Add
a field to the buffer object and use that to name the various
kernel side allocations which ends up looking like like this
in /d/dri/X/gem:

   flags       id ref  offset   kaddr            size     madv      name
   00040000: I  0 ( 1) 00000000 0000000070b79eca 00004096           memptrs
      vmas: [gpu: 01000000,mapped,inuse=1]
   00020000: I  0 ( 1) 00000000 0000000031ed4074 00032768           ring0

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: Count how many times iova memory is pinned
Jordan Crouse [Wed, 7 Nov 2018 22:35:51 +0000 (15:35 -0700)]
drm/msm: Count how many times iova memory is pinned

Add a reference count to track how many times a particular
chunk of iova memory is pinned (mapped) in the iomu and
add msm_gem_unpin_iova to give up references.

It is important to note that msm_gem_unpin_iova replaces
msm_gem_put_iova because the new implicit behavior
that an assigned iova in a given vma is now valid for the
life of the buffer and what we are really focusing on is
the use of that iova.

For now the unmappings are lazy; once the reference counts
go to zero they *COULD* be unmapped dynamically but that
will require an outside force such as a shrinker or
mm_notifiers.  For now, we're just focusing on getting
the counting right and setting ourselves up to be ready
for the future.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: Add msm_gem_get_and_pin_iova()
Jordan Crouse [Wed, 7 Nov 2018 22:35:50 +0000 (15:35 -0700)]
drm/msm: Add msm_gem_get_and_pin_iova()

Add a new function to get and pin the iova memory in one
step (basically renaming the old msm_gem_get_iova function)
and switch msm_gem_get_iova() to only allocate an iova but
not map it in the IOMMU. This is only currently used by
msm_ioctl_gem_info() since all other users of of the iova
expect that the memory be immediately available.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: Clean up and enhance the output of the 'gem' debugfs node
Jordan Crouse [Wed, 7 Nov 2018 22:35:49 +0000 (15:35 -0700)]
drm/msm: Clean up and enhance the output of the 'gem' debugfs node

Add headers for the 'gem' debugfs file to make it easier to remember
what all the values mean and move the list of virtual address regions
to the next line and add the name and map status to make it clearer
what we are looking at.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: Split msm_gem_get_iova into two steps
Jordan Crouse [Wed, 7 Nov 2018 22:35:48 +0000 (15:35 -0700)]
drm/msm: Split msm_gem_get_iova into two steps

Split the operation of msm_gem_get_iova into two operations:
1) allocate an iova and 2) map (pin) the backing memory int the
iommu. This is the first step toward allowing memory pinning
to occur independently of the iova management.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: Remove sgt from the mmu unmap function
Jordan Crouse [Wed, 7 Nov 2018 22:35:47 +0000 (15:35 -0700)]
drm/msm: Remove sgt from the mmu unmap function

The scatter gather table doesn't need to be passed in for the
MMU unmap function.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: Add a common function to free kernel buffer objects
Jordan Crouse [Wed, 7 Nov 2018 22:35:46 +0000 (15:35 -0700)]
drm/msm: Add a common function to free kernel buffer objects

Buffer objects allocated with msm_gem_kernel_new() are mostly
freed the same way so we can save a few lines of code with a
common function.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/a6xx: Track and manage a6xx state memory
Jordan Crouse [Fri, 2 Nov 2018 15:25:26 +0000 (09:25 -0600)]
drm/msm/a6xx: Track and manage a6xx state memory

The a6xx GPU state allocates a LOT of memory. Add a bit of
infrastructure to track the memory allocations in the GPU structure
and delete them when the state is destroyed much the same way
that devm works with the device model as a whole.  This protects
against the developer accidentally forgetting to add a kfree() to
an ever growing list.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/a6xx: Add a6xx gpu state
Jordan Crouse [Fri, 2 Nov 2018 15:25:25 +0000 (09:25 -0600)]
drm/msm/a6xx: Add a6xx gpu state

Add support for gathering and dumping the a6xx GPU state including
registers, GMU registers, indexed registers, shader blocks,
context clusters and debugbus.

v2: Fix bugs discovered by Sharat Masetty

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/adreno: Don't capture register values if target doesn't define them
Jordan Crouse [Fri, 2 Nov 2018 15:25:24 +0000 (09:25 -0600)]
drm/msm/adreno: Don't capture register values if target doesn't define them

If the GPU target doesn't define a list of registers then gracefully skip
capturing and/or printing them. This is used by more complex targets like
6xx that have other means of capturing register values.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/gpu: Move gpu_poll_timeout() to adreno_gpu.h
Jordan Crouse [Fri, 2 Nov 2018 15:25:23 +0000 (09:25 -0600)]
drm/msm/gpu: Move gpu_poll_timeout() to adreno_gpu.h

The gpu_poll_timeout() function can be useful to multiple targets so
mvoe it into adreno_gpu.h from the a5xx code.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/gpu: Only store local command buffers in the GPU state
Jordan Crouse [Fri, 2 Nov 2018 15:25:22 +0000 (09:25 -0600)]
drm/msm/gpu: Only store local command buffers in the GPU state

Instead of trying to store all the tagged buffers from a hanging
submit only store the command buffers that were not imported.
This cuts down on the amount of data stored in the GPU state to
the base minimum of useful information.

The downside is that this will make it more difficult to
successfully replay a hang with just the GPU state but there
isn't any reason why that functionality can't be added back
in later once we've figured out how to better communicate
such massive amounts of data.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/gpu: Add trace events for tracking GPU submissions
Jordan Crouse [Fri, 2 Nov 2018 15:25:21 +0000 (09:25 -0600)]
drm/msm/gpu: Add trace events for tracking GPU submissions

Add trace events to track the progress of a GPU submission
msm_gpu_submit occurs at the beginning of the submissions,
msm_gpu_submit_flush happens when the submission is put on
the ringbuffer and msm_submit_flush_retired is sent when
the operation is retired.

To make it easier to track the operations a unique sequence
number is assigned to each submission and displayed in each
event output so a human or a script can easily associate
the events related to a specific submission.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/gpu: Add per-submission statistics
Jordan Crouse [Fri, 2 Nov 2018 15:25:20 +0000 (09:25 -0600)]
drm/msm/gpu: Add per-submission statistics

Add infrastructure to track statistics for GPU submissions
by sampling certain perfcounters before and after a submission.

To store the statistics, the per-ring memptrs region is
expanded to include room for up to 64 entries - this should
cover a reasonable amount of inflight submissions without
worrying about losing data. The target specific code inserts
PM4 commands to sample the counters before and after
submission and store them in the data region. The CPU can
access the data after the submission retires to make sense
of the statistics and communicate them to the user.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: Gracefully handle failure in _msm_gem_kernel_new
Jordan Crouse [Fri, 2 Nov 2018 15:25:19 +0000 (09:25 -0600)]
drm/msm: Gracefully handle failure in _msm_gem_kernel_new

If any of the function calls in _msm_gem_kernel_new fail we need
to make sure to dereference the GEM object with the appropriate
function for the current locking state.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/gpu: Allocate the correct size for the GPU memptrs
Jordan Crouse [Fri, 2 Nov 2018 15:25:18 +0000 (09:25 -0600)]
drm/msm/gpu: Allocate the correct size for the GPU memptrs

Allocate the correct buffer size for the GPU memptrs. The incorrect
size hasn't affected us thus far since the incorrect size was larger
than the intended size and we're still stuck on page sized
granularity anyway but technically correct is the best kind of
correct.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: update generated headers
Rob Clark [Sun, 2 Dec 2018 18:07:41 +0000 (13:07 -0500)]
drm/msm: update generated headers

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/dpu: set geometry for iommu domain
Jeykumar Sankaran [Tue, 27 Nov 2018 23:58:13 +0000 (15:58 -0800)]
drm/msm/dpu: set geometry for iommu domain

Specify geometry for DPU iommu domain which sets
the address space for gem allocations.

Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Suggested-by: Jordan Crouse <jcrouse@codeaurora.org>
Suggested-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Acked-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm: msm: Use DRM_DEV_* instead of dev_*
Mamta Shukla [Sat, 20 Oct 2018 17:49:26 +0000 (23:19 +0530)]
drm: msm: Use DRM_DEV_* instead of dev_*

Use DRM_DEV_INFO/ERROR/WARN instead of dev_info/err/debug to generate
drm-formatted specific log messages so that it will be easy to
differentiate in case of multiple instances of driver.

Signed-off-by: Mamta Shukla <mamtashukla555@gmail.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Remove checks from dpu_plane_destroy_state()
Sean Paul [Thu, 4 Oct 2018 18:09:45 +0000 (14:09 -0400)]
drm/msm: dpu: Remove checks from dpu_plane_destroy_state()

They're not needed.

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Clean up _dpu_core_video_mode_intf_connected()
Sean Paul [Thu, 20 Sep 2018 14:58:18 +0000 (10:58 -0400)]
drm/msm: dpu: Clean up _dpu_core_video_mode_intf_connected()

Local variable is not needed and condition can't be hit.

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Remove empty/useless labels
Sean Paul [Thu, 20 Sep 2018 14:58:17 +0000 (10:58 -0400)]
drm/msm: dpu: Remove empty/useless labels

I noticed an empty label while driving by and decided to use
coccinelle to see if there were any more. Here's the spatch and the
invocation:
---

@@
identifier lbl;
expression E;
@@

- goto lbl;
+ return E;
...
- lbl:
        return E;

@@
identifier lbl;
@@

- goto lbl;
+ return;
...
- lbl:
-       return;

---
spatch --allow-inconsistent-paths --sp-file file.spatch --dir
drivers/gpu/drm/msm/disp/dpu1 --in-place
---

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>