platform/kernel/linux-starfive.git
4 years agodrm/nouveau/kms/nv50-: convert core head_dither() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 23:22:47 +0000 (09:22 +1000)]
drm/nouveau/kms/nv50-: convert core head_dither() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core head_ovly() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 23:20:29 +0000 (09:20 +1000)]
drm/nouveau/kms/nv50-: convert core head_ovly() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core head_base() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 23:19:28 +0000 (09:19 +1000)]
drm/nouveau/kms/nv50-: convert core head_base() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core head_curs_clr() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 23:17:11 +0000 (09:17 +1000)]
drm/nouveau/kms/nv50-: convert core head_curs_clr() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core head_curs_set() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 23:14:25 +0000 (09:14 +1000)]
drm/nouveau/kms/nv50-: convert core head_curs_set() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core head_core_clr() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 23:07:28 +0000 (09:07 +1000)]
drm/nouveau/kms/nv50-: convert core head_core_clr() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core head_core_set() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 23:06:18 +0000 (09:06 +1000)]
drm/nouveau/kms/nv50-: convert core head_core_set() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core head_olut_clr() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 23:00:52 +0000 (09:00 +1000)]
drm/nouveau/kms/nv50-: convert core head_olut_clr() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core head_olut_set() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 22:58:11 +0000 (08:58 +1000)]
drm/nouveau/kms/nv50-: convert core head_olut_set() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core head_mode() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 22:51:03 +0000 (08:51 +1000)]
drm/nouveau/kms/nv50-: convert core head_mode() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core head_view() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 08:34:00 +0000 (18:34 +1000)]
drm/nouveau/kms/nv50-: convert core head_view() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core or_ctrl() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 07:20:39 +0000 (17:20 +1000)]
drm/nouveau/kms/nv50-: convert core or_ctrl() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core wndw_owner() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 07:12:16 +0000 (17:12 +1000)]
drm/nouveau/kms/nv50-: convert core wndw_owner() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core update() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 07:10:46 +0000 (17:10 +1000)]
drm/nouveau/kms/nv50-: convert core update() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core caps_init() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 07:06:41 +0000 (17:06 +1000)]
drm/nouveau/kms/nv50-: convert core caps_init() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert core init() to new push macros
Ben Skeggs [Sat, 20 Jun 2020 07:04:57 +0000 (17:04 +1000)]
drm/nouveau/kms/nv50-: convert core init() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wndw update() to new push macros
Ben Skeggs [Fri, 19 Jun 2020 23:32:58 +0000 (09:32 +1000)]
drm/nouveau/kms/nv50-: convert wndw update() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wndw blend_set() to new push macros
Ben Skeggs [Fri, 19 Jun 2020 23:25:55 +0000 (09:25 +1000)]
drm/nouveau/kms/nv50-: convert wndw blend_set() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wndw scale_set() to new push macros
Ben Skeggs [Fri, 19 Jun 2020 23:24:21 +0000 (09:24 +1000)]
drm/nouveau/kms/nv50-: convert wndw scale_set() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wndw image_clr() to new push macros
Ben Skeggs [Fri, 19 Jun 2020 23:23:10 +0000 (09:23 +1000)]
drm/nouveau/kms/nv50-: convert wndw image_clr() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wndw image_set() to new push macros
Ben Skeggs [Fri, 19 Jun 2020 23:20:17 +0000 (09:20 +1000)]
drm/nouveau/kms/nv50-: convert wndw image_set() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wndw xlut_clr() to new push macros
Ben Skeggs [Fri, 19 Jun 2020 22:50:50 +0000 (08:50 +1000)]
drm/nouveau/kms/nv50-: convert wndw xlut_clr() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wndw xlut_set() to new push macros
Ben Skeggs [Fri, 19 Jun 2020 22:47:20 +0000 (08:47 +1000)]
drm/nouveau/kms/nv50-: convert wndw xlut_set() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wndw csc_clr() to new push macros
Ben Skeggs [Fri, 19 Jun 2020 22:44:11 +0000 (08:44 +1000)]
drm/nouveau/kms/nv50-: convert wndw csc_clr() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wndw csc_set() to new push macros
Ben Skeggs [Fri, 19 Jun 2020 22:39:21 +0000 (08:39 +1000)]
drm/nouveau/kms/nv50-: convert wndw csc_set() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wndw ntfy_clr() to new push macros
Ben Skeggs [Fri, 19 Jun 2020 22:32:28 +0000 (08:32 +1000)]
drm/nouveau/kms/nv50-: convert wndw ntfy_clr() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wndw ntfy_set() to new push macros
Ben Skeggs [Fri, 19 Jun 2020 22:29:31 +0000 (08:29 +1000)]
drm/nouveau/kms/nv50-: convert wndw ntfy_set() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wndw sema_clr() to new push macros
Ben Skeggs [Fri, 19 Jun 2020 22:04:01 +0000 (08:04 +1000)]
drm/nouveau/kms/nv50-: convert wndw sema_clr() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wndw sema_set() to new push macros
Ben Skeggs [Fri, 19 Jun 2020 21:57:12 +0000 (07:57 +1000)]
drm/nouveau/kms/nv50-: convert wndw sema_set() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wimm update() to new push macros
Ben Skeggs [Sun, 21 Jun 2020 00:22:35 +0000 (10:22 +1000)]
drm/nouveau/kms/nv50-: convert wimm update() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: convert wimm point() to new push macros
Ben Skeggs [Sun, 21 Jun 2020 00:19:40 +0000 (10:19 +1000)]
drm/nouveau/kms/nv50-: convert wimm point() to new push macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/nv50-: wrap existing command submission in nvif_push interface
Ben Skeggs [Fri, 19 Jun 2020 21:52:26 +0000 (07:52 +1000)]
drm/nouveau/kms/nv50-: wrap existing command submission in nvif_push interface

