OSDN Git Service

uclinux-h8/linux.git
2 years agodrm/vc4: hdmi: Fix HPD GPIO detection
Maxime Ripard [Mon, 25 Oct 2021 15:28:55 +0000 (17:28 +0200)]
drm/vc4: hdmi: Fix HPD GPIO detection

Prior to commit 6800234ceee0 ("drm/vc4: hdmi: Convert to gpiod"), in the
detect hook, if we had an HPD GPIO we would only rely on it and return
whatever state it was in.

However, that commit changed that by mistake to only consider the case
where we have a GPIO and it returns a logical high, and would fall back
to the other methods otherwise.

Since we can read the EDIDs when the HPD signal is low on some displays,
we changed the detection status from disconnected to connected, and we
would ignore an HPD pulse.

Fixes: 6800234ceee0 ("drm/vc4: hdmi: Convert to gpiod")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://lore.kernel.org/r/20211025152903.1088803-3-maxime@cerno.tech
2 years agodrm/vc4: hdmi: Remove the DDC probing for status detection
Maxime Ripard [Mon, 25 Oct 2021 15:28:54 +0000 (17:28 +0200)]
drm/vc4: hdmi: Remove the DDC probing for status detection

Commit 9d44abbbb8d5 ("drm/vc4: Fall back to using an EDID probe in the
absence of a GPIO.") added some code to read the EDID through DDC in the
HDMI driver detect hook since the Pi3 had no HPD GPIO back then.
However, commit b1b8f45b3130 ("ARM: dts: bcm2837: Add missing GPIOs of
Expander") changed that a couple of years later.

This causes an issue though since some TV (like the LG 55C8) when it
comes out of standy will deassert the HPD line, but the EDID will
remain readable.

It causes an issues nn platforms without an HPD GPIO, like the Pi4,
where the DDC probing will be our primary mean to detect a display, and
thus we will never detect the HPD pulse. This was fine before since the
pulse was small enough that we would never detect it, and we also didn't
have anything (like the scrambler) that needed to be set up in the
display.

However, now that we have both, the display during the HPD pulse will
clear its scrambler status, and since we won't detect the
disconnect/reconnect cycle we will never enable the scrambler back.

As our main reason for that DDC probing is gone, let's just remove it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://lore.kernel.org/r/20211025152903.1088803-2-maxime@cerno.tech
2 years agodrm/radeon: use dma_resv_wait_timeout() instead of manually waiting
Christian König [Wed, 27 Oct 2021 11:30:40 +0000 (13:30 +0200)]
drm/radeon: use dma_resv_wait_timeout() instead of manually waiting

Don't touch the exclusive fence manually here, but rather use the
general dma_resv function. We did that for better hw reset handling but
this doesn't necessary work correctly.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deuche <alexander.deucher@amd.com>
Acked-by: Nirmoy Das <nirmoy.das@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211028132630.2330-6-christian.koenig@amd.com
2 years agodrm/etnaviv: stop getting the excl fence separately here
Christian König [Wed, 22 Sep 2021 12:16:25 +0000 (14:16 +0200)]
drm/etnaviv: stop getting the excl fence separately here

Just grab all fences in one go.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20211028132630.2330-3-christian.koenig@amd.com
2 years agoi915/display/dp: send a more fine-grained link-status uevent
Simon Ser [Mon, 18 Oct 2021 08:47:31 +0000 (08:47 +0000)]
i915/display/dp: send a more fine-grained link-status uevent

When link-status changes, send a hotplug uevent which contains the
connector ID. That way, user-space can more easily figure out that
only this connector has been updated.

Changes in v4: avoid sending two uevents (Ville)

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018084707.32253-7-contact@emersion.fr
2 years agodrm/probe-helper: use drm_kms_helper_connector_hotplug_event
Simon Ser [Mon, 18 Oct 2021 08:47:30 +0000 (08:47 +0000)]
drm/probe-helper: use drm_kms_helper_connector_hotplug_event

If an hotplug event only updates a single connector, use
drm_kms_helper_connector_hotplug_event instead of
drm_kms_helper_hotplug_event.

Changes in v4:
- Simplify loop logic (Ville, Sam)
- Update drm_connector_helper_hpd_irq_event (Maxime)

Signed-off-by: Simon Ser <contact@emersion.fr>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018084707.32253-6-contact@emersion.fr
2 years agoamdgpu: use drm_kms_helper_connector_hotplug_event
Simon Ser [Mon, 18 Oct 2021 08:47:28 +0000 (08:47 +0000)]
amdgpu: use drm_kms_helper_connector_hotplug_event

When updating a single connector, use
drm_kms_helper_connector_hotplug_event instead of
drm_kms_helper_hotplug_event.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018084707.32253-5-contact@emersion.fr
2 years agodrm/connector: use drm_sysfs_connector_hotplug_event
Simon Ser [Mon, 18 Oct 2021 08:47:27 +0000 (08:47 +0000)]
drm/connector: use drm_sysfs_connector_hotplug_event

In drm_connector_register, use drm_sysfs_connector_hotplug_event
instead of drm_sysfs_hotplug_event, because the hotplug event
only updates a single connector.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018084707.32253-4-contact@emersion.fr
2 years agodrm/probe-helper: add drm_kms_helper_connector_hotplug_event
Simon Ser [Mon, 18 Oct 2021 08:47:26 +0000 (08:47 +0000)]
drm/probe-helper: add drm_kms_helper_connector_hotplug_event

This function is the same as drm_kms_helper_hotplug_event, but takes
a connector instead of a device.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018084707.32253-3-contact@emersion.fr
2 years agodrm/sysfs: introduce drm_sysfs_connector_hotplug_event
Simon Ser [Mon, 18 Oct 2021 08:47:25 +0000 (08:47 +0000)]
drm/sysfs: introduce drm_sysfs_connector_hotplug_event

This function sends a hotplug uevent with a CONNECTOR property.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018084707.32253-2-contact@emersion.fr
2 years agodrm/sched: Avoid lockdep spalt on killing a processes
Andrey Grodzovsky [Thu, 28 Oct 2021 16:24:03 +0000 (12:24 -0400)]
drm/sched: Avoid lockdep spalt on killing a processes

Probelm:
Singlaning one sched fence from within another's sched
fence singal callback generates lockdep splat because
the both have same lockdep class of their fence->lock

Fix:
Fix bellow stack by rescheduling to irq work of
signaling and killing of jobs that left when entity is killed.

[11176.741181]  dump_stack+0x10/0x12
[11176.741186] __lock_acquire.cold+0x208/0x2df
[11176.741197]  lock_acquire+0xc6/0x2d0
[11176.741204]  ? dma_fence_signal+0x28/0x80
[11176.741212] _raw_spin_lock_irqsave+0x4d/0x70
[11176.741219]  ? dma_fence_signal+0x28/0x80
[11176.741225]  dma_fence_signal+0x28/0x80
[11176.741230] drm_sched_fence_finished+0x12/0x20 [gpu_sched]
[11176.741240] drm_sched_entity_kill_jobs_cb+0x1c/0x50 [gpu_sched]
[11176.741248] dma_fence_signal_timestamp_locked+0xac/0x1a0
[11176.741254]  dma_fence_signal+0x3b/0x80
[11176.741260] drm_sched_fence_finished+0x12/0x20 [gpu_sched]
[11176.741268] drm_sched_job_done.isra.0+0x7f/0x1a0 [gpu_sched]
[11176.741277] drm_sched_job_done_cb+0x12/0x20 [gpu_sched]
[11176.741284] dma_fence_signal_timestamp_locked+0xac/0x1a0
[11176.741290]  dma_fence_signal+0x3b/0x80
[11176.741296] amdgpu_fence_process+0xd1/0x140 [amdgpu]
[11176.741504] sdma_v4_0_process_trap_irq+0x8c/0xb0 [amdgpu]
[11176.741731]  amdgpu_irq_dispatch+0xce/0x250 [amdgpu]
[11176.741954]  amdgpu_ih_process+0x81/0x100 [amdgpu]
[11176.742174]  amdgpu_irq_handler+0x26/0xa0 [amdgpu]
[11176.742393] __handle_irq_event_percpu+0x4f/0x2c0
[11176.742402] handle_irq_event_percpu+0x33/0x80
[11176.742408]  handle_irq_event+0x39/0x60
[11176.742414]  handle_edge_irq+0x93/0x1d0
[11176.742419]  __common_interrupt+0x50/0xe0
[11176.742426]  common_interrupt+0x80/0x90

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Suggested-by: Christian König <christian.koenig@amd.com>
Tested-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://www.spinics.net/lists/dri-devel/msg321250.html
2 years agodrm/ingenic: Remove bogus register write
Paul Cercueil [Sat, 30 Oct 2021 10:00:32 +0000 (11:00 +0100)]
drm/ingenic: Remove bogus register write

Commit 1bdb542da736 ("drm/ingenic: Simplify code by using hwdescs
array") caused the dma_hwdesc_phys_f{0,1} variables to be used while
uninitialized in a mmio register write, which most certainly broke the
ingenic-drm driver.

However, the very same patchset also submitted commit 6055466203df
("drm/ingenic: Upload palette before frame"), which restored a correct
behaviour by doing the register writes in a different place in the code.

What's left of this, is just to remove the bogus register writes in the
probe function.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211030100032.42066-1-paul@crapouillou.net
Acked-by: Sam Ravnborg <sam@ravnborg.org>
2 years agodrm/ingenic: Attach bridge chain to encoders
Paul Cercueil [Tue, 26 Oct 2021 18:12:40 +0000 (19:12 +0100)]
drm/ingenic: Attach bridge chain to encoders

Attach a top-level bridge to each encoder, which will be used for
negociating the bus format and flags.

All the bridges are now attached with DRM_BRIDGE_ATTACH_NO_CONNECTOR.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20211026181240.213806-7-paul@crapouillou.net
Tested-by: Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Christophe Branchereau <cbranchereau@gmail.com>
2 years agodrm/ingenic: Upload palette before frame
Paul Cercueil [Tue, 26 Oct 2021 18:12:39 +0000 (19:12 +0100)]
drm/ingenic: Upload palette before frame

When using C8 color mode, make sure that the palette is always uploaded
before a frame; otherwise the very first frame will have wrong colors.

Do that by changing the link order of the DMA descriptors.

v3: Fix ingenic_drm_get_new_priv_state() called instead of
    ingenic_drm_get_priv_state()

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20211026181240.213806-6-paul@crapouillou.net
Tested-by: Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Christophe Branchereau <cbranchereau@gmail.com>
2 years agodrm/ingenic: Set DMA descriptor chain register when starting CRTC
Paul Cercueil [Tue, 26 Oct 2021 18:12:38 +0000 (19:12 +0100)]
drm/ingenic: Set DMA descriptor chain register when starting CRTC

Setting the DMA descriptor chain register in the probe function has been
fine until now, because we only ever had one descriptor per foreground.

As the driver will soon have real descriptor chains, and the DMA
descriptor chain register updates itself to point to the current
descriptor being processed, this register needs to be reset after a full
modeset to point to the first descriptor of the chain.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20211026181240.213806-5-paul@crapouillou.net
Tested-by: Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Christophe Branchereau <cbranchereau@gmail.com>
2 years agodrm/ingenic: Move IPU scale settings to private state
Paul Cercueil [Tue, 26 Oct 2021 18:12:37 +0000 (19:12 +0100)]
drm/ingenic: Move IPU scale settings to private state

The IPU scaling information is computed in the plane's ".atomic_check"
callback, and used in the ".atomic_update" callback. As such, it is
state-specific, and should be moved to a private state structure.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20211026181240.213806-4-paul@crapouillou.net
Tested-by: Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Christophe Branchereau <cbranchereau@gmail.com>
2 years agodrm/ingenic: Add support for private objects
Paul Cercueil [Tue, 26 Oct 2021 18:12:36 +0000 (19:12 +0100)]
drm/ingenic: Add support for private objects

Until now, the ingenic-drm as well as the ingenic-ipu drivers used to
put state-specific information in their respective private structure.

Add boilerplate code to support private objects in the two drivers, so
that state-specific information can be put in the state-specific private
structure.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20211026181240.213806-3-paul@crapouillou.net
Tested-by: Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Christophe Branchereau <cbranchereau@gmail.com>
2 years agodrm/ingenic: Simplify code by using hwdescs array
Paul Cercueil [Tue, 26 Oct 2021 18:12:35 +0000 (19:12 +0100)]
drm/ingenic: Simplify code by using hwdescs array

Instead of having one 'hwdesc' variable for the plane #0, one for the
plane #1 and one for the palette, use a 'hwdesc[3]' array, where the
DMA hardware descriptors are indexed by the plane's number.

v2: dma_hwdesc_addr() extended to support palette hwdesc. The palette
    hwdesc is now hwdesc[3] to simplify things. Add
    ingenic_drm_configure_hwdesc*() functions to factorize code.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20211026181240.213806-2-paul@crapouillou.net
Tested-by: Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Christophe Branchereau <cbranchereau@gmail.com>
2 years agodrm: import DMA_BUF module namespace
Marcel Ziswiler [Wed, 27 Oct 2021 21:25:05 +0000 (23:25 +0200)]
drm: import DMA_BUF module namespace

Today's -next fails building arm64 defconfig as follows:

ERROR: modpost: module drm_cma_helper uses symbol dma_buf_vunmap from
 namespace DMA_BUF, but does not import it.
ERROR: modpost: module drm_cma_helper uses symbol dma_buf_vmap from
 namespace DMA_BUF, but does not import it.

Fix this by importing DMA_BUF namespace into drm_cma_helper.ko. Also
fix the problem with drm_shmem_helper.ko.

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Fixes: 4b2b5e142ff4 ("drm: Move GEM memory managers into modules")
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20211027212506.3418521-1-marcel@ziswiler.com
2 years agodrm/nouveau: use the new interator in nv50_wndw_prepare_fb
Christian König [Mon, 13 Sep 2021 12:08:13 +0000 (14:08 +0200)]
drm/nouveau: use the new interator in nv50_wndw_prepare_fb

Makes the handling a bit more complex, but avoids the use of
dma_resv_get_excl_unlocked().

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-27-christian.koenig@amd.com
2 years agodrm/virtio: fix another potential integer overflow on shift of a int
Colin Ian King [Thu, 30 Sep 2021 10:27:48 +0000 (11:27 +0100)]
drm/virtio: fix another potential integer overflow on shift of a int

The left shift of unsigned int 32 bit integer constant 1 is evaluated
using 32 bit arithmetic and then assigned to a signed 64 bit integer.
In the case where value is 32 or more this can lead to an overflow
(value can be in range 0..MAX_CAPSET_ID (63). Fix this by shifting
the value 1ULL instead.

Addresses-Coverity: ("Uninitentional integer overflow")
Fixes: 4fb530e5caf7 ("drm/virtio: implement context init: support init ioctl")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20210930102748.16922-1-colin.king@canonical.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agodrm/virtio: fix potential integer overflow on shift of a int
Colin Ian King [Thu, 30 Sep 2021 10:19:41 +0000 (11:19 +0100)]
drm/virtio: fix potential integer overflow on shift of a int

The left shift of unsigned int 32 bit integer constant 1 is evaluated
using 32 bit arithmetic and then assigned to a signed 64 bit integer.
In the case where i is 32 or more this can lead to an overflow. Fix
this by shifting the value 1ULL instead.

Addresses-Coverity: ("Uninitentional integer overflow")
Fixes: 8d6b006e1f51 ("drm/virtio: implement context init: handle VIRTGPU_CONTEXT_PARAM_POLL_RINGS_MASK")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20210930101941.16546-1-colin.king@canonical.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoMAINTAINERS: add reviewers for virtio-gpu
Chia-I Wu [Thu, 28 Oct 2021 21:34:46 +0000 (14:34 -0700)]
MAINTAINERS: add reviewers for virtio-gpu

Add Gurchetan Singh and me as reviewers for virtio-gpu.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Gurchetan Singh <gurchetansingh@chromium.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20211028213446.955338-1-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agodrm/bridge: sn65dsi86: ti_sn65dsi86_read_u16() __maybe_unused
Bjorn Andersson [Thu, 28 Oct 2021 16:35:48 +0000 (09:35 -0700)]
drm/bridge: sn65dsi86: ti_sn65dsi86_read_u16() __maybe_unused

When built without CONFIG_PWM there are no references to
ti_sn65dsi86_read_u16(), avoid the W=1 build warning by marking the
function as __maybe_unused.

__maybe_unused is used insted of a #ifdef guard as it looks slighly
cleaner and it avoids issues if in the future other permutations of the
config options would use the function.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: cea86c5bb442 ("drm/bridge: ti-sn65dsi86: Implement the pwm_chip")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20211028163548.273736-1-bjorn.andersson@linaro.org
Signed-off-by: Robert Foss <robert.foss@linaro.org>
2 years agodma-buf: remove restriction of IOCTL:DMA_BUF_SET_NAME
Guangming Cao [Thu, 14 Oct 2021 10:25:51 +0000 (18:25 +0800)]
dma-buf: remove restriction of IOCTL:DMA_BUF_SET_NAME

In this patch(https://patchwork.freedesktop.org/patch/310349),
it add a new IOCTL to support dma-buf user to set debug name.

But it also added a limitation of this IOCTL, it needs the
attachments of dmabuf should be empty, otherwise it will fail.

For the original series, the idea was that allowing name change
mid-use could confuse the users about the dma-buf.
However, the rest of the series also makes sure each dma-buf have a unique
inode(https://patchwork.freedesktop.org/patch/310387/), and any accounting
should probably use that, without relying on the name as much.

So, removing this restriction will let dma-buf userspace users to use it
more comfortably and without any side effect.

Signed-off-by: Guangming Cao <Guangming.Cao@mediatek.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211014102551.54983-1-guangming.cao@mediatek.com
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
2 years agodrm/kmb: Enable support for framebuffer console
Anitha Chrisanthus [Wed, 6 Oct 2021 23:27:21 +0000 (16:27 -0700)]
drm/kmb: Enable support for framebuffer console

Enable support for fbcon (framebuffer console).

v2: added missing static clk_enable
v3: removed module parameter, use fbdev_emulation instead. Use
preferred depth of 24 for color depth. (Thomas Z.)

Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20211019230719.789958-2-anitha.chrisanthus@intel.com
2 years agodrm/msm/dsi: Adjust probe order
Rob Clark [Mon, 25 Oct 2021 15:15:36 +0000 (17:15 +0200)]
drm/msm/dsi: Adjust probe order

Switch to the documented order dsi-host vs bridge probe.

Tested-by: Amit Pundir <amit.pundir@linaro.org>
Tested-by: Caleb Connolly <caleb.connolly@linaro.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-22-maxime@cerno.tech
2 years agodrm/kirin: dsi: Adjust probe order
Maxime Ripard [Mon, 25 Oct 2021 15:15:35 +0000 (17:15 +0200)]
drm/kirin: dsi: Adjust probe order

Without proper care and an agreement between how DSI hosts and devices
drivers register their MIPI-DSI entities and potential components, we can
end up in a situation where the drivers can never probe.

Most drivers were taking evasive maneuvers to try to workaround this,
but not all of them were following the same conventions, resulting in
various incompatibilities between DSI hosts and devices.

Now that we have a sequence agreed upon and documented, let's convert
kirin to it.

Acked-by: John Stultz <john.stultz@linaro.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-21-maxime@cerno.tech
2 years agodrm/bridge: tc358775: Register and attach our DSI device at probe
Maxime Ripard [Mon, 25 Oct 2021 15:15:34 +0000 (17:15 +0200)]
drm/bridge: tc358775: Register and attach our DSI device at probe

In order to avoid any probe ordering issue, the best practice is to move
the secondary MIPI-DSI device registration and attachment to the
MIPI-DSI host at probe time. Let's do this.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-20-maxime@cerno.tech
2 years agodrm/bridge: tc358775: Switch to devm MIPI-DSI helpers
Maxime Ripard [Mon, 25 Oct 2021 15:15:33 +0000 (17:15 +0200)]
drm/bridge: tc358775: Switch to devm MIPI-DSI helpers

Let's switch to the new devm MIPI-DSI function to register and attach
our secondary device. This also avoids leaking the device when we detach
the bridge.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-19-maxime@cerno.tech
2 years agodrm/bridge: sn65dsi86: Register and attach our DSI device at probe
Maxime Ripard [Mon, 25 Oct 2021 15:15:32 +0000 (17:15 +0200)]
drm/bridge: sn65dsi86: Register and attach our DSI device at probe

In order to avoid any probe ordering issue, the best practice is to move
the secondary MIPI-DSI device registration and attachment to the
MIPI-DSI host at probe time. Let's do this.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-18-maxime@cerno.tech
2 years agodrm/bridge: sn65dsi86: Switch to devm MIPI-DSI helpers
Maxime Ripard [Mon, 25 Oct 2021 15:15:31 +0000 (17:15 +0200)]
drm/bridge: sn65dsi86: Switch to devm MIPI-DSI helpers

Let's switch to the new devm MIPI-DSI function to register and attach
our secondary device. This also avoids leaking the device when we detach
the bridge.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-17-maxime@cerno.tech
2 years agodrm/bridge: sn65dsi83: Register and attach our DSI device at probe
Maxime Ripard [Mon, 25 Oct 2021 15:15:30 +0000 (17:15 +0200)]
drm/bridge: sn65dsi83: Register and attach our DSI device at probe

In order to avoid any probe ordering issue, the best practice is to move
the secondary MIPI-DSI device registration and attachment to the
MIPI-DSI host at probe time. Let's do this.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-16-maxime@cerno.tech
2 years agodrm/bridge: sn65dsi83: Switch to devm MIPI-DSI helpers
Maxime Ripard [Mon, 25 Oct 2021 15:15:29 +0000 (17:15 +0200)]
drm/bridge: sn65dsi83: Switch to devm MIPI-DSI helpers

Let's switch to the new devm MIPI-DSI function to register and attach
our secondary device. This also avoids leaking the device when we detach
the bridge but don't remove its driver.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-15-maxime@cerno.tech
2 years agodrm/bridge: sn65dsi83: Fix bridge removal
Maxime Ripard [Mon, 25 Oct 2021 15:15:28 +0000 (17:15 +0200)]
drm/bridge: sn65dsi83: Fix bridge removal

Commit 24417d5b0c00 ("drm/bridge: ti-sn65dsi83: Implement .detach
callback") moved the unregistration of the bridge DSI device and bridge
itself to the detach callback.

While this is correct for the DSI device detach and unregistration, the
bridge is added in the driver probe, and should thus be removed as part
of its remove callback.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Fixes: 24417d5b0c00 ("drm/bridge: ti-sn65dsi83: Implement .detach callback")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-14-maxime@cerno.tech
2 years agodrm/bridge: ps8640: Register and attach our DSI device at probe
Maxime Ripard [Mon, 25 Oct 2021 15:15:27 +0000 (17:15 +0200)]
drm/bridge: ps8640: Register and attach our DSI device at probe

In order to avoid any probe ordering issue, the best practice is to move
the secondary MIPI-DSI device registration and attachment to the
MIPI-DSI host at probe time. Let's do this.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-13-maxime@cerno.tech
2 years agodrm/bridge: ps8640: Switch to devm MIPI-DSI helpers
Maxime Ripard [Mon, 25 Oct 2021 15:15:26 +0000 (17:15 +0200)]
drm/bridge: ps8640: Switch to devm MIPI-DSI helpers

Let's switch to the new devm MIPI-DSI function to register and attach
our secondary device. This also avoids leaking the device on removal.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-12-maxime@cerno.tech
2 years agodrm/bridge: lt9611uxc: Register and attach our DSI device at probe
Maxime Ripard [Mon, 25 Oct 2021 15:15:25 +0000 (17:15 +0200)]
drm/bridge: lt9611uxc: Register and attach our DSI device at probe

In order to avoid any probe ordering issue, the best practice is to move
the secondary MIPI-DSI device registration and attachment to the
MIPI-DSI host at probe time. Let's do this.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-11-maxime@cerno.tech
2 years agodrm/bridge: lt9611uxc: Switch to devm MIPI-DSI helpers
Maxime Ripard [Mon, 25 Oct 2021 15:15:24 +0000 (17:15 +0200)]
drm/bridge: lt9611uxc: Switch to devm MIPI-DSI helpers

Let's switch to the new devm MIPI-DSI function to register and attach
our secondary device.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-10-maxime@cerno.tech
2 years agodrm/bridge: lt9611: Register and attach our DSI device at probe
Maxime Ripard [Mon, 25 Oct 2021 15:15:23 +0000 (17:15 +0200)]
drm/bridge: lt9611: Register and attach our DSI device at probe

In order to avoid any probe ordering issue, the best practice is to move
the secondary MIPI-DSI device registration and attachment to the
MIPI-DSI host at probe time. Let's do this.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-9-maxime@cerno.tech
2 years agodrm/bridge: lt9611: Switch to devm MIPI-DSI helpers
Maxime Ripard [Mon, 25 Oct 2021 15:15:22 +0000 (17:15 +0200)]
drm/bridge: lt9611: Switch to devm MIPI-DSI helpers

Let's switch to the new devm MIPI-DSI function to register and attach
our secondary device.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-8-maxime@cerno.tech
2 years agodrm/bridge: lt8912b: Register and attach our DSI device at probe
Maxime Ripard [Mon, 25 Oct 2021 15:15:21 +0000 (17:15 +0200)]
drm/bridge: lt8912b: Register and attach our DSI device at probe

In order to avoid any probe ordering issue, the best practice is to move
the secondary MIPI-DSI device registration and attachment to the
MIPI-DSI host at probe time. Let's do this.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-7-maxime@cerno.tech
2 years agodrm/bridge: lt8912b: Switch to devm MIPI-DSI helpers
Maxime Ripard [Mon, 25 Oct 2021 15:15:20 +0000 (17:15 +0200)]
drm/bridge: lt8912b: Switch to devm MIPI-DSI helpers

Let's switch to the new devm MIPI-DSI function to register and attach
our secondary device.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-6-maxime@cerno.tech
2 years agodrm/bridge: anx7625: Register and attach our DSI device at probe
Maxime Ripard [Mon, 25 Oct 2021 15:15:19 +0000 (17:15 +0200)]
drm/bridge: anx7625: Register and attach our DSI device at probe

In order to avoid any probe ordering issue, the best practice is to move
the secondary MIPI-DSI device registration and attachment to the
MIPI-DSI host at probe time. Let's do this.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-5-maxime@cerno.tech
2 years agodrm/bridge: anx7625: Switch to devm MIPI-DSI helpers
Maxime Ripard [Mon, 25 Oct 2021 15:15:18 +0000 (17:15 +0200)]
drm/bridge: anx7625: Switch to devm MIPI-DSI helpers

Let's switch to the new devm MIPI-DSI function to register and attach
our secondary device.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-4-maxime@cerno.tech
2 years agodrm/bridge: adv7511: Register and attach our DSI device at probe
Maxime Ripard [Mon, 25 Oct 2021 15:15:17 +0000 (17:15 +0200)]
drm/bridge: adv7511: Register and attach our DSI device at probe

In order to avoid any probe ordering issue, the best practice is to move
the secondary MIPI-DSI device registration and attachment to the
MIPI-DSI host at probe time. Let's do this.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-3-maxime@cerno.tech
2 years agodrm/bridge: adv7533: Switch to devm MIPI-DSI helpers
Maxime Ripard [Mon, 25 Oct 2021 15:15:16 +0000 (17:15 +0200)]
drm/bridge: adv7533: Switch to devm MIPI-DSI helpers

Let's switch to the new devm MIPI-DSI function to register and attach
our secondary device. This also avoids leaking the device when we detach
the bridge.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025151536.1048186-2-maxime@cerno.tech
2 years agodrm: Link CMA framebuffer helpers into KMS helper library
Thomas Zimmermann [Tue, 26 Oct 2021 17:57:00 +0000 (19:57 +0200)]
drm: Link CMA framebuffer helpers into KMS helper library

Linking the CMA framebuffer helpers into a CMA helper library in
commit 4b2b5e142ff4 ("drm: Move GEM memory managers into modules")
results in linker errors:

  arm-linux-gnueabihf-ld: drivers/gpu/drm/drm_fb_cma_helper.o: \
  in function `drm_fb_cma_get_gem_obj': \
  drivers/gpu/drm/drm_fb_cma_helper.c:46: undefined reference \
  to `drm_gem_fb_get_obj'
  arm-linux-gnueabihf-ld: drivers/gpu/drm/drm_fb_cma_helper.c:46: \
  undefined reference to `drm_gem_fb_get_obj'
  arm-linux-gnueabihf-ld: drivers/gpu/drm/drm_fb_cma_helper.c:46: \
  undefined reference to `drm_gem_fb_get_obj'
  arm-linux-gnueabihf-ld: drivers/gpu/drm/drm_fb_cma_helper.o: in \
  function `drm_fb_cma_sync_non_coherent': \
  drivers/gpu/drm/drm_fb_cma_helper.c:133: undefined reference \
  to `drm_atomic_helper_damage_iter_init'
  arm-linux-gnueabihf-ld: drivers/gpu/drm/drm_fb_cma_helper.c:135: \
  undefined reference to `drm_atomic_helper_damage_iter_next'

Link the CMA framebuffer helpers into the KMS helper library to
fix the problem.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 4b2b5e142ff4 ("drm: Move GEM memory managers into modules")
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Link: https://patchwork.freedesktop.org/patch/msgid/20211026175700.27664-1-tzimmermann@suse.de
2 years agodrm/bridge: ti-sn65dsi86: Implement the pwm_chip
Bjorn Andersson [Mon, 25 Oct 2021 17:09:25 +0000 (10:09 -0700)]
drm/bridge: ti-sn65dsi86: Implement the pwm_chip

The SN65DSI86 provides the ability to supply a PWM signal on GPIO 4,
with the primary purpose of controlling the backlight of the attached
panel. Add an implementation that exposes this using the standard PWM
framework, to allow e.g. pwm-backlight to expose this to the user.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025170925.3096444-3-bjorn.andersson@linaro.org
2 years agodrm/bridge: ti-sn65dsi86: Use regmap_bulk_write API
Bjorn Andersson [Mon, 25 Oct 2021 17:09:24 +0000 (10:09 -0700)]
drm/bridge: ti-sn65dsi86: Use regmap_bulk_write API

The multi-register u16 write operation can use regmap_bulk_write()
instead of two separate regmap_write() calls.

It's uncertain if this has any effect on the actual updates of the
underlying registers, but this at least gives the hardware the
opportunity and saves us one transation on the bus.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025170925.3096444-2-bjorn.andersson@linaro.org
2 years agopwm: Introduce single-PWM of_xlate function
Bjorn Andersson [Mon, 25 Oct 2021 17:09:23 +0000 (10:09 -0700)]
pwm: Introduce single-PWM of_xlate function

The existing pxa driver and the upcoming addition of PWM support in the
TI sn565dsi86 DSI/eDP bridge driver both has a single PWM channel and
thereby a need for a of_xlate function with the period as its single
argument.

Introduce a common helper function in the core that can be used as
of_xlate by such drivers and migrate the pxa driver to use this.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Steev Klimaszewski <steev@kali.org>
Tested-By: Steev Klimaszewski <steev@kali.org>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025170925.3096444-1-bjorn.andersson@linaro.org
2 years agodrm/etnaviv: replace dma_resv_get_excl_unlocked
Christian König [Mon, 13 Sep 2021 12:20:13 +0000 (14:20 +0200)]
drm/etnaviv: replace dma_resv_get_excl_unlocked

We certainly hold the reservation lock here, no need for the RCU dance.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Nirmoy Das <nirmoy.das@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025080532.177424-3-christian.koenig@amd.com
2 years agodrm/etnaviv: use new iterator in etnaviv_gem_describe
Christian König [Tue, 15 Jun 2021 16:54:34 +0000 (18:54 +0200)]
drm/etnaviv: use new iterator in etnaviv_gem_describe

Instead of hand rolling the logic.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Nirmoy Das <nirmoy.das@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211025080532.177424-2-christian.koenig@amd.com
2 years agodma-buf: st: fix error handling in test_get_fences()
Arnd Bergmann [Tue, 26 Oct 2021 08:34:37 +0000 (10:34 +0200)]
dma-buf: st: fix error handling in test_get_fences()

The new driver incorrectly unwinds after errors, as clang points out:

drivers/dma-buf/st-dma-resv.c:295:7: error: variable 'i' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                if (r) {
                    ^
drivers/dma-buf/st-dma-resv.c:336:9: note: uninitialized use occurs here
        while (i--)
               ^
drivers/dma-buf/st-dma-resv.c:295:3: note: remove the 'if' if its condition is always false
                if (r) {
                ^~~~~~~~
drivers/dma-buf/st-dma-resv.c:288:6: error: variable 'i' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
        if (r) {
            ^
drivers/dma-buf/st-dma-resv.c:336:9: note: uninitialized use occurs here
        while (i--)
               ^
drivers/dma-buf/st-dma-resv.c:288:2: note: remove the 'if' if its condition is always false
        if (r) {
        ^~~~~~~~
drivers/dma-buf/st-dma-resv.c:280:10: note: initialize the variable 'i' to silence this warning
        int r, i;
                ^
                 = 0

Skip cleaning up the bits that have not been allocated at this point.

Fixes: 1d51775cd3f5 ("dma-buf: add dma_resv selftest v4")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20211026083448.3471055-1-arnd@kernel.org
Signed-off-by: Christian König <christian.koenig@amd.com>
2 years agodrm/panel: novatek-nt35950: remove unneeded semicolon
Yang Li [Tue, 19 Oct 2021 07:37:26 +0000 (15:37 +0800)]
drm/panel: novatek-nt35950: remove unneeded semicolon

Eliminate the following coccicheck warning:
./drivers/gpu/drm/panel/panel-novatek-nt35950.c:639:2-3: Unneeded
semicolon

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels")
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1634629046-116842-1-git-send-email-yang.lee@linux.alibaba.com
2 years agodrm/panel: make sharp_ls055d1sx04 static
chongjiapeng [Tue, 19 Oct 2021 10:40:29 +0000 (18:40 +0800)]
drm/panel: make sharp_ls055d1sx04 static

This symbol is not used outside of panel-novatek-nt35950.c, so marks it
static.

Fixes the following sparse warning:

drivers/gpu/drm/panel/panel-novatek-nt35950.c:671:33: warning: symbol
'sharp_ls055d1sx04' was not declared. Should it be static?

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels")
Signed-off-by: chongjiapeng <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1634640029-12335-1-git-send-email-jiapeng.chong@linux.alibaba.com
2 years agodrm/panel: ilitek-ili9881c: Read panel orientation
John Keeping [Wed, 20 Oct 2021 15:34:30 +0000 (16:34 +0100)]
drm/panel: ilitek-ili9881c: Read panel orientation

The panel orientation needs to parsed from a device-tree and assigned to
the panel's connector in order to make orientation property available to
userspace. That's what this patch does for ILI9881C based panels.

Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20211020153432.383845-4-john@metanate.com
2 years agodt-bindings: ili9881c: add rotation property
John Keeping [Wed, 20 Oct 2021 15:34:29 +0000 (16:34 +0100)]
dt-bindings: ili9881c: add rotation property

Allow the standard rotation property from panel-common for ILI9881C
based panels.

Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20211020153432.383845-3-john@metanate.com
2 years agodt-bindings: ili9881c: add missing panel-common inheritance
John Keeping [Wed, 20 Oct 2021 15:34:28 +0000 (16:34 +0100)]
dt-bindings: ili9881c: add missing panel-common inheritance

The properties below refer to items in panel-common.yaml, which means
that needs to be referenced in the schema.

Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20211020153432.383845-2-john@metanate.com
2 years agodrm/vc4: crtc: Make sure the HDMI controller is powered when disabling
Maxime Ripard [Thu, 23 Sep 2021 18:50:13 +0000 (20:50 +0200)]
drm/vc4: crtc: Make sure the HDMI controller is powered when disabling

Since commit 875a4d536842 ("drm/vc4: drv: Disable the CRTC at boot
time"), during the initial setup of the driver we call into the VC4 HDMI
controller hooks to make sure the controller is properly disabled.

However, we were never making sure that the device was properly powered
while doing so. This never resulted in any (reported) issue in practice,
but since the introduction of commit 4209f03fcb8e ("drm/vc4: hdmi: Warn
if we access the controller while disabled") we get a loud complaint
when we do that kind of access.

Let's make sure we have the HDMI controller properly powered while
disabling it.

Fixes: 875a4d536842 ("drm/vc4: drv: Disable the CRTC at boot time")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Tested-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210923185013.826679-1-maxime@cerno.tech
2 years agodrm/vc4: hdmi: Warn if we access the controller while disabled
Maxime Ripard [Thu, 19 Aug 2021 13:59:31 +0000 (15:59 +0200)]
drm/vc4: hdmi: Warn if we access the controller while disabled

We've had many silent hangs where the kernel would look like it just
stalled due to the access to one of the HDMI registers while the
controller was disabled.

Add a warning if we're about to do that so that it's at least not silent
anymore.

Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-7-maxime@cerno.tech
2 years agodrm/vc4: hdmi: Make sure the device is powered with CEC
Maxime Ripard [Thu, 19 Aug 2021 13:59:30 +0000 (15:59 +0200)]
drm/vc4: hdmi: Make sure the device is powered with CEC

Similarly to what we encountered with the detect hook with DRM, nothing
actually prevents any of the CEC callback from being run while the HDMI
output is disabled.

However, this is an issue since any register access to the controller
when it's powered down will result in a silent hang.

Let's make sure we run the runtime_pm hooks when the CEC adapter is
opened and closed by the userspace to avoid that issue.

Fixes: 15b4511a4af6 ("drm/vc4: add HDMI CEC support")
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-6-maxime@cerno.tech
2 years agodrm/vc4: hdmi: Split the CEC disable / enable functions in two
Maxime Ripard [Thu, 19 Aug 2021 13:59:29 +0000 (15:59 +0200)]
drm/vc4: hdmi: Split the CEC disable / enable functions in two

In order to ease further additions to the CEC enable and disable, let's
split the function into two functions, one to enable and the other to
disable.

Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-5-maxime@cerno.tech
2 years agodrm/vc4: hdmi: Rework the pre_crtc_configure error handling
Maxime Ripard [Thu, 19 Aug 2021 13:59:28 +0000 (15:59 +0200)]
drm/vc4: hdmi: Rework the pre_crtc_configure error handling

Since our pre_crtc_configure hook returned void, we didn't implement a
goto-based error path handling, leading to errors like failing to put
back the device in pm_runtime in all the error paths, but also failing
to disable the pixel clock if clk_set_min_rate on the HSM clock fails.

Move to a goto-based implementation to have an easier consitency.

Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder driver")
Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-4-maxime@cerno.tech
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2 years agodrm/vc4: hdmi: Make sure the controller is powered up during bind
Maxime Ripard [Thu, 19 Aug 2021 13:59:27 +0000 (15:59 +0200)]
drm/vc4: hdmi: Make sure the controller is powered up during bind

In the bind hook, we actually need the device to have the HSM clock
running during the final part of the display initialisation where we
reset the controller and initialise the CEC component.

Failing to do so will result in a complete, silent, hang of the CPU.

Fixes: 411efa18e4b0 ("drm/vc4: hdmi: Move the HSM clock enable to runtime_pm")
Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-3-maxime@cerno.tech
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2 years agodrm/vc4: hdmi: Make sure the controller is powered in detect
Maxime Ripard [Wed, 22 Sep 2021 12:54:19 +0000 (14:54 +0200)]
drm/vc4: hdmi: Make sure the controller is powered in detect

If the HPD GPIO is not available and drm_probe_ddc fails, we end up
reading the HDMI_HOTPLUG register, but the controller might be powered
off resulting in a CPU hang. Make sure we have the power domain and the
HSM clock powered during the detect cycle to prevent the hang from
happening.

Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder driver")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Tested-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Tested-by: Michael Stapelberg <michael@stapelberg.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-6-maxime@cerno.tech
2 years agodrm/vc4: hdmi: Move the HSM clock enable to runtime_pm
Maxime Ripard [Wed, 22 Sep 2021 12:54:18 +0000 (14:54 +0200)]
drm/vc4: hdmi: Move the HSM clock enable to runtime_pm

In order to access the HDMI controller, we need to make sure the HSM
clock is enabled. If we were to access it with the clock disabled, the
CPU would completely hang, resulting in an hard crash.

Since we have different code path that would require it, let's move that
clock enable / disable to runtime_pm that will take care of the
reference counting for us.

Since we also want to change the HSM clock rate and it's only valid
while the clock is disabled, we need to move the clk_set_min_rate() call
on the HSM clock above pm_runtime_get_and_sync().

Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder driver")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Tested-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Tested-by: Michael Stapelberg <michael@stapelberg.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-5-maxime@cerno.tech
Link: https://lore.kernel.org/linux-arm-kernel/20210924152334.1342630-1-maxime@cerno.tech/
2 years agodrm/vc4: hdmi: Set a default HSM rate
Maxime Ripard [Wed, 22 Sep 2021 12:54:17 +0000 (14:54 +0200)]
drm/vc4: hdmi: Set a default HSM rate

When the firmware doesn't setup the HSM rate (such as when booting
without an HDMI cable plugged in), its rate is 0 and thus any register
access results in a CPU stall, even though HSM is enabled.

Let's enforce a minimum rate at boot to avoid this issue.

Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder driver")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Tested-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Tested-by: Michael Stapelberg <michael@stapelberg.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-4-maxime@cerno.tech
2 years agoclk: bcm-2835: Remove rounding up the dividers
Maxime Ripard [Wed, 22 Sep 2021 12:54:16 +0000 (14:54 +0200)]
clk: bcm-2835: Remove rounding up the dividers

The driver, once it found a divider, tries to round it up by increasing
the least significant bit of the fractional part by one when the
round_up argument is set and there's a remainder.

However, since it increases the divider it will actually reduce the
clock rate below what we were asking for, leading to issues with
clk_set_min_rate() that will complain that our rounded clock rate is
below the minimum of the rate.

Since the dividers are fairly precise already, let's remove that part so
that we can have clk_set_min_rate() working.

This is effectively a revert of 9c95b32ca093 ("clk: bcm2835: add a round
up ability to the clock divisor").

Fixes: 9c95b32ca093 ("clk: bcm2835: add a round up ability to the clock divisor")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Tested-by: Nicolas Saenz Julienne <nsaenz@kernel.org> # boot and basic functionality
Tested-by: Michael Stapelberg <michael@stapelberg.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-3-maxime@cerno.tech
2 years agoclk: bcm-2835: Pick the closest clock rate
Maxime Ripard [Wed, 22 Sep 2021 12:54:15 +0000 (14:54 +0200)]
clk: bcm-2835: Pick the closest clock rate

The driver currently tries to pick the closest rate that is lower than
the rate being requested.

This causes an issue with clk_set_min_rate() since it actively checks
for the rounded rate to be above the minimum that was just set.

Let's change the logic a bit to pick the closest rate to the requested
rate, no matter if it's actually higher or lower.

Fixes: 6d18b8adbe67 ("clk: bcm2835: Support for clock parent selection")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Tested-by: Nicolas Saenz Julienne <nsaenz@kernel.org> # boot and basic functionality
Tested-by: Michael Stapelberg <michael@stapelberg.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-2-maxime@cerno.tech
2 years agoMerge drm/drm-next into drm-misc-next
Maxime Ripard [Mon, 25 Oct 2021 13:27:56 +0000 (15:27 +0200)]
Merge drm/drm-next into drm-misc-next

drm-misc-next hasn't been updated in a while and I need a post -rc2
state to merge some vc4 patches.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
2 years agodrm: use new iterator in drm_gem_plane_helper_prepare_fb v3
Christian König [Mon, 13 Sep 2021 11:47:53 +0000 (13:47 +0200)]
drm: use new iterator in drm_gem_plane_helper_prepare_fb v3

Makes the handling a bit more complex, but avoids the use of
dma_resv_get_excl_unlocked().

v2: improve coding and documentation
v3: adjust the TODO comment as suggested by Daniel

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-25-christian.koenig@amd.com
2 years agodrm: Move GEM memory managers into modules
Thomas Zimmermann [Wed, 20 Oct 2021 13:19:41 +0000 (15:19 +0200)]
drm: Move GEM memory managers into modules

DRM core uses the GEM base object to access GEM functionality. It does
not depend on individual implementations. Move the code into modules.

Also move the CMA framebuffer helpers into the CMA's module, as they're
not usable without CMA.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211020131941.15367-4-tzimmermann@suse.de
2 years agodrm: Link several object files into drm_kms_helper.ko
Thomas Zimmermann [Wed, 20 Oct 2021 13:19:40 +0000 (15:19 +0200)]
drm: Link several object files into drm_kms_helper.ko

Several core DRM functions are not used by the DRM core. Link the
object files into the KMS helper library.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211020131941.15367-3-tzimmermann@suse.de
2 years agodrm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set
Thomas Zimmermann [Wed, 20 Oct 2021 13:19:39 +0000 (15:19 +0200)]
drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set

All code in drm_irq.o is for legacy UMs drivers. Only build and link
the file if CONFIG_DRM_LEGACY has been enabled.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211020131941.15367-2-tzimmermann@suse.de
2 years agodrm/amdgpu: use new iterator in amdgpu_ttm_bo_eviction_valuable
Christian König [Tue, 15 Jun 2021 18:30:10 +0000 (20:30 +0200)]
drm/amdgpu: use new iterator in amdgpu_ttm_bo_eviction_valuable

Simplifying the code a bit.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-13-christian.koenig@amd.com
2 years agodrm/amdgpu: use the new iterator in amdgpu_sync_resv
Christian König [Tue, 15 Jun 2021 18:26:00 +0000 (20:26 +0200)]
drm/amdgpu: use the new iterator in amdgpu_sync_resv

Simplifying the code a bit.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-12-christian.koenig@amd.com
2 years agodma-buf: add dma_resv selftest v4
Christian König [Fri, 24 Sep 2021 15:10:19 +0000 (17:10 +0200)]
dma-buf: add dma_resv selftest v4

Just exercising a very minor subset of the functionality, but already
proven useful.

v2: add missing locking
v3: some more cleanup and consolidation, add unlocked test as well
v4: add a dma_resv_get_fences selftest

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> (v3)
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v3)
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-4-christian.koenig@amd.com
2 years agodrm/nouveau: use the new iterator in nouveau_fence_sync
Christian König [Wed, 16 Jun 2021 07:20:56 +0000 (09:20 +0200)]
drm/nouveau: use the new iterator in nouveau_fence_sync

Simplifying the code a bit.

The new implementation unifies the handling between drivers and so
results in waiting for all shared fernces in all cases.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-26-christian.koenig@amd.com
2 years agodma-buf: fix kerneldoc for renamed members
Christian König [Thu, 21 Oct 2021 06:55:24 +0000 (08:55 +0200)]
dma-buf: fix kerneldoc for renamed members

Those members where renamed, update the kerneldoc as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20211021141945.84023-1-christian.koenig@amd.com
2 years agoMerge tag 'drm-intel-gt-next-2021-10-21' of git://anongit.freedesktop.org/drm/drm...
Dave Airlie [Thu, 21 Oct 2021 20:30:33 +0000 (06:30 +1000)]
Merge tag 'drm-intel-gt-next-2021-10-21' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

UAPI Changes:

- Expose multi-LRC submission interface

  Similar to the bonded submission interface but simplified.
  Comes with GuC only implementation for now. See kerneldoc
  for more details.

  Userspace changes: https://github.com/intel/media-driver/pull/1252

- Expose logical engine instance to user

  Needed by the multi-LRC submission interface for GuC

  Userspace changes: https://github.com/intel/media-driver/pull/1252

Driver Changes:

- Fix blank screen booting crashes when CONFIG_CC_OPTIMIZE_FOR_SIZE=y (Hugh)
- Add support for multi-LRC submission in the GuC backend (Matt B)
- Add extra cache flushing before making pages userspace visible (Matt A, Thomas)
- Mark internal GPU object pages dirty so they will be flushed properly (Matt A)

- Move remaining debugfs interfaces i915_wedged/i915_forcewake_user into gt (Andi)
- Replace the unconditional clflushes with drm_clflush_virt_range() (Ville)
- Remove IS_ACTIVE macro completely (Lucas)
- Improve kerneldocs for cache_dirty (Matt A)

- Add missing includes (Lucas)
- Selftest improvements (Matt R, Ran, Matt A)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/YXFmLKoq8Fg9JxSd@jlahtine-mobl.ger.corp.intel.com
2 years agoMerge tag 'drm-intel-next-2021-10-15' of git://anongit.freedesktop.org/drm/drm-intel...
Dave Airlie [Thu, 21 Oct 2021 19:49:21 +0000 (05:49 +1000)]
Merge tag 'drm-intel-next-2021-10-15' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

UAPI Changes:

- No Functional change, but a clarification around I915_TILING values (Matt).

Driver Changes:

- Changes around async flip VT-d w/a (Ville)
- Delete bogus NULL check in intel_ddi_encoder_destroy (Dan)
- DP link training improvements and DP per-lane driver settings (Ville)
- Free the returned object of acpi_evaluate_dsm (Zenghui)
- Fixes and improvements around DP's UHBR and MST (Jani)
- refactor plane config + pin out (Dave)
- remove unused include in intel_dsi_vbt.c (Lucas)
- some code clean up (Lucas, Jani)
- gracefully disable dual eDP (Jani)
- Remove memory frequency calculation (Jose)
- Fix oops on platforms w/o hpd support (Ville)
- Clean up PXP Kconfig info (Rodrigo)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/YWnMORrixyw90O3/@intel.com
2 years agodrm/rockchip: Implement mmap as GEM object function
Thomas Zimmermann [Thu, 24 Jun 2021 09:55:02 +0000 (11:55 +0200)]
drm/rockchip: Implement mmap as GEM object function

Moving the driver-specific mmap code into a GEM object function allows
for using DRM helpers for various mmap callbacks.

The respective rockchip functions are being removed. The file_operations
structure fops is now being created by the helper macro
DEFINE_DRM_GEM_FOPS().

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
[On rk3288 (pinky), rk3399 (gru-kevin, puma) and rk3328 (rock64)]
Tested-by: Heiko Stuebner <heiko@sntech.de>
[On RK3188/RK3066 (without iommu)]
Tested-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20210624095502.8945-1-tzimmermann@suse.de
2 years agodrm/sun4i: virtual CMA addresses are not needed
Jernej Skrabec [Tue, 19 Oct 2021 18:10:28 +0000 (20:10 +0200)]
drm/sun4i: virtual CMA addresses are not needed

Driver never uses virtual address of DRM CMA buffers. Switch to CMA
helpers which don't deal with virtual mapping.

This was actually already the case before commit ad408c766cef
("drm/sun4i: Use DRM_GEM_CMA_VMAP_DRIVER_OPS for GEM operations"),
but only convenient macro at the time used helpers with virtual
mapping.

Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20211019181028.4190737-1-jernej.skrabec@gmail.com
2 years agodrm/gma500: Remove generic DRM drivers in probe function
Thomas Zimmermann [Tue, 19 Oct 2021 08:09:42 +0000 (10:09 +0200)]
drm/gma500: Remove generic DRM drivers in probe function

Gma500 currently removes generic fbdev drivers, but ignores
generic DRM drivers. Use aperture helpers to remove all generic
graphics drivers before loading gma500. Makes gma500 compatible
with simpledrm.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211019080942.24356-1-tzimmermann@suse.de
2 years agodrm/i915/selftests: mark up hugepages object with start_cpu_write
Matthew Auld [Mon, 18 Oct 2021 17:45:08 +0000 (18:45 +0100)]
drm/i915/selftests: mark up hugepages object with start_cpu_write

Just like we do for internal objects. Also just use
i915_gem_object_set_cache_coherency() here. No need for over-flushing on
LLC platforms.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018174508.2137279-9-matthew.auld@intel.com
2 years agodrm/i915: mark up internal objects with start_cpu_write
Matthew Auld [Mon, 18 Oct 2021 17:45:07 +0000 (18:45 +0100)]
drm/i915: mark up internal objects with start_cpu_write

While the pages can't be swapped out, they can be discarded by the shrinker.
Normally such objects are marked with __I915_MADV_PURGED, which can't be
unset, and therefore requires a new object. For kernel internal objects
this is not true, since the madv hint is reset for our special volatile
objects, such that we can re-acquire new pages, if so desired, without
needing a new object. As a result we should probably be paranoid here
and put the object back into the CPU domain when discarding the pages,
and also correctly set cache_dirty, if required.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018174508.2137279-8-matthew.auld@intel.com
2 years agodrm/i915: expand on the kernel-doc for cache_dirty
Matthew Auld [Mon, 18 Oct 2021 17:45:06 +0000 (18:45 +0100)]
drm/i915: expand on the kernel-doc for cache_dirty

Add some details around non-LLC platforms and cflushing, when dealing
with the flush-on-acquire, which is potentially security sensitive.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018174508.2137279-7-matthew.auld@intel.com
2 years agodrm/i915/shmem: ensure flush during swap-in on non-LLC
Matthew Auld [Mon, 18 Oct 2021 17:45:05 +0000 (18:45 +0100)]
drm/i915/shmem: ensure flush during swap-in on non-LLC

On non-LLC platforms, force the flush-on-acquire if this is ever
swapped-in. Our async flush path is not trust worthy enough yet(and
happens in the wrong order), and with some tricks it's conceivable for
userspace to change the cache-level to I915_CACHE_NONE after the pages
are swapped-in, and since execbuf binds the object before doing the
async flush, there is a potential race window.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018174508.2137279-6-matthew.auld@intel.com
2 years agodrm/i915/userptr: add paranoid flush-on-acquire
Matthew Auld [Mon, 18 Oct 2021 17:45:04 +0000 (18:45 +0100)]
drm/i915/userptr: add paranoid flush-on-acquire

Even though userptr objects are always coherent with the GPU, with no
way for userspace to change this with the set_caching ioctl, even on
non-LLC platforms, there is still the 'Bypass LCC' mocs setting, which
might permit reading the contents of main memory directly.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018174508.2137279-5-matthew.auld@intel.com
2 years agodrm/i915/dmabuf: add paranoid flush-on-acquire
Matthew Auld [Mon, 18 Oct 2021 17:45:03 +0000 (18:45 +0100)]
drm/i915/dmabuf: add paranoid flush-on-acquire

As pointed out by Thomas, we likely need to flush the pages here if the
GPU can read the page contents directly from main memory. Underneath we
don't know what the sg_table is pointing to, so just add a
wbinvd_on_all_cpus() here, for now.

Reported-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018174508.2137279-4-matthew.auld@intel.com
2 years agodrm/i915: extract bypass-llc check into helper
Matthew Auld [Mon, 18 Oct 2021 17:45:02 +0000 (18:45 +0100)]
drm/i915: extract bypass-llc check into helper

It looks like we will need this in some more places, so extract as a
helper.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018174508.2137279-3-matthew.auld@intel.com
2 years agodrm/i915: mark userptr objects as ALLOC_USER
Matthew Auld [Mon, 18 Oct 2021 17:45:01 +0000 (18:45 +0100)]
drm/i915: mark userptr objects as ALLOC_USER

These are userspace objects, so mark them as such. In a later patch it's
useful to determine how paranoid we need to be when managing cache
flushes. In theory no functional changes.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018174508.2137279-2-matthew.auld@intel.com
2 years agodrm/i915: mark dmabuf objects as ALLOC_USER
Matthew Auld [Mon, 18 Oct 2021 17:45:00 +0000 (18:45 +0100)]
drm/i915: mark dmabuf objects as ALLOC_USER

These are userspace objects, so mark them as such. In a later patch it's
useful to determine how paranoid we need to be when managing cache
flushes. In theory no functional changes.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018174508.2137279-1-matthew.auld@intel.com
2 years agodrm/radeon: use new iterator in radeon_sync_resv
Christian König [Wed, 16 Jun 2021 07:23:50 +0000 (09:23 +0200)]
drm/radeon: use new iterator in radeon_sync_resv

Simplifying the code a bit.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-16-christian.koenig@amd.com
2 years agodrm/msm: use new iterator in msm_gem_describe
Christian König [Wed, 16 Jun 2021 07:19:37 +0000 (09:19 +0200)]
drm/msm: use new iterator in msm_gem_describe

Simplifying the code a bit. Also drop the RCU read side lock since the
object is locked anyway.

Untested since I can't get the driver to compile on !ARM.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-15-christian.koenig@amd.com
2 years agodrm/amdgpu: use new iterator in amdgpu_vm_prt_fini
Christian König [Wed, 22 Sep 2021 12:14:01 +0000 (14:14 +0200)]
drm/amdgpu: use new iterator in amdgpu_vm_prt_fini

No need to actually allocate an array of fences here.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-14-christian.koenig@amd.com
2 years agodrm/i915/selftests: remove duplicate include in mock_region.c
Ran Jianping [Tue, 19 Oct 2021 09:02:05 +0000 (09:02 +0000)]
drm/i915/selftests: remove duplicate include in mock_region.c

'drm/ttm/ttm_placement.h' included in
'drivers/gpu/drm/i915/selftests/mock_region.c' is duplicated.
It is also included on the 9 line.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ran Jianping <ran.jianping@zte.com.cn>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211019090205.1003458-1-ran.jianping@zte.com.cn
2 years agoMerge tag 'topic/drm-dp-training-delay-helpers-2021-10-19' of git://anongit.freedeskt...
Maxime Ripard [Tue, 19 Oct 2021 13:26:26 +0000 (15:26 +0200)]
Merge tag 'topic/drm-dp-training-delay-helpers-2021-10-19' of git://anongit.freedesktop.org/drm/drm-intel into drm-misc-next

Core Changes:
- drm dp helpers for figuring out link training delays

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
From: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/878ryps5b6.fsf@intel.com
2 years agodrm/scheduler: fix drm_sched_job_add_implicit_dependencies
Christian König [Mon, 18 Oct 2021 19:27:55 +0000 (21:27 +0200)]
drm/scheduler: fix drm_sched_job_add_implicit_dependencies

Trivial fix since we now need to grab a reference to the fence we have
added. Previously the dma_resv function where doing that for us.

Signed-off-by: Christian König <christian.koenig@amd.com>
Fixes: 9c2ba265352a ("drm/scheduler: use new iterator in drm_sched_job_add_implicit_dependencies v2")
Link: https://patchwork.freedesktop.org/patch/msgid/20211019112706.27769-1-christian.koenig@amd.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reported-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
References: https://lore.kernel.org/dri-devel/2023306.UmlnhvANQh@archbook/
Tested-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>