platform/kernel/linux-starfive.git
5 years agoMerge tag 'imx-drm-fixes-2018-08-03' of git://git.pengutronix.de/git/pza/linux into...
Dave Airlie [Fri, 10 Aug 2018 01:37:30 +0000 (11:37 +1000)]
Merge tag 'imx-drm-fixes-2018-08-03' of git://git.pengutronix.de/git/pza/linux into drm-next

drm/imx: ipu-v3 plane offset and IPU id fixes

- Fix U/V plane offsets for odd vertical offsets. Due to wrong operator
  order, the y offset was not rounded down properly for vertically
  chroma subsampled planar formats.
- Fix IPU id number for boards that don't have an OF alias for their
  single IPU in the device tree. This is necessary to support imx-media
  on i.MX51 and i.MX53 SoCs.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1533552680.4204.14.camel@pengutronix.de
5 years agoMerge tag 'imx-drm-next-2018-08-03' of git://git.pengutronix.de/git/pza/linux into...
Dave Airlie [Fri, 10 Aug 2018 00:44:20 +0000 (10:44 +1000)]
Merge tag 'imx-drm-next-2018-08-03' of git://git.pengutronix.de/git/pza/linux into drm-next

drm/imx: use suspend/resume helpers, add ipu-v3 V4L2 XRGB32/XBGR32 support

- Convert imx_drm_suspend/resume to use the
  drm_mode_config_helper_suspend/ resume functions.
- Add support for V4L2_PIX_FMT_XRGB32/XBGR32, corresponding to
  DRM_FORMAT_XRGB8888/BGRX8888, respectively.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1533552701.4204.15.camel@pengutronix.de
5 years agoMerge tag 'drm-intel-next-fixes-2018-08-06' of git://anongit.freedesktop.org/drm...
Dave Airlie [Tue, 7 Aug 2018 20:26:09 +0000 (06:26 +1000)]
Merge tag 'drm-intel-next-fixes-2018-08-06' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

- Fix gvt compilation broken on a silent conflict on fixes vs next merge
- Fix runtime PM for LPE audio
- Revert on ICL workaround
- Interactive RPS mode
- Fix for PSR sink status report

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180806233034.GA20655@intel.com
5 years agoMerge tag 'drm-misc-next-fixes-2018-08-02' of git://anongit.freedesktop.org/drm/drm...
Dave Airlie [Tue, 7 Aug 2018 20:22:56 +0000 (06:22 +1000)]
Merge tag 'drm-misc-next-fixes-2018-08-02' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

Fixes an oops on the DP CEC code and a memory leak on the vkms driver.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Gustavo Padovan <gustavo@padovan.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180802111728.GA27945@juma
5 years agoMerge branch 'drm-next-4.19' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Tue, 7 Aug 2018 20:09:08 +0000 (06:09 +1000)]
Merge branch 'drm-next-4.19' of git://people.freedesktop.org/~agd5f/linux into drm-next

Fixes for 4.19:
- Fix UVD 7.2 instance handling
- Fix UVD 7.2 harvesting
- GPU scheduler fix for when a process is killed
- TTM cleanups
- amdgpu CS bo_list fixes
- Powerplay fixes for polaris12 and CZ/ST
- DC fixes for link training certain HMDs
- DC fix for vega10 blank screen in certain cases

From: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180801222906.1016-1-alexander.deucher@amd.com
5 years agoMerge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm...
Dave Airlie [Tue, 7 Aug 2018 20:07:06 +0000 (06:07 +1000)]
Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm-next

From: Lucas Stach <l.stach@pengutronix.de>
"not much to de-stage this time. Changes from Philipp and Souptick to
use memset32 more and switch the fault handler to the new vm_fault_t
and two small fixes for issues that can be hit in rare corner cases
from me."

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1533563808.2809.7.camel@pengutronix.de
5 years agoMerge branch 'drm-tda998x-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into...
Dave Airlie [Tue, 7 Aug 2018 19:52:15 +0000 (05:52 +1000)]
Merge branch 'drm-tda998x-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next

From: Russell King <rmk@armlinux.org.uk>
As per the patches posted, discussed and tested by Peter Rosin, this
converts TDA998x to a bridge driver, while still allowing Armada and
TI LCDC to continue using it as they always have done.  It also gets
rid of the private .fill_modes function, and tweaks the TMDS divider
calculation to be more correct to the available information.

[airlied: fixed two conflicts]
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180802093421.GA29670@rmk-PC.armlinux.org.uk
5 years agoMerge branch 'for-upstream/hdlcd' of git://linux-arm.org/linux-ld into drm-next
Dave Airlie [Tue, 7 Aug 2018 19:51:16 +0000 (05:51 +1000)]
Merge branch 'for-upstream/hdlcd' of git://linux-arm.org/linux-ld into drm-next

From: Liviu Dudau <Liviu.Dudau@arm.com>
"I managed to loose track of a few patches for HDLCD while focusing
on Mali DP and found them again when investigating an issue with
the way HDLCD behaves on teardown. They can go into drm-next for
one of the v4.19-rcX if you're not going to do another pull request
before the merge window."

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180731170831.GF17455@e110455-lin.cambridge.arm.com
5 years agodrm/i2c: tda998x: correct PLL divider calculation
Russell King [Thu, 2 Aug 2018 09:27:15 +0000 (10:27 +0100)]
drm/i2c: tda998x: correct PLL divider calculation

The serializer PLL divider is a power-of-two divider, so our calculation
which assumes that it's a numerical divider is incorrect.  Replace it
with one that results in a power-of-two divider value instead.

Tested with all supported modes with a Samsung S24C750.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
5 years agodrm/i2c: tda998x: get rid of private fill_modes function
Russell King [Thu, 2 Aug 2018 09:27:15 +0000 (10:27 +0100)]
drm/i2c: tda998x: get rid of private fill_modes function

We can achieve the same effect via the get_modes() method, rather than
wrapping the fill_modes helper.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
5 years agodrm/i2c: tda998x: move mode_valid() to bridge
Russell King [Thu, 2 Aug 2018 09:27:15 +0000 (10:27 +0100)]
drm/i2c: tda998x: move mode_valid() to bridge