This commit pulls in a bunch of new push buffer macros which are able to
support NVIDIA's class headers, and provide more useful debug output and
error checking (compile-time, where possible) than we had previously.

Will incrementally transition each function over to the unified interfaces.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/nvif: add support for object-level debug output
Ben Skeggs [Mon, 29 Jun 2020 10:49:15 +0000 (20:49 +1000)]
drm/nouveau/nvif: add support for object-level debug output

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/nvif: give every notify object a human-readable name
Ben Skeggs [Mon, 8 Jun 2020 04:47:37 +0000 (14:47 +1000)]
drm/nouveau/nvif: give every notify object a human-readable name

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/nvif: give every disp object a human-readable identifier
Ben Skeggs [Mon, 30 Mar 2020 04:03:20 +0000 (14:03 +1000)]
drm/nouveau/nvif: give every disp object a human-readable identifier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/nvif: give every usermode object a human-readable identifier
Ben Skeggs [Mon, 30 Mar 2020 04:01:57 +0000 (14:01 +1000)]
drm/nouveau/nvif: give every usermode object a human-readable identifier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/nvif: give every vmm object a human-readable identifier
Ben Skeggs [Mon, 30 Mar 2020 03:59:39 +0000 (13:59 +1000)]
drm/nouveau/nvif: give every vmm object a human-readable identifier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/nvif: give every mem object a human-readable identifier
Ben Skeggs [Mon, 30 Mar 2020 03:56:55 +0000 (13:56 +1000)]
drm/nouveau/nvif: give every mem object a human-readable identifier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/nvif: give every mmu object a human-readable identifier
Ben Skeggs [Mon, 30 Mar 2020 03:51:38 +0000 (13:51 +1000)]
drm/nouveau/nvif: give every mmu object a human-readable identifier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/nvif: give every device object a human-readable identifier
Ben Skeggs [Mon, 30 Mar 2020 03:49:05 +0000 (13:49 +1000)]
drm/nouveau/nvif: give every device object a human-readable identifier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/nvif: give every object a human-readable identifier
Ben Skeggs [Sun, 29 Mar 2020 23:51:33 +0000 (09:51 +1000)]
drm/nouveau/nvif: give every object a human-readable identifier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/nvif: rename client ctor/dtor
Ben Skeggs [Mon, 30 Mar 2020 03:45:33 +0000 (13:45 +1000)]
drm/nouveau/nvif: rename client ctor/dtor

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
4 years agodrm/nouveau/kms/tu102: set NVC57D_HEAD_SET_HEAD_USAGE_BOUNDS_UPSCALING_ALLOWED to...
Ben Skeggs [Fri, 24 Jul 2020 00:13:21 +0000 (10:13 +1000)]
drm/nouveau/kms/tu102: set NVC57D_HEAD_SET_HEAD_USAGE_BOUNDS_UPSCALING_ALLOWED to TRUE

Fixes issues when switching between scaling modes.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau: Use fallthrough pseudo-keyword
Gustavo A. R. Silva [Tue, 7 Jul 2020 17:36:28 +0000 (12:36 -0500)]
drm/nouveau: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/vmm/gp100-: fix mapping 2MB sysmem pages
Ralph Campbell [Tue, 30 Jun 2020 19:57:35 +0000 (12:57 -0700)]
drm/nouveau/vmm/gp100-: fix mapping 2MB sysmem pages

The nvif_object_ioctl() method NVIF_VMM_V0_PFNMAP wasn't correctly
setting the hardware specific GPU page table entries for 2MB sized
pages. Fix this by adding functions to set and clear PD0 GPU page
table entries.

Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/mmu: make nvkm_vmm_ctor() static
Ralph Campbell [Mon, 22 Jun 2020 23:38:54 +0000 (16:38 -0700)]
drm/nouveau/mmu: make nvkm_vmm_ctor() static

The function nvkm_vmm_ctor() is not called outside of the file defining
it, so make it static.

Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau: fix reference count leak in nouveau_debugfs_strap_peek
Aditya Pakki [Sun, 14 Jun 2020 01:48:37 +0000 (20:48 -0500)]
drm/nouveau: fix reference count leak in nouveau_debugfs_strap_peek

nouveau_debugfs_strap_peek() calls pm_runtime_get_sync() that
increments the reference count. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau: Fix reference count leak in nouveau_connector_detect
Aditya Pakki [Sun, 14 Jun 2020 01:22:23 +0000 (20:22 -0500)]
drm/nouveau: Fix reference count leak in nouveau_connector_detect

nouveau_connector_detect() calls pm_runtime_get_sync and in turn
increments the reference count. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau: fix reference count leak in nv50_disp_atomic_commit
Aditya Pakki [Sun, 14 Jun 2020 01:29:18 +0000 (20:29 -0500)]
drm/nouveau: fix reference count leak in nv50_disp_atomic_commit

nv50_disp_atomic_commit() calls calls pm_runtime_get_sync and in turn
increments the reference count. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau: fix multiple instances of reference count leaks
Aditya Pakki [Sun, 14 Jun 2020 01:41:56 +0000 (20:41 -0500)]
drm/nouveau: fix multiple instances of reference count leaks

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/drm/noveau: fix reference count leak in nouveau_fbcon_open
Aditya Pakki [Sun, 14 Jun 2020 01:33:42 +0000 (20:33 -0500)]
drm/nouveau/drm/noveau: fix reference count leak in nouveau_fbcon_open

nouveau_fbcon_open() calls calls pm_runtime_get_sync() that
increments the reference count. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/sec2/gp102: allow module to load when LSFW is missing
Ben Skeggs [Tue, 16 Jun 2020 00:41:49 +0000 (10:41 +1000)]
drm/nouveau/sec2/gp102: allow module to load when LSFW is missing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/gr/gm200-: explicitly handle nofw
Ben Skeggs [Tue, 16 Jun 2020 01:30:04 +0000 (11:30 +1000)]
drm/nouveau/gr/gm200-: explicitly handle nofw

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/pmu/gm200-: explicitly handle nofw
Ben Skeggs [Tue, 16 Jun 2020 05:26:20 +0000 (15:26 +1000)]
drm/nouveau/pmu/gm200-: explicitly handle nofw

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/pmu/gm20x: don't pretend we support loading with our custom FW
Ben Skeggs [Tue, 16 Jun 2020 05:15:58 +0000 (15:15 +1000)]
drm/nouveau/pmu/gm20x: don't pretend we support loading with our custom FW

It technically loads, and runs, but is ultimately pointless outside of
a very narrow window (fanless systems where one wants to attempt using
the, broken for a lot of gm20x, memory reclocking code).

It's also potentially dangerous to override the VBIOS-provided "Pre-OS"
PMU, which would be responsible for fan control otherwise.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/acr: store a mask of LS falcons the controlling LSFW can bootstrap
Ben Skeggs [Tue, 16 Jun 2020 04:57:31 +0000 (14:57 +1000)]
drm/nouveau/acr: store a mask of LS falcons the controlling LSFW can bootstrap

This will prevent some pain with broken firmware trees, as under some
circumstances the HSFW can fail and leave the GPU in a state we don't
know how to recover from.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/acr: store a mask of LS falcons the HSFW can bootstrap
Ben Skeggs [Tue, 16 Jun 2020 04:19:35 +0000 (14:19 +1000)]
drm/nouveau/acr: store a mask of LS falcons the HSFW can bootstrap

This will prevent reloading of HS FW where it's pointless, and bypass
hitting some timeouts.

Not a situation one should generally hit, but can occur with a messed
up firmware installation.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/acr: allow module to load when HSFW(s) are missing
Ben Skeggs [Tue, 16 Jun 2020 00:47:07 +0000 (10:47 +1000)]
drm/nouveau/acr: allow module to load when HSFW(s) are missing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/acr: refuse to load LSFW if HSFW is missing
Ben Skeggs [Tue, 16 Jun 2020 01:38:47 +0000 (11:38 +1000)]
drm/nouveau/acr: refuse to load LSFW if HSFW is missing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/core: drop error message when no compatible FW found
Ben Skeggs [Tue, 16 Jun 2020 01:14:41 +0000 (11:14 +1000)]
drm/nouveau/core: drop error message when no compatible FW found

This is less than useful with some subdevs having _nofw variants in their
FWIF lists - it's cleaner to handle them all in the same way.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/mmu/gp100-: enable mmu invalidate depth optimisation
Ben Skeggs [Wed, 10 Jun 2020 04:46:01 +0000 (14:46 +1000)]
drm/nouveau/mmu/gp100-: enable mmu invalidate depth optimisation

This causes us to invalidate MMU only at the level we made modifications -
ie: if we've only modified PTEs, there's no need to have MMU dump the PDs
it's fetched into L2.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/nvfw: firmware structures should begin with nvfw_
Timur Tabi [Tue, 9 Jun 2020 12:52:04 +0000 (07:52 -0500)]
drm/nouveau/nvfw: firmware structures should begin with nvfw_

Rename all structures that are used directly by firmware to have a nvfw_
prefix.

This makes it easier to identify structures that have a fixed, specific
layout.  A future patch will define several more such structures, so it's
important to be consistent now.

Signed-off-by: Timur Tabi <ttabi@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/tmr: fix nvkm_usec/nvkm_msec definitions
Timur Tabi [Tue, 9 Jun 2020 12:52:03 +0000 (07:52 -0500)]
drm/nouveau/tmr: fix nvkm_usec/nvkm_msec definitions

nvkm_timer_wait_init() takes a u64 as a duration parameter, but the
expression "(m) * 1000" will be promoted only to a 32-bit integer,
if 'm' is also an integer.  Changing the 1000 to 1000ULL ensures that
the expression will be 64 bits.

This change currently has no effect as there are no callers of
nvkm_msec() that exceed 2000ms.