Move the mode_valid() implementation to the bridge instead of the
connector, as we're checking the bridge's capabilities.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
5 years agodrm/i2c: tda998x: register bridge outside of component helper
Russell King [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: register bridge outside of component helper

Register the bridge outside of the component helper as we have
drivers that wish to use the tda998x without its encoder.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
5 years agodrm/i2c: tda998x: cleanup from previous changes
Russell King [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: cleanup from previous changes

Cleanup the code a little from the effects of the previous changes:
- Move tda998x_destroy() to be above tda998x_create()
- Use 'dev' directly in tda998x_create() where appropriate.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
5 years agodrm/i2c: tda998x: allocate tda998x_priv inside tda998x_create()
Russell King [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: allocate tda998x_priv inside tda998x_create()

Move the tda998x_priv allocation inside tda998x_create() and simplify
the tda998x_create()'s arguments.  Pass the same to tda998x_destroy().

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
5 years agodrm/i2c: tda998x: convert to bridge driver
Russell King [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: convert to bridge driver

Convert tda998x to a bridge driver with built-in encoder support for
compatibility with existing component drivers.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
5 years agodrm/i915/kvmgt: Fix compilation error
Michał Winiarski [Thu, 12 Jul 2018 15:53:30 +0000 (17:53 +0200)]
drm/i915/kvmgt: Fix compilation error

gvt_pin_guest_page extracted some of the gvt_dma_map_page functionality:
commit 79e542f5af79 ("drm/i915/kvmgt: Support setting dma map for huge pages")

And yet, part of it was reintroduced in:
commit 39b4cbadb9a9 ("drm/i915/kvmgt: Check the pfn got from vfio_pin_pages")

Causing kvmgt part to no longer build. Let's remove it.

Reported-by: Tomasz Lis <tomasz.lis@intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Cc: Changbin Du <changbin.du@intel.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180712155330.32055-1-michal.winiarski@intel.com
(cherry picked from commit 4eaf317a60fbea0555b936035002ca9bd9b9105d)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
5 years agodrm/i915/lpe: Mark LPE audio runtime pm as "no callbacks"
Chris Wilson [Thu, 2 Aug 2018 14:04:16 +0000 (15:04 +0100)]
drm/i915/lpe: Mark LPE audio runtime pm as "no callbacks"

The LPE audio is a child device of i915, it is powered up and down
alongside the igfx and presents no independent runtime interface. This
aptly fulfils the description of a "No-Callback" Device, so mark it
thus.

Fixes: 183c00350ccd ("drm/i915: Fix runtime PM for LPE audio")
Testcase: igt/pm_rpm/basic-pci-d3-state
Testcase: igt/pm_rpm/basic-rte
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180802140416.6062-1-chris@chris-wilson.co.uk
(cherry picked from commit 46e831abe864a6b59fa3de253a681c0f2ee1bf2f)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
5 years agoRevert "drm/i915/icl: WaEnableFloatBlendOptimization"
Mika Kuoppala [Mon, 30 Jul 2018 12:06:36 +0000 (15:06 +0300)]
Revert "drm/i915/icl: WaEnableFloatBlendOptimization"

The register for 0xe420 is unable to hold any value, including
this bit. The documentation is also mixed between having a
register bit for toggle and having a state command setup
for it. Apparently the register toggle is deprecated.

Remove the register toggle as evidence shows it's futile.

The thing remaining is an apology and humble request for
Mesa folks to resurrect their state setup for this as they
were on right track from start.

This reverts commit 0bf059f3532bb39c52d917142206a8554fc2f1c5.

Fixes: 0bf059f3532b ("drm/i915/icl: WaEnableFloatBlendOptimization")
References: HSDES#1406393558
Cc: Oscar Mateo <oscar.mateo@intel.com>
Cc: Anuj Phogat <anuj.phogat@gmail.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180730120636.26958-1-mika.kuoppala@linux.intel.com
(cherry picked from commit c358514ba8da9e235876db1628cedd19a35803c6)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
5 years agodrm/i915: Interactive RPS mode
Chris Wilson [Tue, 31 Jul 2018 13:26:29 +0000 (14:26 +0100)]
drm/i915: Interactive RPS mode

RPS provides a feedback loop where we use the load during the previous
evaluation interval to decide whether to up or down clock the GPU
frequency. Our responsiveness is split into 3 regimes, a high and low
plateau with the intent to keep the gpu clocked high to cover occasional
stalls under high load, and low despite occasional glitches under steady
low load, and inbetween. However, we run into situations like kodi where
we want to stay at low power (video decoding is done efficiently
inside the fixed function HW and doesn't need high clocks even for high
bitrate streams), but just occasionally the pipeline is more complex
than a video decode and we need a smidgen of extra GPU power to present
on time. In the high power regime, we sample at sub frame intervals with
a bias to upclocking, and conversely at low power we sample over a few
frames worth to provide what we consider to be the right levels of
responsiveness respectively. At low power, we more or less expect to be
kicked out to high power at the start of a busy sequence by waitboosting.

Prior to commit e9af4ea2b9e7 ("drm/i915: Avoid waitboosting on the active
request") whenever we missed the frame or stalled, we would immediate go
full throttle and upclock the GPU to max. But in commit e9af4ea2b9e7, we
relaxed the waitboosting to only apply if the pipeline was deep to avoid
over-committing resources for a near miss. Sadly though, a near miss is
still a miss, and perceptible as jitter in the frame delivery.

To try and prevent the near miss before having to resort to boosting
after the fact, we use the pageflip queue as an indication that we are
in an "interactive" regime and so should sample the load more frequently
to provide power before the frame misses it vblank. This will make us
more favorable to providing a small power increase (one or two bins) as
required rather than going all the way to maximum and then having to
work back down again. (We still keep the waitboosting mechanism around
just in case a dramatic change in system load requires urgent uplocking,
faster than we can provide in a few evaluation intervals.)

v2: Reduce rps_set_interactive to a boolean parameter to avoid the
confusion of what if they wanted a new power mode after pinning to a
different mode (which to choose?)
v3: Only reprogram RPS while the GT is awake, it will be set when we
wake the GT, and while off warns about being used outside of rpm.
v4: Fix deferred application of interactive mode
v5: s/state/interactive/
v6: Group the mutex with its principle in a substruct

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107111
Fixes: e9af4ea2b9e7 ("drm/i915: Avoid waitboosting on the active request")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180731132629.3381-1-chris@chris-wilson.co.uk
(cherry picked from commit 60548c554be2830d29d2533dad0ac8133347ee51)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
5 years agodrm/i915: Fix psr sink status report.
Rodrigo Vivi [Fri, 20 Jul 2018 00:31:55 +0000 (17:31 -0700)]
drm/i915: Fix psr sink status report.

First of all don't try to read dpcd if PSR is not even supported.

But also, if read failed return -EIO instead of reporting via a
backchannel.

v2: fix dev_priv: At this level m->private is the connector. (CI/DK)
    don't convert dpcd read errors to EIO. (DK)

Fixes: 5b7b30864d1d ("drm/i915/psr: Split sink status into a separate debugfs node")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180720003155.16290-1-rodrigo.vivi@intel.com
(cherry picked from commit 7a72c78bdd0a1ea1d879610542679cc680398220)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
5 years agodrm/etnaviv: fix crash in GPU suspend when init failed due to buffer placement
Lucas Stach [Mon, 23 Jul 2018 12:27:23 +0000 (14:27 +0200)]
drm/etnaviv: fix crash in GPU suspend when init failed due to buffer placement

When the suballocator was unable to provide a suitable buffer for the MMUv1
linear window, we roll back the GPU initialization. As the GPU is runtime
resumed at that point we need to clear the kernel cmdbuf suballoc entry to
properly skip any attempt to manipulate the cmdbuf when the GPU gets shut
down in the runtime suspend later on.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
5 years agodrm/etnaviv: change return type to vm_fault_t
Souptick Joarder [Tue, 29 May 2018 13:47:27 +0000 (19:17 +0530)]
drm/etnaviv: change return type to vm_fault_t

Use new return type vm_fault_t for fault handler. For
now, this is just documenting that the function returns
a VM_FAULT value rather than an errno. Once all instances
are converted, vm_fault_t will become a distinct type.

Ref- commit 1c8f422059ae ("mm: change return type to vm_fault_t")

Previously vm_insert_page() returns err which driver
mapped into VM_FAULT_* type. The new function
vmf_insert_page() will replace this inefficiency by
returning VM_FAULT_* type.

vmf_error() is the newly introduce inline function
in 4.17-rc6.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
5 years agodrm/etnaviv: protect sched job submission with fence mutex
Lucas Stach [Fri, 25 May 2018 14:51:25 +0000 (16:51 +0200)]
drm/etnaviv: protect sched job submission with fence mutex

The documentation of drm_sched_job_init and drm_sched_entity_push_job has
been clarified. Both functions should be called under a shared lock, to
avoid jobs getting pushed into the scheduler queue in a different order
than their sched_fence seqnos, which will confuse checks that are looking
at the seqnos to infer information about completion order.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
5 years agodrm/etnaviv: mmuv2: use memset32 to init scratch page
Philipp Zabel [Tue, 15 May 2018 14:09:15 +0000 (16:09 +0200)]
drm/etnaviv: mmuv2: use memset32 to init scratch page

Replace the open-coded scratch page initialization loop with memset32

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
5 years agogpu: ipu-v3: default to id 0 on missing OF alias
Philipp Zabel [Thu, 21 Jun 2018 19:13:38 +0000 (21:13 +0200)]
gpu: ipu-v3: default to id 0 on missing OF alias

This is better than storing -ENODEV in the id number. This fixes SoCs
with only one IPU that don't specify an IPU alias in the device tree.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
5 years agogpu: ipu-v3: Fix U/V offset macros for planar 4:2:0
Steve Longerbeam [Wed, 1 Aug 2018 19:12:17 +0000 (12:12 -0700)]
gpu: ipu-v3: Fix U/V offset macros for planar 4:2:0

The U and V offset macros for planar 4:2:0 (U_OFFSET, V_OFFSET, and
UV_OFFSET), are not correct. The height component to the offset was
calculated as:

(pix->width * y / 4)

But this does not produce correct offsets for odd values of y (luma
line #). The luma line # must be decimated by two to produce the
correct U/V line #, so the correct formula is:

(pix->width * (y / 2) / 2)

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
5 years agogpu: ipu-v3: add support for XRGB32 and XBGR32 V4L2 pixel formats
Philipp Zabel [Thu, 2 Aug 2018 08:40:33 +0000 (10:40 +0200)]
gpu: ipu-v3: add support for XRGB32 and XBGR32 V4L2 pixel formats

These should be used instead of the ill-defined deprecated RGB32 and
BGR32 V4L2 pixel formats.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
5 years agodrm/i2c: tda998x: move tda998x_set_config() into tda998x_create()
Russell King [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: move tda998x_set_config() into tda998x_create()

Move the non-DT configuration of the TDA998x into tda998x_create()
so that we do all setup in one place.

Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
5 years agodrm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable
Peter Rosin [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable

This fits better with the drm_bridge callbacks for when this
driver becomes a drm_bridge.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
[edited by rmk to just split the tda998x_encoder_dpms() function
 and restore the double-disable protection we originally had,
 preserving original behaviour.]
Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
5 years agodrm/i2c: tda998x: find the drm_device via the drm_connector
Peter Rosin [Thu, 2 Aug 2018 09:25:19 +0000 (10:25 +0100)]
drm/i2c: tda998x: find the drm_device via the drm_connector

This prepares for being a drm_bridge which will not register the
encoder. That makes the connector the better choice.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
5 years agodrm/ttm: clean up non-x86 definitions on ttm_tt
Huang Rui [Wed, 1 Aug 2018 05:49:33 +0000 (13:49 +0800)]
drm/ttm: clean up non-x86 definitions on ttm_tt

All non-x86 definitions are moved to ttm_set_memory header, so remove it from
ttm_tt.c.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/ttm: Add ttm_set_pages_wc and ttm_set_pages_uc helper
Huang Rui [Wed, 1 Aug 2018 05:49:32 +0000 (13:49 +0800)]
drm/ttm: Add ttm_set_pages_wc and ttm_set_pages_uc helper

These two helpers will be used on set page caching.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/ttm: fix missed conversion of set_pages_array_uc
Huang Rui [Wed, 1 Aug 2018 05:49:31 +0000 (13:49 +0800)]
drm/ttm: fix missed conversion of set_pages_array_uc

This patch fixed the error when do not configure CONFIG_X86, otherwise, below
error will be encountered.

All errors (new ones prefixed by >>):

   drivers/gpu/drm/ttm/ttm_page_alloc_dma.c: In function 'ttm_set_pages_caching':
>> drivers/gpu/drm/ttm/ttm_page_alloc_dma.c:272:7: error: implicit declaration of function 'set_pages_array_uc'; did you mean
+'ttm_set_pages_array_uc'? [-Werror=implicit-function-declaration]
      r = set_pages_array_uc(pages, cpages);
          ^~~~~~~~~~~~~~~~~~
          ttm_set_pages_array_uc
   cc1: some warnings being treated as errors

Reported-by: kbuild test robot <lkp@intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/imx: Convert drm_atomic_helper_suspend/resume()
Souptick Joarder [Tue, 31 Jul 2018 19:28:33 +0000 (00:58 +0530)]
drm/imx: Convert drm_atomic_helper_suspend/resume()

convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().

with this conversion, the remaining member of struct
imx_drm_device, state, will be no more useful and it
could be removed forever.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>
[p.zabel@pengutronix.de: rebased onto drm-next, updated commit message]
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
5 years agoMerge branch 'drm-armada-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into...
Dave Airlie [Tue, 31 Jul 2018 23:02:12 +0000 (09:02 +1000)]
Merge branch 'drm-armada-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next

This set of changes migrates Armada DRM from legacy modeset to atomic
modeset.  This is everything from the "Transition Armada DRM planes to
atomic state" and "Finish Armada DRM transition to atomic modeset"
patch sets as posted on drm-devel, excluding the "Finish Armada DRM DT
support" series.

These series did not evoke any comments - if there are any, these can
be addressed via follow up patches.

Developed and tested on Dove Cubox with xf86-video-armada including the
overlay plane, and also tested with the tools in libdrm.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180730110543.GA30664@rmk-PC.armlinux.org.uk
5 years agoMerge tag 'drm-msm-next-2018-07-30' of git://people.freedesktop.org/~robclark/linux...
Dave Airlie [Tue, 31 Jul 2018 22:52:15 +0000 (08:52 +1000)]
Merge tag 'drm-msm-next-2018-07-30' of git://people.freedesktop.org/~robclark/linux into drm-next

A bit larger this time around, due to introduction of "dpu1" support
for the display controller in sdm845 and beyond.  This has been on
list and undergoing refactoring since Feb (going from ~110kloc to
~30kloc), and all my review complaints have been addressed, so I'd be
happy to see this upstream so further feature work can procede on top
of upstream.

Also includes the gpu coredump support, which should be useful for
debugging gpu crashes.  And various other misc fixes and such.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGv-8y3zguY0Mj1vh=o+vrv_bJ8AwZ96wBXYPvMeQT2XcA@mail.gmail.com
5 years agodrm/amdgpu/pm: Fix potential Spectre v1
Gustavo A. R. Silva [Mon, 23 Jul 2018 16:32:32 +0000 (11:32 -0500)]
drm/amdgpu/pm: Fix potential Spectre v1

idx can be indirectly controlled by user-space, hence leading to a
potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:408 amdgpu_set_pp_force_state()
warn: potential spectre issue 'data.states'

Fix this by sanitizing idx before using it to index data.states

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: add missing void parameter to dc_create_transfer_func
Colin Ian King [Tue, 31 Jul 2018 10:42:54 +0000 (11:42 +0100)]
drm/amd/display: add missing void parameter to dc_create_transfer_func

Add a missing void parameter to function dc_create_transfer_func, fixes
sparse warning:

warning: non-ANSI function declaration of function 'dc_create_transfer_func'

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/radeon: Replace ttm_bo_unref with ttm_bo_put
Thomas Zimmermann [Tue, 31 Jul 2018 06:16:59 +0000 (08:16 +0200)]
drm/radeon: Replace ttm_bo_unref with ttm_bo_put

The function ttm_bo_put releases a reference to a TTM buffer object. The
function's name is more aligned to the Linux kernel convention of naming
ref-counting function _get and _put.

A call to ttm_bo_unref takes the address of the TTM BO object's pointer and
clears the pointer's value to NULL. This is not necessary in most cases and
sometimes even worked around by the calling code. A call to ttm_bo_put only
releases the reference without clearing the pointer.

The current behaviour of cleaning the pointer is kept in the calling code,
but should be removed if not required in a later patch.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/radeon: Replace ttm_bo_reference with ttm_bo_get
Thomas Zimmermann [Tue, 31 Jul 2018 06:16:58 +0000 (08:16 +0200)]
drm/radeon: Replace ttm_bo_reference with ttm_bo_get

The function ttm_bo_get acquires a reference on a TTM buffer object. The
function's name is more aligned to the Linux kernel convention of naming
ref-counting function _get and _put.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Replace ttm_bo_unref with ttm_bo_put
Thomas Zimmermann [Tue, 31 Jul 2018 07:12:36 +0000 (09:12 +0200)]
drm/amdgpu: Replace ttm_bo_unref with ttm_bo_put

The function ttm_bo_put releases a reference to a TTM buffer object. The
function's name is more aligned to the Linux kernel convention of naming
ref-counting function _get and _put.

A call to ttm_bo_unref takes the address of the TTM BO object's pointer and
clears the pointer's value to NULL. This is not necessary in most cases and
sometimes even worked around by the calling code. A call to ttm_bo_put only
releases the reference without clearing the pointer.

The current behaviour of cleaning the pointer is kept in the calling code,
but should be removed if not required in a later patch.

v2:
 * set prefix to drm/amdgpu

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Replace ttm_bo_reference with ttm_bo_get
Thomas Zimmermann [Tue, 31 Jul 2018 07:12:35 +0000 (09:12 +0200)]
drm/amdgpu: Replace ttm_bo_reference with ttm_bo_get

The function ttm_bo_get acquires a reference on a TTM buffer object. The
function's name is more aligned to the Linux kernel convention of naming
ref-counting function _get and _put.

v2:
 * changed prefix to drm/amdgpu

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/scheduler: stop setting rq to NULL
Christian König [Mon, 30 Jul 2018 09:40:06 +0000 (11:40 +0200)]
drm/scheduler: stop setting rq to NULL

We removed the redundancy of having an extra scheduler field, so we
can't set the rq to NULL any more or otherwise won't know which
scheduler to use for the cleanup.

Just remove the entity from the scheduling list instead.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107367
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/scheduler: only kill entity if last user is killed v2
Christian König [Thu, 26 Jul 2018 11:43:49 +0000 (13:43 +0200)]
drm/scheduler: only kill entity if last user is killed v2

Note which task is using the entity and only kill it if the last user of
the entity is killed. This should prevent problems when entities are leaked to
child processes.

v2: add missing kernel doc

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Acked-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: create an empty bo_list if no handle is provided
Christian König [Mon, 30 Jul 2018 14:44:14 +0000 (16:44 +0200)]
drm/amdgpu: create an empty bo_list if no handle is provided

Instead of having extra handling just create an empty bo_list when no
handle is provided.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: allocate the bo_list array after the list
Christian König [Mon, 30 Jul 2018 14:16:01 +0000 (16:16 +0200)]
drm/amdgpu: allocate the bo_list array after the list

This avoids multiple allocations for the head and the array.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add bo_list iterators
Christian König [Mon, 30 Jul 2018 13:37:46 +0000 (15:37 +0200)]
drm/amdgpu: add bo_list iterators

Add helpers to iterate over all entries in a bo_list.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: nuke amdgpu_bo_list_free
Christian König [Mon, 30 Jul 2018 12:17:41 +0000 (14:17 +0200)]
drm/amdgpu: nuke amdgpu_bo_list_free

The RCU grace period is harmless and avoiding it is not worth the effort
of doubling the implementation.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: always recreate bo_list
Christian König [Mon, 30 Jul 2018 11:46:04 +0000 (13:46 +0200)]
drm/amdgpu: always recreate bo_list

The bo_list handle is allocated by OP_CREATE, so in OP_UPDATE here we just
re-create the bo_list object and replace the handle. This way we don't
need locking to protect the bo_list because it's always re-created when
changed.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: move bo_list defines to amdgpu_bo_list.h
Christian König [Mon, 30 Jul 2018 11:27:09 +0000 (13:27 +0200)]
drm/amdgpu: move bo_list defines to amdgpu_bo_list.h

Further demangle amdgpu.h

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add new amdgpu_vm_bo_trace_cs() function v2
Christian König [Fri, 27 Jul 2018 14:56:34 +0000 (16:56 +0200)]
drm/amdgpu: add new amdgpu_vm_bo_trace_cs() function v2

This allows us to trace all VM ranges which should be valid inside a CS.

v2: dump mappings without BO as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-and-tested-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> (v1)
Reviewed-by: Huang Rui <ray.huang@amd.com> (v1)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: return error if both BOs and bo_list handle is given
Christian König [Mon, 30 Jul 2018 14:18:54 +0000 (16:18 +0200)]
drm/amdgpu: return error if both BOs and bo_list handle is given

Return -EINVAL when both the BOs as well as a list handle is provided in
the IOCTL.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fix total size calculation
Christian König [Mon, 30 Jul 2018 13:33:34 +0000 (15:33 +0200)]
drm/amdgpu: fix total size calculation

long might only be 32bit in size and we can easily use more than 4GB
here.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/sched: remove unneeded -Iinclude/drm compiler flag
Masahiro Yamada [Fri, 6 Jul 2018 05:12:11 +0000 (14:12 +0900)]
drm/sched: remove unneeded -Iinclude/drm compiler flag

I refactored the include directives under include/drm/ some time ago.
This flag is unneeded.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add proper error handling to amdgpu_bo_list_get
Christian König [Fri, 27 Jul 2018 13:32:04 +0000 (15:32 +0200)]
drm/amdgpu: add proper error handling to amdgpu_bo_list_get

Otherwise we silently don't use a BO list when the handle is invalid.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fix a reversed condition
Rex Zhu [Wed, 25 Jul 2018 03:51:46 +0000 (11:51 +0800)]
drm/amdgpu: fix a reversed condition

This test was reversed so it would end up leading to vddnb value
can't be read via hwmon on APU.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
5 years agodrm/amd/pp: Convert voltage unit in mV*4 to mV on CZ/ST
Rex Zhu [Wed, 25 Jul 2018 03:45:03 +0000 (11:45 +0800)]
drm/amd/pp: Convert voltage unit in mV*4 to mV on CZ/ST

the voltage showed in debugfs and hwmon should be in mV

Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
5 years agodrm/amd/pp: Delete unused temp variables
Rex Zhu [Fri, 20 Jul 2018 10:19:00 +0000 (18:19 +0800)]
drm/amd/pp: Delete unused temp variables

Only delete the dead temp variables in Polaris.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/pp/Polaris12: Fix a chunk of registers missed to program
Rex Zhu [Fri, 20 Jul 2018 08:26:46 +0000 (16:26 +0800)]
drm/amd/pp/Polaris12: Fix a chunk of registers missed to program

DIDTConfig_Polaris12[] table missed a big chunk of data.

Pointed by aidan.fabius <aidan.fabius@coreavi.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
5 years agodrm/arm/hdlcd: Reject atomic commits that disable only the plane
Liviu Dudau [Mon, 23 Jul 2018 11:05:53 +0000 (12:05 +0100)]
drm/arm/hdlcd: Reject atomic commits that disable only the plane

The HDLCD engine needs an active plane while the CRTC is active, as
it will start scanning out data from HDLCD_REG_FB_BASE once it gets
enabled. Make sure that the only available plane doesn't get disabled
while the CRTC remains active, as this will scanout invalid data.

Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
5 years agodrm: arm: hdlcd: Use drm_atomic_helper_shutdown() to disable planes on removal
Laurent Pinchart [Wed, 17 Jan 2018 21:55:28 +0000 (23:55 +0200)]
drm: arm: hdlcd: Use drm_atomic_helper_shutdown() to disable planes on removal

The plane cleanup handler currently calls drm_plane_helper_disable(),
which is a legacy helper function. Replace it with a call to
drm_atomic_helper_shutdown() at removal time. The plane .destroy()
handler now consisting only of a call to drm_plane_cleanup(), replace it
with direct calls to that function.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
5 years agodrm: arm: hdlcd: Don't destroy plane manually in hdlcd_setup_crtc()
Laurent Pinchart [Wed, 17 Jan 2018 21:55:27 +0000 (23:55 +0200)]
drm: arm: hdlcd: Don't destroy plane manually in hdlcd_setup_crtc()

The top-level error handler calls drm_mode_config_cleanup() which will
destroy all planes. There's no need to destroy them manually in lower
error handlers.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
5 years agodrm/arm/hdlcd: Use drm_fb_cma_fbdev_init/fini()
Noralf Trønnes [Fri, 8 Dec 2017 19:37:35 +0000 (20:37 +0100)]
drm/arm/hdlcd: Use drm_fb_cma_fbdev_init/fini()

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
5 years agodrm/arm/hdlcd: Use drm_mode_config_helper_suspend/resume()
Noralf Trønnes [Fri, 8 Dec 2017 19:37:34 +0000 (20:37 +0100)]
drm/arm/hdlcd: Use drm_mode_config_helper_suspend/resume()

Replace driver's code with the generic helpers that do the same thing
including the NULL check.

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
5 years agoMerge branch 'drm-udl-next' of git://people.freedesktop.org/~airlied/linux into drm...
Dave Airlie [Mon, 30 Jul 2018 22:24:02 +0000 (08:24 +1000)]
Merge branch 'drm-udl-next' of git://people.freedesktop.org/~airlied/linux into drm-next

A set of cleanups and fixes for Mikulas for using udl on arm boards.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CAPM=9twQNgrmfe0=Okq1NTgWHRQXy+AzeDy8A0p_-y856p4vtA@mail.gmail.com
5 years agoudl-kms: dont spam the syslog with debug messages
Mikulas Patocka [Sun, 3 Jun 2018 14:41:03 +0000 (16:41 +0200)]
udl-kms: dont spam the syslog with debug messages

The udl kms driver writes messages to the syslog whenever some application
opens or closes /dev/fb0 and whenever the user switches between the
Xserver and the console.

This patch changes the priority of these messages to debug.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
5 years agoudl-kms: use spin_lock_irq instead of spin_lock_irqsave
Mikulas Patocka [Sun, 3 Jun 2018 14:41:02 +0000 (16:41 +0200)]
udl-kms: use spin_lock_irq instead of spin_lock_irqsave

spin_lock_irqsave and spin_unlock_irqrestore is inteded to be called from
a context where it is unknown if interrupts are enabled or disabled (such
as interrupt handlers). From a process context, we should call
spin_lock_irq and spin_unlock_irq, that avoids the costly pushf and popf
instructions.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
5 years agoudl-kms: avoid prefetch
Mikulas Patocka [Sun, 3 Jun 2018 14:41:01 +0000 (16:41 +0200)]
udl-kms: avoid prefetch

Modern processors can detect linear memory accesses and prefetch data
automatically, so there's no need to use prefetch.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
5 years agoudl-kms: avoid division
Mikulas Patocka [Sun, 3 Jun 2018 14:41:00 +0000 (16:41 +0200)]
udl-kms: avoid division

Division is slow, so it shouldn't be done by the pixel generating code.
The driver supports only 2 or 4 bytes per pixel, so we can replace
division with a shift.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
5 years agoudl-kms: fix crash due to uninitialized memory
Mikulas Patocka [Sun, 3 Jun 2018 14:40:57 +0000 (16:40 +0200)]
udl-kms: fix crash due to uninitialized memory

We must use kzalloc when allocating the fb_deferred_io structure.
Otherwise, the field first_io is undefined and it causes a crash.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
5 years agoudl-kms: handle allocation failure
Mikulas Patocka [Sun, 3 Jun 2018 14:40:56 +0000 (16:40 +0200)]
udl-kms: handle allocation failure

Allocations larger than PAGE_ALLOC_COSTLY_ORDER are unreliable and they
may fail anytime. This patch fixes the udl kms driver so that when a large
alloactions fails, it tries to do multiple smaller allocations.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
5 years agoudl-kms: change down_interruptible to down
Mikulas Patocka [Sun, 3 Jun 2018 14:40:55 +0000 (16:40 +0200)]
udl-kms: change down_interruptible to down

If we leave urbs around, it causes not only leak, but also memory
corruption. This patch fixes the function udl_free_urb_list, so that it
always waits for all urbs that are in progress.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
5 years agodt-bindings: msm/disp: Add bindings for Snapdragon 845 DPU
Jeykumar Sankaran [Fri, 20 Jul 2018 20:43:09 +0000 (16:43 -0400)]
dt-bindings: msm/disp: Add bindings for Snapdragon 845 DPU

Adds bindings for Snapdragon 845 display processing unit

Changes in v2:
- Use SoC specific compatibles for mdss and dpu (Rob Herring)
- Use assigned-clocks to set initial clock frequency (Rob Herring)

Changes in v3 (all suggested by Rob Herring):
- Rename mdss_phys to mdss
- Correct description for clocks/assigned-clocks
- Rename mdp_phys to mdp
- Rename vbif_phys to vbif
- Remove redundant interrupt-parent from mdss_mdp
- Fully specify 'ranges' and use relative reg address in mdss_mdp

Cc: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Rajesh Yadav <ryadav@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodt-bindings: msm/dsi: Add mdp transfer time to msm dsi binding
Jeykumar Sankaran [Fri, 20 Jul 2018 20:42:52 +0000 (16:42 -0400)]
dt-bindings: msm/dsi: Add mdp transfer time to msm dsi binding

Adds mdp transfer time to msm dsi binding

Changes in v3:
- Added Rob's R-b

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Rajesh Yadav <ryadav@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/disp/dpu: Mark a handful of functions as static
Jordan Crouse [Thu, 26 Jul 2018 20:30:14 +0000 (14:30 -0600)]
drm/msm/disp/dpu: Mark a handful of functions as static

Mark a number of static functions that are only unsed in the file
that defines them and remove the prototypes from the headers where
needed.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/disp/dpu: Remove unused functions from dpu_formats.c
Jordan Crouse [Thu, 26 Jul 2018 20:30:13 +0000 (14:30 -0600)]
drm/msm/disp/dpu: Remove unused functions from dpu_formats.c

Remove dpu_format_get_block_size, dpu_format_get_framebuffer_size,
dpu_set_scaler_v2 and dpu_copy_formats they are unused and unneeded.

Signed-off-by: Jordan Crouse <jcrouse@codeauorora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/disp/dpu: Remove dpu_kms_utils
Jordan Crouse [Thu, 26 Jul 2018 20:30:12 +0000 (14:30 -0600)]
drm/msm/disp/dpu: Remove dpu_kms_utils

None of the functions in dpu_kms_utils.c seem to be used so
remove them all.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/disp/dpu: Remove unused code from drm_crtc.c
Jordan Crouse [Thu, 26 Jul 2018 20:30:11 +0000 (14:30 -0600)]
drm/msm/disp/dpu: Remove unused code from drm_crtc.c

Remove a chunk of unused code from drm_crtc.c, namely
dpu_crtc_res_add, dpu_crtc_res_get, dpu_crtc_res_put
and associated static functions.

Also zap dpu_crtc_event_queue(), helper functions
and members.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/disp/dpu: Remove unused code from drm_encoder.c
Jordan Crouse [Thu, 26 Jul 2018 20:30:10 +0000 (14:30 -0600)]
drm/msm/disp/dpu: Remove unused code from drm_encoder.c

Remove dpu_encoder_check_mode and dpu_encoder_helper_hw_release
frmo drm_encoder.c as they appear to be unused.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: Replace PTR_RET with PTR_ERR_OR_ZERO
Gustavo A. R. Silva [Mon, 23 Jul 2018 18:46:55 +0000 (13:46 -0500)]
drm/msm: Replace PTR_RET with PTR_ERR_OR_ZERO

PTR_RET is deprecated, use PTR_ERR_OR_ZERO instead.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: mark PM functions as __maybe_unused
Arnd Bergmann [Tue, 24 Jul 2018 15:35:37 +0000 (17:35 +0200)]
drm/msm: mark PM functions as __maybe_unused

The suspend/resume functions are not referenced when power
management is disabled:

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c:1288:12: error: 'dpu_runtime_resume' defined but not used [-Werror=unused-function]
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c:1261:12: error: 'dpu_runtime_suspend' defined but not used [-Werror=unused-function]

This marks them as __maybe_unused to let the compiler
drop the functions without complaining.

Fixes: 591225291ca2 ("drm/msm: Add SDM845 DPU support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/dpu: fix mismatch in function argument.
zhong jiang [Tue, 24 Jul 2018 11:51:59 +0000 (19:51 +0800)]
drm/msm/dpu: fix mismatch in function argument.

Fix the sparse error. the dpu_rm_init declaration is not consistent
with the implement.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
[robclark un-typo'd subject line]
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/gpu: avoid deprecated do_gettimeofday
Arnd Bergmann [Thu, 26 Jul 2018 12:39:25 +0000 (14:39 +0200)]
drm/msm/gpu: avoid deprecated do_gettimeofday

All users of do_gettimeofday() have been removed, but this one recently
crept in, along with an incorrect printing of the microseconds portion.

This converts it to using ktime_get_real_timespec64() as a direct
replacement, and adds the leading zeroes. I considered using monotonic
times (ktime_get()) instead, but as this timestamp appears to only
be used for humans rather than compared with other timestamps, the
real time domain is probably good enough.

Fixes: e43b045e2c82 ("drm/msm/gpu: Capture the state of the GPU")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dsi: Handle dual-channel for 6G as well
Sean Paul [Wed, 25 Jul 2018 20:34:45 +0000 (16:34 -0400)]
drm/msm: dsi: Handle dual-channel for 6G as well

This fixes up a collision between introducing dual-channel support and
the dsi refactors. This patch applies the same dual-channel
considerations and pclk calculations to both v2 and 6G, with a bit of
abstracting for good measure.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Use clock-names instead of assigned-clock-names
Sean Paul [Wed, 25 Jul 2018 20:34:44 +0000 (16:34 -0400)]
drm/msm: dpu: Use clock-names instead of assigned-clock-names

In these cases, we want to enumerate _all_ clocks, not just the ones
that are assigned a rate.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm: dpu: Use 'vsync' instead of 'vsync_clk' in cmdmode encoder
Sean Paul [Wed, 25 Jul 2018 20:34:43 +0000 (16:34 -0400)]
drm/msm: dpu: Use 'vsync' instead of 'vsync_clk' in cmdmode encoder

Should work with the legacy handling in of, but we shouldn't rely on
that.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/gpu: Add the buffer objects from the submit to the crash dump
Jordan Crouse [Tue, 24 Jul 2018 16:33:31 +0000 (10:33 -0600)]
drm/msm/gpu: Add the buffer objects from the submit to the crash dump

For hangs, dump copy out the contents of the buffer objects attached to the
guilty submission and print them in the crash dump report.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/adreno: Add a5xx specific registers for the GPU state
Jordan Crouse [Tue, 24 Jul 2018 16:33:30 +0000 (10:33 -0600)]
drm/msm/adreno: Add a5xx specific registers for the GPU state

HLSQ, SP and TP registers are only accessible from a special
aperture and to make matters worse the aperture is blocked from
the CPU on targets that can support secure rendering. Luckily the
GPU hardware has its own purpose built register dumper that can
access the registers from the aperture. Add a5xx specific code
to program the crashdumper and retrieve the wayward registers
and dump them for the crash state.

Also, remove a block of registers the regular CPU accessible
list that aren't useful for debug which helps reduce the size
of the crash state file by a goodly amount.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/adreno: Add ringbuffer data to the GPU state
Jordan Crouse [Tue, 24 Jul 2018 16:33:29 +0000 (10:33 -0600)]
drm/msm/adreno: Add ringbuffer data to the GPU state

Add the contents of each ringbuffer to the GPU state and dump the
data in the crash file encoded with ascii85. To save space only
the used portions of the ringbuffer are dumped.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/adreno: Convert the show/crash file format
Jordan Crouse [Tue, 24 Jul 2018 16:33:28 +0000 (10:33 -0600)]
drm/msm/adreno: Convert the show/crash file format

Convert the format of the 'show' debugfs file and the crash
dump to a  format resembling YAML. This should be easier to
parse and be more flexible for future changes and expansions.

v2: Use a standard .rst for the msm crashdump documentation

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/gpu: Capture the GPU state on a GPU hang
Jordan Crouse [Tue, 24 Jul 2018 16:33:27 +0000 (10:33 -0600)]
drm/msm/gpu: Capture the GPU state on a GPU hang

Capture the GPU state on a GPU hang and store it for later playback
via the devcoredump facility. Only one crash state is stored at a
time on the assumption that the first hang is usually the most
interesting. The existing crash state can be cleared after capturing
it and then a new one will be captured on the next hang.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/gpu: Rearrange the code that collects the task during a hang
Jordan Crouse [Tue, 24 Jul 2018 16:33:26 +0000 (10:33 -0600)]
drm/msm/gpu: Rearrange the code that collects the task during a hang

Do a bit of cleanup to prepare for upcoming changes to pass the
hanging task comm and cmdline to the crash dump function.

v2: Use GFP_ATOMIC while holding the rcu lock per Chris Wilson

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/gpu: Convert the GPU show function to use the GPU state
Jordan Crouse [Tue, 24 Jul 2018 16:33:25 +0000 (10:33 -0600)]
drm/msm/gpu: Convert the GPU show function to use the GPU state

Convert the existing GPU show function to use the GPU state to
dump the information rather than reading it directly from the hardware.
This will require an additional step to capture the state before
dumping it for the existing nodes but it will greatly facilitate reusing
the same code for dumping a previously captured state from a GPU hang.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/msm/gpu: Capture the state of the GPU
Jordan Crouse [Tue, 24 Jul 2018 16:33:24 +0000 (10:33 -0600)]
drm/msm/gpu: Capture the state of the GPU

Add the infrastructure to capture the current state of the GPU and
store it in memory so that it can be dumped later.

For now grab the same basic ringbuffer information and registers
that are provided by the debugfs 'gpu' node but obviously this should
be extended to capture a much larger set of GPU information.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm: Add puts callback for the coredump printer
Jordan Crouse [Tue, 24 Jul 2018 16:33:23 +0000 (10:33 -0600)]
drm: Add puts callback for the coredump printer

Add a puts function for the coredump printer to bypass printf()
for constant strings for a speed boost. Reorganize the
coredump printf callback to share as much code as possible.

v2: Try to reuse code between print and puts as suggested by
    Chris Wilson

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm: Add a -puts() function for the seq_file printer
Jordan Crouse [Tue, 24 Jul 2018 16:33:22 +0000 (10:33 -0600)]
drm: Add a -puts() function for the seq_file printer

Add a puts() function to use seq_puts() to help speed up
up print time for constant strings.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm: Add drm_puts() to complement drm_printf()
Jordan Crouse [Tue, 24 Jul 2018 16:33:21 +0000 (10:33 -0600)]
drm: Add drm_puts() to complement drm_printf()

Add drm_puts() for a much faster path to print constant strings
into a drm_printer object with memcpy and friends. This can
have seconds off of really large outputs such as GPU dumps.

If the drm_printer object supports a custom puts function then
use that otherwise fall back to the slower legacy printf call.

v2: Add documentation for drm_puts() per Daniel Vetter

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
[robclark fix minor htmldocs warning]
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm: drm_printer: Add printer for devcoredump
Jordan Crouse [Tue, 24 Jul 2018 16:33:20 +0000 (10:33 -0600)]
drm: drm_printer: Add printer for devcoredump

Add a drm printer suitable for use with the read callback for
devcoredump or other suitable buffer based output format that
isn't otherwise covered by seq_file.

v2: Add improved documentation per Daniel Vetter

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agoinclude: Move ascii85 functions from i915 to linux/ascii85.h
Jordan Crouse [Tue, 24 Jul 2018 16:33:19 +0000 (10:33 -0600)]
include: Move ascii85 functions from i915 to linux/ascii85.h

The i915 DRM driver very cleverly used ascii85 encoding for their
GPU state file. Move the encode functions to a general header file to
support other drivers that might be interested in the same
functionality.

v4: Make the return value const char * as suggested by Chris Wilson
v3: Fix error_puts -> err_puts pointed out by the 01.org bot
v2: Update API to be cleaner for the caller as suggested by Chris Wilson

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agodrm/armada: remove obsolete fb unreferencing kfifo and workqueue
Russell King [Mon, 30 Jul 2018 10:53:06 +0000 (11:53 +0100)]
drm/armada: remove obsolete fb unreferencing kfifo and workqueue

Remove the obsolete fb unreferencing system that is no longer used
since we've transitioned to atomic modeset.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>