Signed-off-by: Timur Tabi <ttabi@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/therm/gt215: make gt215_therm_init static
Ben Skeggs [Fri, 29 May 2020 23:55:19 +0000 (09:55 +1000)]
drm/nouveau/therm/gt215: make gt215_therm_init static

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/mmu: make a couple of functions static
Ben Skeggs [Fri, 29 May 2020 23:54:26 +0000 (09:54 +1000)]
drm/nouveau/mmu: make a couple of functions static

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/mc/gp10b: make gp10b_mc_init static
Ben Skeggs [Fri, 29 May 2020 23:53:57 +0000 (09:53 +1000)]
drm/nouveau/mc/gp10b: make gp10b_mc_init static

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/nvfw/acr: make lsb_header_tail_dump static
Ben Skeggs [Fri, 29 May 2020 23:35:55 +0000 (09:35 +1000)]
drm/nouveau/nvfw/acr: make lsb_header_tail_dump static

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/gr/gf100-: make some functions static
Ben Skeggs [Fri, 29 May 2020 23:34:08 +0000 (09:34 +1000)]
drm/nouveau/gr/gf100-: make some functions static

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agodrm/nouveau/disp/gm200-: remove 'head' parameter from nvkm_ior_func.hdmi.scdc()
Ben Skeggs [Fri, 29 May 2020 05:14:49 +0000 (15:14 +1000)]
drm/nouveau/disp/gm200-: remove 'head' parameter from nvkm_ior_func.hdmi.scdc()

It's no longer required.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4 years agoMerge tag 'mediatek-drm-next-5.9' of https://git.kernel.org/pub/scm/linux/kernel...
Dave Airlie [Thu, 23 Jul 2020 23:41:48 +0000 (09:41 +1000)]
Merge tag 'mediatek-drm-next-5.9' of https://git./linux/kernel/git/chunkuang.hu/linux into drm-next

Mediatek DRM Next for Linux 5.9

This include converting mtk_dsi to drm_bridge API.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200716233102.566-1-chunkuang.hu@kernel.org
4 years agoMerge tag 'drm/tegra/for-5.9-rc1' of ssh://git.freedesktop.org/git/tegra/linux into...
Dave Airlie [Thu, 23 Jul 2020 23:38:44 +0000 (09:38 +1000)]
Merge tag 'drm/tegra/for-5.9-rc1' of ssh://git.freedesktop.org/git/tegra/linux into drm-next

drm/tegra: Changes for v5.9-rc1

This set of patches contains a few preparatory patches to enable video
capture support from external camera modules. This is a dependency for
the V4L2 driver patches that will likely be merged in v5.9 or v5.10.

On top of that there are a couple of fixes across the board as well as
some improvements.

From a feature point of view this also adds support for horizontal
reflection and 180° rotation of planes.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Thierry Reding <thierry.reding@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200717162011.1661788-1-thierry.reding@gmail.com
4 years agoMerge v5.8-rc6 into drm-next
Dave Airlie [Thu, 23 Jul 2020 22:28:09 +0000 (08:28 +1000)]
Merge v5.8-rc6 into drm-next

I've got a silent conflict + two trees based on fixes to merge.

Fixes a silent merge with amdgpu

Signed-off-by: Dave Airlie <airlied@redhat.com>
4 years agoMerge tag 'amd-drm-next-5.9-2020-07-17' of git://people.freedesktop.org/~agd5f/linux...
Dave Airlie [Thu, 23 Jul 2020 05:38:10 +0000 (15:38 +1000)]
Merge tag 'amd-drm-next-5.9-2020-07-17' of git://people.freedesktop.org/~agd5f/linux into drm-next

amd-drm-next-5.9-2020-07-17:

amdgpu:
- SI UVD/VCE clock support
- Updates for Sienna Cichlid
- Expose drm rotation property
- Atomfirmware updates for renoir
- updates to GPUVM hub handling for different register layouts
- swSMU restructuring and cleanups
- RAS fixes
- DC fixes
- mode1 reset support for Sienna Cichlid
- Add support for Navy Flounder GPUs

amdkfd:
- Add SMI events watch interface

UAPI:
- Add amdkfd SMI events watch interface
  Userspace which uses this interface:
  https://github.com/RadeonOpenCompute/rocm_smi_lib/commit/2235ede34c456f1c7d3490f6fe74825d442d272e

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200717132022.4014-1-alexander.deucher@amd.com
4 years agoMerge tag 'drm-xilinx-dpsub-20200718' of git://linuxtv.org/pinchartl/media into drm...
Dave Airlie [Thu, 23 Jul 2020 05:31:29 +0000 (15:31 +1000)]
Merge tag 'drm-xilinx-dpsub-20200718' of git://linuxtv.org/pinchartl/media into drm-next

Xilinx ZynqMP DisplayPort Subsystem driver

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200718001755.GA5962@pendragon.ideasonboard.com
4 years agoMerge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm...
Dave Airlie [Thu, 23 Jul 2020 05:28:05 +0000 (15:28 +1000)]
Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm-next

Nothing too exciting:
- a cleanup of our clock handling and improved error handling in this
area from Lubomir
- conversion to pin_user_pages for long page references from John
- fixed PM runtime API error handling from Navid

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Lucas Stach <l.stach@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/d9e2660d71051bf3cab8aa7afc9f62102ac910d9.camel@pengutronix.de
4 years agoMerge tag 'imx-drm-next-2020-07-20' of git://git.pengutronix.de/pza/linux into drm...
Dave Airlie [Thu, 23 Jul 2020 05:21:32 +0000 (15:21 +1000)]
Merge tag 'imx-drm-next-2020-07-20' of git://git.pengutronix.de/pza/linux into drm-next

drm/imx: error path fixes and cleanups

- Fix use after free issue in component bind error path by keeping
  memory allocated as long as the driver is bound. This will be replaced
  with drm managed memory in the next round.
- Fix bus_flags overriding logic in parallel-display.
- Disable regulator in imx-tve bind error path.
- Drop unnecessary best_encoder callback.
- Remove an unused enum in imx-ldb.
- Bail out early on missing panel or bridge in parallel-display to speed
  up -EPROBE_DEFER path.
- Disable both LDB channels in split mode.
- Restore RGB32, BGR32 format support.
- Fix tiled image conversion in case of out of order interrupts.
- Remove a superfluous error message in imx-tve.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/ac4452eb3a989bf5d85b65fd30840a21f15ec301.camel@pengutronix.de
4 years agodma-fence: Make symbol 'dma_fence_lockdep_map' static
Wei Yongjun [Wed, 22 Jul 2020 16:17:19 +0000 (16:17 +0000)]
dma-fence: Make symbol 'dma_fence_lockdep_map' static

The sparse tool complains as follows:

drivers/dma-buf/dma-fence.c:249:25: warning:
symbol 'dma_fence_lockdep_map' was not declared. Should it be static?

This variable is not used outside of dma-fence.c, so this commit
marks it static.

Fixes: 5fbff813a4a3 ("dma-fence: basic lockdep annotations")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/dc5e3b19-2087-44ab-a28c-ddb38ff8861a@email.android.com
4 years agoMerge tag 'drm-misc-next-2020-07-22' of git://anongit.freedesktop.org/drm/drm-misc...
Dave Airlie [Thu, 23 Jul 2020 04:01:37 +0000 (14:01 +1000)]
Merge tag 'drm-misc-next-2020-07-22' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for v5.9:

UAPI Changes:

Cross-subsystem Changes:
- Convert panel-dsi-cm and ingenic bindings to YAML.
- Add lockdep annotations for dma-fence. \o/
- Describe why indefinite fences are a bad idea
- Update binding for rocktech jh057n00900.

Core Changes:
- Add vblank workers.
- Use spin_(un)lock_irq instead of the irqsave/restore variants in crtc code.
- Add managed vram helpers.
- Convert more logging to drm functions.
- Replace more http links with https in core and drivers.
- Cleanup to ttm iomem functions and implementation.
- Remove TTM CMA memtype as it doesn't work correctly.
- Remove TTM_MEMTYPE_FLAG_MAPPABLE for many drivers that have no
  unmappable memory resources.

Driver Changes:
- Add CRC support to nouveau, using the new vblank workers.
- Dithering and atomic state fix for nouveau.
- Fixes for Frida FRD350H54004 panel.
- Add support for OSD mode (sprite planes), IPU (scaling) and multiple
  panels/bridges to ingenic.
- Use managed vram helpers in ast.
- Assorted small fixes to ingenic, i810, mxsfb.
- Remove optional unused ttm dummy functions.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/d6bf269e-ccb2-8a7b-fdae-226e9e3f8274@linux.intel.com
4 years agodt-binding: display: Allow a single port node on rocktech, jh057n00900
Ondrej Jirman [Fri, 3 Jul 2020 11:47:17 +0000 (13:47 +0200)]
dt-binding: display: Allow a single port node on rocktech, jh057n00900

The display has one port. Allow it in the binding.

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Ondrej Jirman <megous@megous.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200703114717.2140832-3-megous@megous.com
4 years agodt-bindings: display: Fix example in nwl-dsi.yaml
Ondrej Jirman [Fri, 3 Jul 2020 11:47:16 +0000 (13:47 +0200)]
dt-bindings: display: Fix example in nwl-dsi.yaml

The example is now validated against rocktech,jh057n00900 schema
that was ported to yaml, and didn't validate with:

- '#address-cells', '#size-cells', 'port@0' do not match any of
  the regexes: 'pinctrl-[0-9]+'
- 'vcc-supply' is a required property
- 'iovcc-supply' is a required property
- 'reset-gpios' is a required property

Fix it.

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Ondrej Jirman <megous@megous.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200703114717.2140832-2-megous@megous.com
4 years agodrm/vblank: Use spin_(un)lock_irq() in drm_crtc_queue_sequence_ioctl()
Lyude Paul [Mon, 20 Jul 2020 19:07:36 +0000 (15:07 -0400)]
drm/vblank: Use spin_(un)lock_irq() in drm_crtc_queue_sequence_ioctl()

This is an ioctl callback, so we're guaranteed to have IRQs enabled when
calling this function. Use the plain _irq() variants of spin_(un)lock()
to make this more obvious.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200720190736.180297-6-lyude@redhat.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
4 years agodrm/vblank: Use spin_(un)lock_irq() in drm_queue_vblank_event()
Lyude Paul [Mon, 20 Jul 2020 19:07:35 +0000 (15:07 -0400)]
drm/vblank: Use spin_(un)lock_irq() in drm_queue_vblank_event()

This one's easy - we're already calling kzalloc(GFP_KERNEL) in this
function, so we must already be guaranteed to have IRQs enabled when
calling this. So, use the plain _irq() variants of spin_(un)lock() to
make this more obvious.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200720190736.180297-5-lyude@redhat.com
4 years agodrm/vblank: Use spin_(un)lock_irq() in drm_legacy_vblank_post_modeset()
Lyude Paul [Mon, 20 Jul 2020 19:07:34 +0000 (15:07 -0400)]
drm/vblank: Use spin_(un)lock_irq() in drm_legacy_vblank_post_modeset()

This function is only ever called from ioctl context, so we're
guaranteed to have interrupts enabled. Stop using the irqsave/irqrestore
variants of spin_(un)lock_irq() to make this more obvious.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200720190736.180297-4-lyude@redhat.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
4 years agodrm/vblank: Use spin_(un)lock_irq() in drm_crtc_vblank_on()
Lyude Paul [Mon, 20 Jul 2020 19:07:33 +0000 (15:07 -0400)]
drm/vblank: Use spin_(un)lock_irq() in drm_crtc_vblank_on()

This is only called from:
* Atomic modesetting hooks
* Module probing routines
* Legacy modesetting hooks

All of which have IRQs enabled, so we can also get rid of
irqsave/restore here to make the IRQ context of this function more
obvious.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200720190736.180297-3-lyude@redhat.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
4 years agodrm/vblank: Use spin_(un)lock_irq() in drm_crtc_vblank_reset()
Lyude Paul [Mon, 20 Jul 2020 19:07:32 +0000 (15:07 -0400)]
drm/vblank: Use spin_(un)lock_irq() in drm_crtc_vblank_reset()

All of the drivers in the kernel tree only call this from one of the
following contexts:

* drm_crtc_funcs->reset
* During initial module load

Since both of these contexts are guaranteed to have interrupts enabled
beforehand, there's no need to use the irqsave/irqrestore variants of
spin_(un)lock(). So, fix this to make the irq context of this function
more obvious.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200720190736.180297-2-lyude@redhat.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
4 years agodrm/qxl: stop using TTM_MEMTYPE_FLAG_MAPPABLE v2
Christian König [Thu, 16 Jul 2020 11:46:05 +0000 (13:46 +0200)]
drm/qxl: stop using TTM_MEMTYPE_FLAG_MAPPABLE v2

The driver doesn't expose any not-mapable memory resources.

v2: remove unused man variable as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/378246/
4 years agodrm/nouveau: stop using TTM_MEMTYPE_FLAG_MAPPABLE
Christian König [Thu, 16 Jul 2020 11:35:48 +0000 (13:35 +0200)]
drm/nouveau: stop using TTM_MEMTYPE_FLAG_MAPPABLE

The driver doesn't expose any not-mapable memory resources.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/378244/
4 years agodrm/vmwgfx: stop using TTM_MEMTYPE_FLAG_MAPPABLE
Christian König [Thu, 16 Jul 2020 08:15:17 +0000 (10:15 +0200)]
drm/vmwgfx: stop using TTM_MEMTYPE_FLAG_MAPPABLE

The driver doesn't expose any not-mapable memory resources.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/378241/
4 years agodrm/ttm: remove TTM_MEMTYPE_FLAG_CMA
Christian König [Wed, 15 Jul 2020 12:52:05 +0000 (14:52 +0200)]
drm/ttm: remove TTM_MEMTYPE_FLAG_CMA

The original intention was to avoid CPU page table unmaps
when BOs move between the GTT and SYSTEM domain.

The problem is that this never correctly handled changes
in the caching attributes or backing pages.

Just drop this for now and simply unmap the CPU page
tables 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/378240/
4 years agodrm/ttm: cleanup coding style and implementation.
Christian König [Wed, 15 Jul 2020 11:22:56 +0000 (13:22 +0200)]
drm/ttm: cleanup coding style and implementation.

Only functional change is to always keep io_reserved_count up to date
for debugging even when it is not used otherwise.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/378242/
4 years agodrm/ttm: remove io_reserve_fastpath flag
Christian König [Wed, 15 Jul 2020 11:05:52 +0000 (13:05 +0200)]
drm/ttm: remove io_reserve_fastpath flag

Just use the use_io_reserve_lru flag. It doesn't make much
sense to have two flags.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/378238/
4 years agodrm/ttm: cleanup io_mem interface with nouveau
Christian König [Mon, 13 Jul 2020 14:50:04 +0000 (16:50 +0200)]
drm/ttm: cleanup io_mem interface with nouveau

Nouveau is the only user of this functionality and evicting io space
on -EAGAIN is really a misuse of the return code.

Instead switch to using -ENOSPC here which makes much more sense and
simplifies the code.

This could unbreak something as we now cleanly return EAGAIN, but the
chance for this are rather low.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/378237/
4 years agodrm: remove optional dummy function from drivers using TTM
Christian König [Fri, 10 Jul 2020 13:13:41 +0000 (15:13 +0200)]
drm: remove optional dummy function from drivers using TTM

Implementing those is completely unnecessary.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Madhav Chauhan <madhav.chauhan@amd.com>
Link: https://patchwork.freedesktop.org/patch/378236/
4 years agodma-buf.rst: Document why indefinite fences are a bad idea
Daniel Vetter [Thu, 9 Jul 2020 12:33:38 +0000 (14:33 +0200)]
dma-buf.rst: Document why indefinite fences are a bad idea

Comes up every few years, gets somewhat tedious to discuss, let's
write this down once and for all.

What I'm not sure about is whether the text should be more explicit in
flat out mandating the amdkfd eviction fences for long running compute
workloads or workloads where userspace fencing is allowed.

v2: Now with dot graph!

v3: Typo (Dave Airlie)

Reviewed-by: Thomas Hellstrom <thomas.hellstrom@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Jesse Natalie <jenatali@microsoft.com>
Cc: Steve Pronovost <spronovo@microsoft.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Thomas Hellstrom <thomas.hellstrom@intel.com>
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: linux-rdma@vger.kernel.org
Cc: amd-gfx@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200709123339.547390-1-daniel.vetter@ffwll.ch
4 years agodma-fence: prime lockdep annotations
Daniel Vetter [Tue, 7 Jul 2020 20:12:06 +0000 (22:12 +0200)]
dma-fence: prime lockdep annotations

Two in one go:
- it is allowed to call dma_fence_wait() while holding a
  dma_resv_lock(). This is fundamental to how eviction works with ttm,
  so required.

- it is allowed to call dma_fence_wait() from memory reclaim contexts,
  specifically from shrinker callbacks (which i915 does), and from mmu
  notifier callbacks (which amdgpu does, and which i915 sometimes also
  does, and probably always should, but that's kinda a debate). Also
  for stuff like HMM we really need to be able to do this, or things
  get real dicey.

Consequence is that any critical path necessary to get to a
dma_fence_signal for a fence must never a) call dma_resv_lock nor b)
allocate memory with GFP_KERNEL. Also by implication of
dma_resv_lock(), no userspace faulting allowed. That's some supremely
obnoxious limitations, which is why we need to sprinkle the right
annotations to all relevant paths.

The one big locking context we're leaving out here is mmu notifiers,
added in

commit 23b68395c7c78a764e8963fc15a7cfd318bf187f
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Mon Aug 26 22:14:21 2019 +0200

    mm/mmu_notifiers: add a lockdep map for invalidate_range_start/end

that one covers a lot of other callsites, and it's also allowed to
wait on dma-fences from mmu notifiers. But there's no ready-made
functions exposed to prime this, so I've left it out for now.

v2: Also track against mmu notifier context.

v3: kerneldoc to spec the cross-driver contract. Note that currently
i915 throws in a hard-coded 10s timeout on foreign fences (not sure
why that was done, but it's there), which is why that rule is worded
with SHOULD instead of MUST.

Also some of the mmu_notifier/shrinker rules might surprise SoC
drivers, I haven't fully audited them all. Which is infeasible anyway,
we'll need to run them with lockdep and dma-fence annotations and see
what goes boom.

v4: A spelling fix from Mika

v5: #ifdef for CONFIG_MMU_NOTIFIER. Reported by 0day. Unfortunately
this means lockdep enforcement is slightly inconsistent, it won't spot
GFP_NOIO and GFP_NOFS allocations in the wrong spot if
CONFIG_MMU_NOTIFIER is disabled in the kernel config. Oh well.

v5: Note that only drivers/gpu has a reasonable (or at least
historical) excuse to use dma_fence_wait() from shrinker and mmu
notifier callbacks. Everyone else should either have a better memory
manager model, or better hardware. This reflects discussions with
Jason Gunthorpe.

Cc: Jason Gunthorpe <jgg@mellanox.com>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: kernel test robot <lkp@intel.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@intel.com> (v4)
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Thomas Hellstrom <thomas.hellstrom@intel.com>
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: linux-rdma@vger.kernel.org
Cc: amd-gfx@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200707201229.472834-3-daniel.vetter@ffwll.ch
4 years agodma-fence: basic lockdep annotations
Daniel Vetter [Tue, 7 Jul 2020 20:12:05 +0000 (22:12 +0200)]
dma-fence: basic lockdep annotations

Design is similar to the lockdep annotations for workers, but with
some twists:

- We use a read-lock for the execution/worker/completion side, so that
  this explicit annotation can be more liberally sprinkled around.
  With read locks lockdep isn't going to complain if the read-side
  isn't nested the same way under all circumstances, so ABBA deadlocks
  are ok. Which they are, since this is an annotation only.

- We're using non-recursive lockdep read lock mode, since in recursive
  read lock mode lockdep does not catch read side hazards. And we
  _very_ much want read side hazards to be caught. For full details of
  this limitation see

  commit e91498589746065e3ae95d9a00b068e525eec34f
  Author: Peter Zijlstra <peterz@infradead.org>
  Date:   Wed Aug 23 13:13:11 2017 +0200

      locking/lockdep/selftests: Add mixed read-write ABBA tests

- To allow nesting of the read-side explicit annotations we explicitly
  keep track of the nesting. lock_is_held() allows us to do that.

- The wait-side annotation is a write lock, and entirely done within
  dma_fence_wait() for everyone by default.

- To be able to freely annotate helper functions I want to make it ok
  to call dma_fence_begin/end_signalling from soft/hardirq context.
  First attempt was using the hardirq locking context for the write
  side in lockdep, but this forces all normal spinlocks nested within
  dma_fence_begin/end_signalling to be spinlocks. That bollocks.

  The approach now is to simple check in_atomic(), and for these cases
  entirely rely on the might_sleep() check in dma_fence_wait(). That
  will catch any wrong nesting against spinlocks from soft/hardirq
  contexts.

The idea here is that every code path that's critical for eventually
signalling a dma_fence should be annotated with
dma_fence_begin/end_signalling. The annotation ideally starts right
after a dma_fence is published (added to a dma_resv, exposed as a
sync_file fd, attached to a drm_syncobj fd, or anything else that
makes the dma_fence visible to other kernel threads), up to and
including the dma_fence_wait(). Examples are irq handlers, the
scheduler rt threads, the tail of execbuf (after the corresponding
fences are visible), any workers that end up signalling dma_fences and
really anything else. Not annotated should be code paths that only
complete fences opportunistically as the gpu progresses, like e.g.
shrinker/eviction code.

The main class of deadlocks this is supposed to catch are:

Thread A:

mutex_lock(A);
mutex_unlock(A);

dma_fence_signal();

Thread B:

mutex_lock(A);
dma_fence_wait();
mutex_unlock(A);

Thread B is blocked on A signalling the fence, but A never gets around
to that because it cannot acquire the lock A.

Note that dma_fence_wait() is allowed to be nested within
dma_fence_begin/end_signalling sections. To allow this to happen the
read lock needs to be upgraded to a write lock, which means that any
other lock is acquired between the dma_fence_begin_signalling() call and
the call to dma_fence_wait(), and still held, this will result in an
immediate lockdep complaint. The only other option would be to not
annotate such calls, defeating the point. Therefore these annotations
cannot be sprinkled over the code entirely mindless to avoid false
positives.

Originally I hope that the cross-release lockdep extensions would
alleviate the need for explicit annotations:

https://lwn.net/Articles/709849/

But there's a few reasons why that's not an option:

- It's not happening in upstream, since it got reverted due to too
  many false positives:

commit e966eaeeb623f09975ef362c2866fae6f86844f9
Author: Ingo Molnar <mingo@kernel.org>
Date:   Tue Dec 12 12:31:16 2017 +0100

    locking/lockdep: Remove the cross-release locking checks

    This code (CONFIG_LOCKDEP_CROSSRELEASE=y and CONFIG_LOCKDEP_COMPLETIONS=y),
    while it found a number of old bugs initially, was also causing too many
    false positives that caused people to disable lockdep - which is arguably
    a worse overall outcome.

- cross-release uses the complete() call to annotate the end of
  critical sections, for dma_fence that would be dma_fence_signal().
  But we do not want all dma_fence_signal() calls to be treated as
  critical, since many are opportunistic cleanup of gpu requests. If
  these get stuck there's still the main completion interrupt and
  workers who can unblock everyone. Automatically annotating all
  dma_fence_signal() calls would hence cause false positives.

- cross-release had some educated guesses for when a critical section
  starts, like fresh syscall or fresh work callback. This would again
  cause false positives without explicit annotations, since for
  dma_fence the critical sections only starts when we publish a fence.

- Furthermore there can be cases where a thread never does a
  dma_fence_signal, but is still critical for reaching completion of
  fences. One example would be a scheduler kthread which picks up jobs
  and pushes them into hardware, where the interrupt handler or
  another completion thread calls dma_fence_signal(). But if the
  scheduler thread hangs, then all the fences hang, hence we need to
  manually annotate it. cross-release aimed to solve this by chaining
  cross-release dependencies, but the dependency from scheduler thread
  to the completion interrupt handler goes through hw where
  cross-release code can't observe it.

In short, without manual annotations and careful review of the start
and end of critical sections, cross-relese dependency tracking doesn't
work. We need explicit annotations.

v2: handle soft/hardirq ctx better against write side and dont forget
EXPORT_SYMBOL, drivers can't use this otherwise.

v3: Kerneldoc.

v4: Some spelling fixes from Mika

v5: Amend commit message to explain in detail why cross-release isn't
the solution.

v6: Pull out misplaced .rst hunk.

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Thomas Hellstrom <thomas.hellstrom@intel.com>
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: linux-rdma@vger.kernel.org
Cc: amd-gfx@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200707201229.472834-2-daniel.vetter@ffwll.ch
4 years agodrm/vram-helper: stop using TTM_MEMTYPE_FLAG_MAPPABLE
Christian König [Thu, 16 Jul 2020 11:58:35 +0000 (13:58 +0200)]
drm/vram-helper: stop using TTM_MEMTYPE_FLAG_MAPPABLE

The helper doesn't expose any not-mapable memory resources.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/377649/
4 years agodrm/imx: imx-tve: Delete an error message in imx_tve_bind()
Markus Elfring [Sun, 5 Apr 2020 09:01:49 +0000 (11:01 +0200)]
drm/imx: imx-tve: Delete an error message in imx_tve_bind()

The function “platform_get_irq” can log an error already.
Thus omit a redundant message for the exception handling in the
calling function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
4 years agogpu: ipu-v3: image-convert: Wait for all EOFs before completing a tile
Steve Longerbeam [Thu, 25 Jun 2020 18:13:37 +0000 (11:13 -0700)]
gpu: ipu-v3: image-convert: Wait for all EOFs before completing a tile

Use a bit-mask of EOF irqs to determine when all required idmac
channel EOFs have been received for a tile conversion, and only do
tile completion processing after all EOFs have been received. Otherwise
it was found that a conversion would stall after the completion of a
tile and the start of the next tile, because the input/read idmac
channel had not completed and entered idle state, thus locking up the
channel when attempting to re-start it for the next tile.

Fixes: 0537db801bb01 ("gpu: ipu-v3: image-convert: reconfigure IC per tile")
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
4 years agogpu: ipu-v3: image-convert: Combine rotate/no-rotate irq handlers
Steve Longerbeam [Wed, 17 Jun 2020 22:40:37 +0000 (15:40 -0700)]
gpu: ipu-v3: image-convert: Combine rotate/no-rotate irq handlers

Combine the rotate_irq() and norotate_irq() handlers into a single
eof_irq() handler.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>