OSDN Git Service

tomoyo/tomoyo-test1.git
12 months agodrm/nouveau/nvkm: punt spurious irq messages to debug level
Ben Skeggs [Thu, 25 May 2023 00:30:58 +0000 (10:30 +1000)]
drm/nouveau/nvkm: punt spurious irq messages to debug level

This can be completely normal in some situations (ie. non-stall intrs
when nothing is waiting on them).

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230525003106.3853741-2-skeggsb@gmail.com
12 months agodrm/nouveau/nvkm: fini object children in reverse order
Ben Skeggs [Thu, 25 May 2023 00:30:57 +0000 (10:30 +1000)]
drm/nouveau/nvkm: fini object children in reverse order

Turns out, we're currently tearing down the disp core channel *before*
the satellite channels (wndw, etc) during suspend.

This makes RM return NV_ERR_NOT_SUPPORTED on attempting to reallocate
the core channel on resume for some reason, but we probably shouldn't
be doing it on HW either.

Tear down children in the reverse of allocation order instead.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230525003106.3853741-1-skeggsb@gmail.com
12 months agoMAINTAINERS: Remove Laura Abbott from DMA-BUF HEAPS FRAMEWORK
John Stultz [Fri, 30 Jun 2023 16:20:33 +0000 (16:20 +0000)]
MAINTAINERS: Remove Laura Abbott from DMA-BUF HEAPS FRAMEWORK

Laura's email address has not been valid for quite awhile now,
so wanted to clean up the reviewer list here.

I reached out to Laura who said it made sense to drop her from
the list, so this patch does that.

I do want to recognize Laura's long time contribution to this
area and her previous ION maintainership, as this couldn't
have gone upstream without her prior efforts. Many thanks!

Cc: Laura Abbott <labbott@kernel.org>
Cc: T.J. Mercier <tjmercier@google.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: John Stultz <jstultz@google.com>
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: kernel-team@android.com
Acked-by: Laura Abbott <labbott@kernel.org>
Signed-off-by: John Stultz <jstultz@google.com>
Reviewed-by: T.J. Mercier <tjmercier@google.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230630162111.3051783-1-jstultz@google.com
12 months agoMAINTAINERS: add maintainers for DRM LOONGSON driver
Sui Jingfeng [Thu, 15 Jun 2023 14:36:13 +0000 (22:36 +0800)]
MAINTAINERS: add maintainers for DRM LOONGSON driver

This patch add Sui Jingfeng as maintainer to drm/loongson driver.

Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230615143613.1236245-3-15330273260@189.cn
12 months agodrm: Add kms driver for loongson display controller
Sui Jingfeng [Thu, 15 Jun 2023 14:36:12 +0000 (22:36 +0800)]
drm: Add kms driver for loongson display controller

Loongson display controller IP has been integrated in both Loongson north
bridge chipset (ls7a1000/ls7a2000) and Loongson SoCs (ls2k1000/ls2k2000).
It has even been included in Loongson's BMC products. It has two display
pipes, and each display pipe supports a primary plane and a cursor plane.

For the DC in the LS7a1000, each display pipe has a DVO output interface,
which is able to support 1920x1080@60Hz. For the DC in the LS7A2000, each
display pipe is equipped with a built-in HDMI encoder, which is compliant
with the HDMI 1.4 specification. The first display pipe is also equipped
with a transparent VGA encoder, which is parallel with the HDMI encoder.
To get a decent performance for writing framebuffer data to the VRAM, the
write combine support should be enabled.

v1 -> v2:
 1) Use hpd status reg when polling for ls7a2000.
 2) Fix all warnings that emerged when compiling with W=1.

v2 -> v3:
 1) Add COMPILE_TEST to Kconfig and make the driver off by default
 2) Alphabetical sorting headers (Thomas)
 3) Untangle register access functions as much as possible (Thomas)
 4) Switch to TTM-based memory manager (Thomas)
 5) Add the chip ID detection function which can be used to distinguish
    chip models
 6) Revise the built-in HDMI phy driver, nearly all main stream mode below
    4K@30Hz is tested, and this driver supports clone(mirror) display mode
    and extend(joint) display mode.

v3 -> v4:
 1) Quickly fix a small mistake.

v4 -> v5:
 1) Add per display pipe debugfs support to the builtin HDMI encoder.

v5 -> v6:
 1) Remove stray code which didn't get used, say lsdc_of_get_reserved_ram
 2) Fix all typos I could found, make sentences and code more readable
 3) Untangle lsdc_hdmi*_connector_detect() function according to the pipe
 4) Rename this driver as loongson.

v6 -> v7:
1) Add prime support for buffer self-sharing, sharing buffer with
   drm/etnaviv is also tested and it works with limitations.
2) Implement buffer object tracking with list_head.
3) Add S3(sleep to RAM) support
4) Rewrite lsdc_bo_move since TTM core stop allocating resources
    during BO creation. Patch V1 ~ V6 of this series no longer work.
    Thus, we send V7.

v7 -> v8:
 1) Zero a compile warning on a 32-bit platform, compile with W=1
 2) Revise lsdc_bo_gpu_offset() and make minor cleanups.
 3) Pageflip tested on the virtual terminal with the following commands:

    modetest -M loongson -s 32:1920x1080 -v
    modetest -M loongson -s 34:1920x1080 -v -F tiles

   It works like a charm, when running the pageflip test with dual screens
   configuration, another two additional BOs were created by the modetest,
   VRAM usage up to 40+ MB, well we have at least 64MB, still enough.

   # cat bos

       bo[0000]: size:     8112kB VRAM
       bo[0001]: size:       16kB VRAM
       bo[0002]: size:       16kB VRAM
       bo[0003]: size:    16208kB VRAM
       bo[0004]: size:     8112kB VRAM
       bo[0005]: size:     8112kB VRAM

v8 -> v9:
 1) Select I2C and I2C_ALGOBIT in Kconfig, should depend on MMU.
 2) Using pci_get_domain_bus_and_slot to get the GPU device.

v9 -> v10:
 1) Revise lsdc_drm_freeze() to implement S3 correctly. We realized that
    the pinned BO could not be moved, the VRAM lost power when sleeping
    to RAM. Thus, the data in the buffer who is pinned in VRAM will get
    lost when resumed. Yet it's not a big problem because this driver
    relies on the CPU to update the front framebuffer. We can see the
    garbage data when resume from S3, but the screen will show the right
    image as I move the cursor. This is due to the CPU repaint. v10 of
    this patch makes S3 perfect by unpin all of the BOs in VRAM, evict
    them all to system RAM in lsdc_drm_freeze().

v10 -> v11:
 1) On a double-screen case, The buffer object backing the single giant
    framebuffer is referenced by two GEM objects; hence, it will be
    pinned at least twice by prepare_fb() function. This causes its pin
    count > 1. V10 of this patch only unpins VRAM BOs once when suspend,
    which is not correct on double-screen case. V11 of this patch unpin
    the BOs until its pin count reaches zero when suspend. Then, we make
    the S3 support complete finally. With v11, I can't see any garbage
    data when resume.

 2) Fix vblank wait timeout when disable CRTC.
 3) Test against IGT, at least fbdev test and kms_flip test passed.
 4) Rewrite pixel PLL update function, magic numbers eliminated (Emil)
 5) Drop a few common hardware features description in lsdc_desc (Emil)
 6) Drop lsdc_mode_config_mode_valid(), instead add restrictions in dumb
    create function. (Emil)
 7) Untangle the ls7a1000 case and ls7a2000 case completely (Thomas)

v11 -> v12:
 none

v12 -> v13:
 1) Add benchmarks to figure out the bandwidth of the hardware platform.
    Usage:
    # cd /sys/kernel/debug/dri/0/
    # cat benchmark

 2) VRAM is filled with garbage data if uninitialized, add a buffer
    clearing procedure (lsdc_bo_clear), clear the BO on creation time.
 3) Update copyrights and adjust coding style (Huacai)

v13 -> v14:
 1) Trying to add async update support for cursor plane.

v14 -> v15:
 1) Add lsdc_vga_set_decode() funciton, which allow us remove multi-video
    cards workaround, now it allow drm/loongson, drm/amdgpu, drm/etnaviv
    co-exist in the system, more is also possible (Emil and Xuerui)
 2) Fix typos and grammar mistakes as much as possible (Xuerui)
 3) Unify copyrights as GPL-2.0+ (Xuerui)
 4) Fix a bug introduce since V13, TTM may import BO from other drivers,
    we shouldn't clear it on such a case.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: loongson-kernel@lists.loongnix.cn
Tested-by: Liu Peibao <liupeibao@loongson.cn>
Tested-by: Li Yi  <liyi@loongson.cn>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
Link: https://patchwork.freedesktop.org/patch/msgid/20230615143613.1236245-2-15330273260@189.cn
12 months agodrm/drm_gem.c: Remove surplus else after return
Sui Jingfeng [Thu, 22 Jun 2023 10:18:57 +0000 (18:18 +0800)]
drm/drm_gem.c: Remove surplus else after return

else is not generally useful after return

Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230622101857.2298773-1-suijingfeng@loongson.cn
12 months agodrm/gud: use vmalloc_array and vcalloc
Julia Lawall [Tue, 27 Jun 2023 14:43:18 +0000 (16:43 +0200)]
drm/gud: use vmalloc_array and vcalloc

Use vmalloc_array and vcalloc to protect against
multiplication overflows.

The changes were done using the following Coccinelle
semantic patch:

// <smpl>
@initialize:ocaml@
@@

let rename alloc =
  match alloc with
    "vmalloc" -> "vmalloc_array"
  | "vzalloc" -> "vcalloc"
  | _ -> failwith "unknown"

@@
    size_t e1,e2;
    constant C1, C2;
    expression E1, E2, COUNT, x1, x2, x3;
    typedef u8;
    typedef __u8;
    type t = {u8,__u8,char,unsigned char};
    identifier alloc = {vmalloc,vzalloc};
    fresh identifier realloc = script:ocaml(alloc) { rename alloc };
@@

(
      alloc(x1*x2*x3)
|
      alloc(C1 * C2)
|
      alloc((sizeof(t)) * (COUNT), ...)
|
-     alloc((e1) * (e2))
+     realloc(e1, e2)
|
-     alloc((e1) * (COUNT))
+     realloc(COUNT, e1)
|
-     alloc((E1) * (E2))
+     realloc(E1, E2)
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230627144339.144478-4-Julia.Lawall@inria.fr
12 months agodrm: bridge: samsung-dsim: Drain command transfer FIFO before transfer
Marek Vasut [Thu, 15 Jun 2023 20:15:11 +0000 (22:15 +0200)]
drm: bridge: samsung-dsim: Drain command transfer FIFO before transfer

Wait until the command transfer FIFO is empty before loading in the next
command. The previous behavior where the code waited until command transfer
FIFO was not full suffered from transfer corruption, where the last command
in the FIFO could be overwritten in case the FIFO indicates not full, but
also does not have enough space to store another transfer yet.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # imx8mm-icore
Link: https://patchwork.freedesktop.org/patch/msgid/20230615201511.565923-1-marex@denx.de
12 months agoMAINTAINERS: Add T.J. Mercier as reviewer for DMA-BUF HEAPS FRAMEWORK
John Stultz [Fri, 30 Jun 2023 04:52:23 +0000 (04:52 +0000)]
MAINTAINERS: Add T.J. Mercier as reviewer for DMA-BUF HEAPS FRAMEWORK

T.J. has been responsible for dmab-buf items on the Android team
for awhile now, so it would be great to have him on as a reviewer.

Cc: T.J. Mercier <tjmercier@google.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: John Stultz <jstultz@google.com>
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: kernel-team@android.com
Signed-off-by: John Stultz <jstultz@google.com>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230630045246.1674919-1-jstultz@google.com
12 months agoMAINTAINERS: Remove Liam Mark from DMA-BUF HEAPS FRAMEWORK
Jeffrey Hugo [Wed, 28 Jun 2023 18:05:34 +0000 (12:05 -0600)]
MAINTAINERS: Remove Liam Mark from DMA-BUF HEAPS FRAMEWORK

@codeaurora.org email addresses are no longer valid and will bounce.

I reached out to Liam about updating his entry under DMA-BUF HEAPS
FRAMEWORK with an @codeaurora.org address.  His response:

"I am not a maintainer anymore, that should be removed."

Liam currently does not have an email address that can be used to remove
this entry, so I offered to submit a cleanup on his behalf with Liam's
consent.

Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Acked-by: John Stultz <jstultz@google.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230628180534.31819-1-quic_jhugo@quicinc.com
12 months agodrm/edid: Add quirk for OSVR HDK 2.0
Ralph Campbell [Wed, 21 Jun 2023 06:19:03 +0000 (23:19 -0700)]
drm/edid: Add quirk for OSVR HDK 2.0

The OSVR virtual reality headset HDK 2.0 uses a different EDID
vendor and device identifier than the HDK 1.1 - 1.4 headsets.
Add the HDK 2.0 vendor and device identifier to the quirks table so
that window managers do not try to display the desktop screen on the
headset display.

Closes: https://gitlab.freedesktop.org/drm/misc/-/issues/30
Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Tested-by: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230621061903.3422648-1-rcampbell@nvidia.com
12 months agodrm/tests: Fix swapped drm_framebuffer tests parameter names
Carlos Eduardo Gallo Filho [Sat, 24 Jun 2023 21:29:05 +0000 (18:29 -0300)]
drm/tests: Fix swapped drm_framebuffer tests parameter names

Swap tests parameters names so they actually reflect what is being tested.

Signed-off-by: Carlos Eduardo Gallo Filho <gcarlos@disroot.org>
Reviewed-by: André Almeida <andrealmeid@igalia.com>
Reviewed-by: Maíra Canal <mairacanal@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230624212905.21338-1-gcarlos@disroot.org
12 months agodrm/edid: make read-only const array static
Colin Ian King [Tue, 27 Jun 2023 17:01:09 +0000 (18:01 +0100)]
drm/edid: make read-only const array static

Don't populate the const array on the stack, instead make it static.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230627170109.751829-1-colin.i.king@gmail.com
12 months agodrm/ast: Merge config and chip detection
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:48 +0000 (14:53 +0200)]
drm/ast: Merge config and chip detection

Detection of the configuration mode and the chipset model are
linked to each other. One uses values from the other; namely the
PCI device revision and the SCU revision. Merge this code into
a single function.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-15-tzimmermann@suse.de
12 months agodrm/ast: Move widescreen and tx-chip detection into separate helpers
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:47 +0000 (14:53 +0200)]
drm/ast: Move widescreen and tx-chip detection into separate helpers

Split ast_detect_chip() into three functions and call them one by
one. The new functions detect the transmitter chip and widescreen
support. This will allow for further refactoring.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Tested-by: Sui Jingfeng <suijingfeng@loongson.cn> # AST2400
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-14-tzimmermann@suse.de
12 months agodrm/ast: Detect AST 2510 model
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:46 +0000 (14:53 +0200)]
drm/ast: Detect AST 2510 model

Detect the 6th-generation AST 2510. Allows to simplify the code
for widescreen support.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-13-tzimmermann@suse.de
12 months agodrm/ast: Detect AST 1400 model
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:45 +0000 (14:53 +0200)]
drm/ast: Detect AST 1400 model

Detect the 5th-generation AST 1400. Allows to simplify the code
for widescreen support.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-12-tzimmermann@suse.de
12 months agodrm/ast: Detect AST 1300 model
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:44 +0000 (14:53 +0200)]
drm/ast: Detect AST 1300 model

Detect the 4th-generation AST 1300. Allows to simplify the code
for widescreen support.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-11-tzimmermann@suse.de
12 months agodrm/ast: Distinguish among chip generations
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:43 +0000 (14:53 +0200)]
drm/ast: Distinguish among chip generations

ASpeed distinguishes among various generations of the AST graphics
chipset with various models. [1] The most-recent model AST 2600 is
of the 7th generation, the AST 2500 is of the 6th generation, and so
on.

The ast driver simply picks one of the models as representative for
the whole generation. In several places, individual models of the
same generation need to be handled differently, which then requires
additional code for detecting the model.

Introduce different generations of the Aspeed chipset. In the source
code, refer to the generation instead of the representation model where
possible. The few places that require per-model handling are now clearly
marked.

In the enum ast_chip, we arrange each model's value such that it
encodes the generation. This allows for an easy test. The actual values
are ordered, but not of interest to the driver.

v2:
* use __ast_gen_is_eq() (Jingfeng)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://web.archive.org/web/20141007093258/http://www.aspeedtech.com/products.php?fPath=20
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-10-tzimmermann@suse.de
12 months agodrm/ast: Set up release action right after enabling MMIO
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:42 +0000 (14:53 +0200)]
drm/ast: Set up release action right after enabling MMIO

Ast sets up a managed release of the MMIO access flags. Move this
code next to the MMIO access code, so that it runs if other errors
occur during the device initialization.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Sui Jingfeng <suijingfeng@loongson.cn> # AST2400
Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-9-tzimmermann@suse.de
12 months agodrm/ast: Enable and unlock device access early during init
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:41 +0000 (14:53 +0200)]
drm/ast: Enable and unlock device access early during init

POST and memory management contains code to enable access to the
device's memory spaces. This is too late. Consolidate this code at
the beginning of the device initialization.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-8-tzimmermann@suse.de
12 months agodrm/ast: Set PCI config before accessing I/O registers
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:40 +0000 (14:53 +0200)]
drm/ast: Set PCI config before accessing I/O registers

Access to I/O registers is required to detect and set up the
device. Enable the rsp PCI config bits before. While at it,
convert the magic number to macro constants.

Enabling the PCI config bits was done after trying to detect
the device. It was probably too late at this point.

v2:
* use standard 16-bit PCI r/w access (Jingfeng)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-7-tzimmermann@suse.de
12 months agodrm/ast: Remove device POSTing and config from chip detection
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:39 +0000 (14:53 +0200)]
drm/ast: Remove device POSTing and config from chip detection

There's way too much going on in ast_detect_chip(). Move the POST
and config code from the top of the function into the caller. No
functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-6-tzimmermann@suse.de
12 months agodrm/ast: Remove dead else branch in POST code
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:38 +0000 (14:53 +0200)]
drm/ast: Remove dead else branch in POST code

According to the chip detection in ast_detect_chip(), AST2300 and
later always have a PCI revision of 0x20 or higher. Therefore the
code in ast_set_def_ext_reg() can not use the else branch when
selecing the EXT register values. Remove the dead branch and the
related values.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-5-tzimmermann@suse.de
12 months agodrm/ast: Implement register helpers in ast_drv.h
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:37 +0000 (14:53 +0200)]
drm/ast: Implement register helpers in ast_drv.h

There are already a number of register I/O functions in ast_drv.h.
For consistency, move the remaining functions there as well. No
functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-4-tzimmermann@suse.de
12 months agodrm/ast: Remove vga2_clone field
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:36 +0000 (14:53 +0200)]
drm/ast: Remove vga2_clone field

Remove the unused field vga2_clone from struct ast_device. No
functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-3-tzimmermann@suse.de
12 months agodrm/ast: Fix DRAM init on AST2200
Thomas Zimmermann [Wed, 21 Jun 2023 12:53:35 +0000 (14:53 +0200)]
drm/ast: Fix DRAM init on AST2200

Fix the test for the AST2200 in the DRAM initialization. The value
in ast->chip has to be compared against an enum constant instead of
a numerical value.

This bug got introduced when the driver was first imported into the
kernel.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 312fec1405dd ("drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)")
Cc: Dave Airlie <airlied@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v3.5+
Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-2-tzimmermann@suse.de
12 months agodrm/ttm: Don't shadow the operation context
Thomas Hellström [Mon, 26 Jun 2023 09:14:48 +0000 (11:14 +0200)]
drm/ttm: Don't shadow the operation context

ttm_bo_swapout() shadows the ttm operation context which may cause
major confusion in driver callbacks when swapping out !TTM_PL_SYSTEM
memory. Fix this by reusing the operation context argument to
ttm_bo_swapout().

Cc: "Christian König" <christian.koenig@amd.com>
Cc: Roger He <Hongbo.He@amd.com>
Cc: <dri-devel@lists.freedesktop.org>
Cc: <intel-gfx@lists.freedesktop.org>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Acked-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Christian König <ckoenig.leichtzumerken@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230626091450.14757-3-thomas.hellstrom@linux.intel.com
12 months agofbdev: Make support for userspace interfaces configurable
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:13 +0000 (13:07 +0200)]
fbdev: Make support for userspace interfaces configurable

Add Kconfig option CONFIG_FB_DEVICE and make the virtual fbdev
device optional. If the new option has not been selected, fbdev
does not create files in devfs, sysfs or procfs.

Most modern Linux systems run a DRM-based graphics stack that uses
the kernel's framebuffer console, but has otherwise deprecated fbdev
support. Yet fbdev userspace interfaces are still present.

The option makes it possible to use the fbdev subsystem as console
implementation without support for userspace. This closes potential
entry points to manipulate kernel or I/O memory via framebuffers. It
also prevents the execution of driver code via ioctl or sysfs, both
of which might allow malicious software to exploit bugs in the fbdev
code.

A small number of fbdev drivers require struct fbinfo.dev to be
initialized, usually for the support of sysfs interface. Make these
drivers depend on FB_DEVICE. They can later be fixed if necessary.

v3:
* effect -> affect in Kconfig help (Daniel)
v2:
* set FB_DEVICE default to y (Geert)
* comment on {get,put}_device() (Sam)
* Kconfig fixes (Sam)
* add TODO item about FB_DEVICE dependencies (Sam)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-39-tzimmermann@suse.de
12 months agofbdev/core: Rework fb init code
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:12 +0000 (13:07 +0200)]
fbdev/core: Rework fb init code

Init the class "graphics" before the rest of fbdev. Later steps, such
as the sysfs code, depend on the class. Also arrange the module's exit
code in reverse order.

Unexport the global variable fb_class, which is only shared internally
within the fbdev core module.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-38-tzimmermann@suse.de
12 months agofbdev/core: Move file-I/O code into separate file
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:11 +0000 (13:07 +0200)]
fbdev/core: Move file-I/O code into separate file

Move fbdev's file-I/O code into a separate file and contain it in
init and cleanup helpers. No functional changes.

v3:
* add missing file fb_chrdev.c
v2:
* rename source file (Sam)
* include <linux/compat.h> (Javier, kernel test robot)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-37-tzimmermann@suse.de
12 months agofbdev/core: Move procfs code to separate file
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:10 +0000 (13:07 +0200)]
fbdev/core: Move procfs code to separate file

Move fbdev's procfs code into a separate file and contain it in
init and cleanup helpers. For the cleanup, replace remove_proc_entry()
with proc_remove(). It is equivalent in functionality, but looks
more like an inverse of proc_create_seq().

v2:
* document proc_remove() usage (Sam)
* revert unrelated removal of for_each_registered_fb()

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-36-tzimmermann@suse.de
12 months agofbdev/core: Add fb_device_{create,destroy}()
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:09 +0000 (13:07 +0200)]
fbdev/core: Add fb_device_{create,destroy}()

Move the logic to create and destroy fbdev devices into the new
helpers fb_device_create() and fb_device_destroy().

There was a call to fb_cleanup_device() in do_unregister_framebuffer()
that was too late. The device had already been removed at this point.
Move the call into fb_device_destroy().

Declare the helpers in the new internal header file  fb_internal.h, as
they are only used within the fbdev core module.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-35-tzimmermann@suse.de
12 months agofbdev/core: Move framebuffer and backlight helpers into separate files
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:08 +0000 (13:07 +0200)]
fbdev/core: Move framebuffer and backlight helpers into separate files

Move framebuffer and backlight helpers into separate files. Leave
fbsysfs.c to sysfs-related code. No functional changes.

The framebuffer helpers are not in fbmem.c because they are under
GPL-2.0-or-later copyright, while fbmem.c is GPL-2.0.

v2:
* include <linux/mutex.h> (Sam)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-34-tzimmermann@suse.de
12 months agofbdev/core: Pass Linux device to pm_vt_switch_*() functions
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:07 +0000 (13:07 +0200)]
fbdev/core: Pass Linux device to pm_vt_switch_*() functions

Pass the Linux device to pm_vt_switch_*() instead of the virtual
fbdev device. Prepares fbdev for making struct fb_info.dev optional.

The type of device that is passed to the PM functions does not matter
much. It is only a token within the internal list of known devices.
The PM functions do not refer to any of the device's properties or its
type.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: linux-pm@vger.kernel.org
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-33-tzimmermann@suse.de
12 months agofbdev/tdfxfb: Set i2c adapter parent to hardware device
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:06 +0000 (13:07 +0200)]
fbdev/tdfxfb: Set i2c adapter parent to hardware device

Use the 3dfx hardware device from the Linux device hierarchy as
parent device of the i2c adapter. Aligns the driver with the rest
of the codebase and prepares fbdev for making struct fb_info.dev
optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-32-tzimmermann@suse.de
12 months agofbdev/smscufx: Detect registered fb_info from refcount
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:05 +0000 (13:07 +0200)]
fbdev/smscufx: Detect registered fb_info from refcount

Detect registered instances of fb_info by reading the reference
counter from struct fb_info.read. Avoids looking at the dev field
and prepares fbdev for making struct fb_info.dev optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Steve Glendinning <steve.glendinning@shawell.net>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-31-tzimmermann@suse.de
12 months agofbdev/sm501fb: Output message with fb_err()
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:04 +0000 (13:07 +0200)]
fbdev/sm501fb: Output message with fb_err()

Fix case were dev_err() is being called with struct fb_info.dev.
Use fb_err() instead.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-30-tzimmermann@suse.de
12 months agofbdev/sh7760fb: Use hardware device with dev_() output during probe
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:03 +0000 (13:07 +0200)]
fbdev/sh7760fb: Use hardware device with dev_() output during probe

Call output helpers in the probe function with the hardware device.
The virtual fbdev device has not been initialized at that point. Also
prepares fbdev for making struct fb_info.dev optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-29-tzimmermann@suse.de
12 months agofbdev/sh7760fb: Alloc DMA memory from hardware device
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:02 +0000 (13:07 +0200)]
fbdev/sh7760fb: Alloc DMA memory from hardware device

Pass the hardware device to the DMA helpers dma_alloc_coherent() and
dma_free_coherent(). The fbdev device that is currently being used is
a software device and does not provide DMA memory. Also update the
related dev_*() output statements similarly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-28-tzimmermann@suse.de
12 months agofbdev/sh7760fb: Output messages with fb_dbg()
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:01 +0000 (13:07 +0200)]
fbdev/sh7760fb: Output messages with fb_dbg()

Fix cases were output helpers are called with struct fb_info.dev.
Use fb_dbg() instead. Prepares fbdev for making struct fb_info.dev
optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-27-tzimmermann@suse.de
12 months agofbdev/sh7760fb: Use fb_dbg() in sh7760fb_get_color_info()
Thomas Zimmermann [Tue, 13 Jun 2023 11:07:00 +0000 (13:07 +0200)]
fbdev/sh7760fb: Use fb_dbg() in sh7760fb_get_color_info()

Give struct fb_info to sh7760fb_get_color_info() and use it in
call to fb_dbg(). Prepares fbdev for making struct fb_info.dev
optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-26-tzimmermann@suse.de
12 months agofbdev/rivafb: Use hardware device as backlight parent
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:59 +0000 (13:06 +0200)]
fbdev/rivafb: Use hardware device as backlight parent

Use the hardware device in struct fb_info.device as parent of the
backlight device. Aligns the driver with the rest of the codebase
and prepares fbdev for making struct fb_info.dev optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Antonino Daplas <adaplas@gmail.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-25-tzimmermann@suse.de
12 months agofbdev/rivafb: Reorder backlight and framebuffer init/cleanup
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:58 +0000 (13:06 +0200)]
fbdev/rivafb: Reorder backlight and framebuffer init/cleanup

The driver's backlight code requires the framebuffer to be
registered. Therefore reorder the init and cleanup calls for
both data structures.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Antonino Daplas <adaplas@gmail.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-24-tzimmermann@suse.de
12 months agofbdev/radeonfb: Use hardware device as backlight parent
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:57 +0000 (13:06 +0200)]
fbdev/radeonfb: Use hardware device as backlight parent

Use the hardware device in struct fb_info.device as parent of the
backlight device. Aligns the driver with the rest of the codebase
and prepares fbdev for making struct fb_info.dev optional.

v2:
* add Cc: tag (Dan)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-23-tzimmermann@suse.de
12 months agofbdev/radeonfb: Reorder backlight and framebuffer cleanup
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:56 +0000 (13:06 +0200)]
fbdev/radeonfb: Reorder backlight and framebuffer cleanup

The driver's backlight code requires the framebuffer to be
registered. Therefore reorder the cleanup calls for both data
structures. The init calls are already in the correct order.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-22-tzimmermann@suse.de
12 months agofbdev/pxa168fb: Do not assign to struct fb_info.dev
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:55 +0000 (13:06 +0200)]
fbdev/pxa168fb: Do not assign to struct fb_info.dev

Do not assign the hardware device to struct fb_info.dev. The
field references the fbdev software device, which is unrelated.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-21-tzimmermann@suse.de
12 months agofbdev/nvidiafb: Use hardware device as backlight parent
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:54 +0000 (13:06 +0200)]
fbdev/nvidiafb: Use hardware device as backlight parent

Use the hardware device in struct fb_info.device as parent of the
backlight device. Aligns the driver with the rest of the codebase
and prepares fbdev for making struct fb_info.dev optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Antonino Daplas <adaplas@gmail.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-20-tzimmermann@suse.de
12 months agofbdev/nvidiafb: Reorder backlight and framebuffer init/cleanup
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:53 +0000 (13:06 +0200)]
fbdev/nvidiafb: Reorder backlight and framebuffer init/cleanup

The driver's backlight code requires the framebuffer to be
registered. Therefore reorder the init and cleanup calls for
both data structures.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Antonino Daplas <adaplas@gmail.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-19-tzimmermann@suse.de
12 months agofbdev/metronomefb: Use hardware device for dev_err()
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:52 +0000 (13:06 +0200)]
fbdev/metronomefb: Use hardware device for dev_err()

Replace the use of the fbdev software device, stored in struct
fb_info.dev, with the hardware device from struct fb_info.device
in load_waveform(). The device is only used for printing errors
with dev_err().

This change aligns load_waveform() with the rest of the driver and
prepares fbdev for making struct fb_info.dev optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-18-tzimmermann@suse.de
12 months agofbdev/mb862xxfb: Output messages with fb_dbg()
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:51 +0000 (13:06 +0200)]
fbdev/mb862xxfb: Output messages with fb_dbg()

Fix cases were output helpers are called with struct fb_info.dev.
Use fb_dbg() instead. Prepares fbdev for making struct fb_info.dev
optional.

v2:
* fix another reference to struct fb_info.dev (kernel test reobot)
* remove fb_err() from commit message

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-17-tzimmermann@suse.de
12 months agofbdev/fsl-diu-fb: Output messages with fb_*() helpers
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:50 +0000 (13:06 +0200)]
fbdev/fsl-diu-fb: Output messages with fb_*() helpers

Fix cases were output helpers are called with struct fb_info.dev.
Use fb_*() helpers instead. Prepares fbdev for making struct
fb_info.dev optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Timur Tabi <timur@kernel.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-16-tzimmermann@suse.de
12 months agofbdev/ep93xx-fb: Do not assign to struct fb_info.dev
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:49 +0000 (13:06 +0200)]
fbdev/ep93xx-fb: Do not assign to struct fb_info.dev

Do not assing the Linux device to struct fb_info.dev. The call to
register_framebuffer() initializes the field to the fbdev device.
Drivers should not override its value.

Fixes a bug where the driver incorrectly decreases the hardware
device's reference counter and leaks the fbdev device.

v2:
* add Fixes tag (Dan)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 88017bda96a5 ("ep93xx video driver")
Cc: <stable@vger.kernel.org> # v2.6.32+
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-15-tzimmermann@suse.de
12 months agofbdev/ep93xx-fb: Output messages with fb_info() and fb_err()
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:48 +0000 (13:06 +0200)]
fbdev/ep93xx-fb: Output messages with fb_info() and fb_err()

Fix cases were output helpers are called with struct fb_info.dev.
Use fb_info() and fb_err() instead.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-14-tzimmermann@suse.de
12 months agofbdev/ep93xx-fb: Alloc DMA memory from hardware device
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:47 +0000 (13:06 +0200)]
fbdev/ep93xx-fb: Alloc DMA memory from hardware device

Pass the hardware device to the DMA helpers dma_alloc_wc(), dma_mmap_wc()
and dma_free_coherent(). The fbdev device that is currently being used is
a software device and does not provide DMA memory.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-13-tzimmermann@suse.de
12 months agofbdev/broadsheetfb: Call device_remove_file() with hardware device
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:46 +0000 (13:06 +0200)]
fbdev/broadsheetfb: Call device_remove_file() with hardware device

Call device_remove_file() with the same device that has been used
for device_create_file(), which is the hardware device stored in
struct fb_info.device. Prepares fbdev for making struct fb_info.dev
optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-12-tzimmermann@suse.de
12 months agofbdev/aty128fb: Use hardware device as backlight parent
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:45 +0000 (13:06 +0200)]
fbdev/aty128fb: Use hardware device as backlight parent

Use the hardware device in struct fb_info.device as parent of the
backlight device. Aligns the driver with the rest of the codebase
and prepares fbdev for making struct fb_info.dev optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-11-tzimmermann@suse.de
12 months agofbdev/aty128fb: Reorder backlight and framebuffer init/cleanup
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:44 +0000 (13:06 +0200)]
fbdev/aty128fb: Reorder backlight and framebuffer init/cleanup

The driver's backlight code requires the framebuffer to be
registered. Therefore reorder the init and cleanup calls for
both data structures.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-10-tzimmermann@suse.de
12 months agofbdev/atyfb: Use hardware device as backlight parent
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:43 +0000 (13:06 +0200)]
fbdev/atyfb: Use hardware device as backlight parent

Use the hardware device in struct fb_info.device as parent of the
backlight device. Aligns the driver with the rest of the codebase
and prepares fbdev for making struct fb_info.dev optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-9-tzimmermann@suse.de
12 months agofbdev/atyfb: Reorder backlight and framebuffer init/cleanup
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:42 +0000 (13:06 +0200)]
fbdev/atyfb: Reorder backlight and framebuffer init/cleanup

The driver's backlight code requires the framebuffer to be
registered. Therefore reorder the init and cleanup calls for
both data structures.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-8-tzimmermann@suse.de
12 months agobacklight/lv5207lp: Rename struct lv5207lp_platform_data.fbdev to 'dev'
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:41 +0000 (13:06 +0200)]
backlight/lv5207lp: Rename struct lv5207lp_platform_data.fbdev to 'dev'

Rename struct lv5207lp_platform_data.fbdev to 'dev', as it stores a
pointer to the Linux platform device; not the fbdev device. Makes
the code easier to understand.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: linux-sh@vger.kernel.org
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-7-tzimmermann@suse.de
12 months agobacklight/lv5207lp: Compare against struct fb_info.device
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:40 +0000 (13:06 +0200)]
backlight/lv5207lp: Compare against struct fb_info.device

Struct lv5207lp_platform_data refers to a platform device within
the Linux device hierarchy. The test in lv5207lp_backlight_check_fb()
compares it against the fbdev device in struct fb_info.dev, which
is different. Fix the test by comparing to struct fb_info.device.

Fixes a bug in the backlight driver and prepares fbdev for making
struct fb_info.dev optional.

v2:
* move renames into separate patch (Javier, Sam, Michael)

Fixes: 82e5c40d88f9 ("backlight: Add Sanyo LV5207LP backlight driver")
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: linux-sh@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v3.12+
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-6-tzimmermann@suse.de
12 months agobacklight/gpio_backlight: Rename field 'fbdev' to 'dev'
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:39 +0000 (13:06 +0200)]
backlight/gpio_backlight: Rename field 'fbdev' to 'dev'

Rename the field 'fbdev' in struct gpio_backlight_platform_data and
struct gpio_backlight to 'dev', as they store pointers to the Linux
platform device; not the fbdev device. Makes the code easier to
understand.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: linux-sh@vger.kernel.org
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-5-tzimmermann@suse.de
12 months agobacklight/gpio_backlight: Compare against struct fb_info.device
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:38 +0000 (13:06 +0200)]
backlight/gpio_backlight: Compare against struct fb_info.device

Struct gpio_backlight_platform_data refers to a platform device within
the Linux device hierarchy. The test in gpio_backlight_check_fb()
compares it against the fbdev device in struct fb_info.dev, which
is different. Fix the test by comparing to struct fb_info.device.

Fixes a bug in the backlight driver and prepares fbdev for making
struct fb_info.dev optional.

v2:
* move renames into separate patch (Javier, Sam, Michael)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 8b770e3c9824 ("backlight: Add GPIO-based backlight driver")
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: linux-sh@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v3.12+
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-4-tzimmermann@suse.de
12 months agobacklight/bd6107: Rename struct bd6107_platform_data.fbdev to 'dev'
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:37 +0000 (13:06 +0200)]
backlight/bd6107: Rename struct bd6107_platform_data.fbdev to 'dev'

Rename struct bd6107_platform_data.fbdev to 'dev', as it stores a
pointer to the Linux platform device; not the fbdev device. Makes
the code easier to understand.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jingoo Han <jingoohan1@gmail.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-3-tzimmermann@suse.de
12 months agobacklight/bd6107: Compare against struct fb_info.device
Thomas Zimmermann [Tue, 13 Jun 2023 11:06:36 +0000 (13:06 +0200)]
backlight/bd6107: Compare against struct fb_info.device

Struct bd6107_platform_data refers to a platform device within
the Linux device hierarchy. The test in bd6107_backlight_check_fb()
compares it against the fbdev device in struct fb_info.dev, which
is different. Fix the test by comparing to struct fb_info.device.

Fixes a bug in the backlight driver and prepares fbdev for making
struct fb_info.dev optional.

v2:
* move renames into separate patch (Javier, Sam, Michael)

Fixes: 67b43e590415 ("backlight: Add ROHM BD6107 backlight driver")
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Lee Jones <lee@kernel.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v3.12+
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-2-tzimmermann@suse.de
12 months agodrm/bridge: dw-hdmi: remove dead code and fix indentation
Adrián Larumbe [Sun, 25 Jun 2023 14:17:17 +0000 (15:17 +0100)]
drm/bridge: dw-hdmi: remove dead code and fix indentation

The hdmi_datamap enum is no longer in use. Also reindent enable_audio's
call params.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/ca42985814e9be33b7f8e3a33cea9e18505299e3.1687702042.git.adrian.larumbe@collabora.com
12 months agodrm/bridge: dw-hdmi: truly enforce 420-only formats when drm mode demands it
Adrián Larumbe [Sun, 25 Jun 2023 14:17:16 +0000 (15:17 +0100)]
drm/bridge: dw-hdmi: truly enforce 420-only formats when drm mode demands it

The current output bus format selection logic is enforcing YUV420 even
when the drm mode allows for other bus formats as well.
Fix it by adding check for 420-only drm modes.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/6e6a217c180584a67ed7992c785764ba54af9151.1687702042.git.adrian.larumbe@collabora.com
12 months agodrm/bridge: dw-hdmi: change YUV420 selection logic at clock setup
Adrián Larumbe [Sun, 25 Jun 2023 14:17:15 +0000 (15:17 +0100)]
drm/bridge: dw-hdmi: change YUV420 selection logic at clock setup

Right now clocking value selection code is prioritising RGB, YUV444 modes
over YUV420 for HDMI2 sinks. However, because of the bus format selection
procedure in dw-hdmi, for HDMI2 sinks YUV420 is the format that will always
be picked during the drm bridge chain check stage.

Later on dw_hdmi_setup will configure a colour space based on the bus
format that doesn't match the pixel value we had calculated as described
above.

Fix it by bringing back dw-hdmi bus format check when picking the right
pixel clock.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/6230bfae2cd97cf6527fc62ba5c850464919ccf8.1687702042.git.adrian.larumbe@collabora.com
12 months agodrm/prime: Unexport helpers for fd/handle conversion
Thomas Zimmermann [Tue, 20 Jun 2023 07:59:59 +0000 (09:59 +0200)]
drm/prime: Unexport helpers for fd/handle conversion

Unexport drm_gem_prime_fd_to_handle() and drm_gem_prime_handle_to_fd().
Both are only used internally within the PRIME code.

v2:
* reword docs as functions are now unexported (Simon)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Simon Ser <contact@emersion.fr>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230620080252.16368-4-tzimmermann@suse.de
12 months agodrm: Clear fd/handle callbacks in struct drm_driver
Thomas Zimmermann [Tue, 20 Jun 2023 07:59:58 +0000 (09:59 +0200)]
drm: Clear fd/handle callbacks in struct drm_driver

Clear all assignments of struct drm_driver's fd/handle callbacks to
drm_gem_prime_fd_to_handle() and drm_gem_prime_handle_to_fd(). These
functions are called by default. Add a TODO item to convert vmwgfx
to the defaults as well.

v2:
* remove TODO item (Zack)
* also update amdgpu's amdgpu_partition_driver

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Simon Ser <contact@emersion.fr>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Jeffrey Hugo <quic_jhugo@quicinc.com> # qaic
Link: https://patchwork.freedesktop.org/patch/msgid/20230620080252.16368-3-tzimmermann@suse.de
12 months agodrm: Enable PRIME import/export for all drivers
Thomas Zimmermann [Tue, 20 Jun 2023 07:59:57 +0000 (09:59 +0200)]
drm: Enable PRIME import/export for all drivers

Call drm_gem_prime_handle_to_fd() and drm_gem_prime_fd_to_handle() by
default if no PRIME import/export helpers have been set. Both functions
are the default for almost all drivers.

DRM drivers implement struct drm_driver.gem_prime_import_sg_table
to import dma-buf objects from other drivers. Having the function
drm_gem_prime_fd_to_handle() functions set by default allows each
driver to import dma-buf objects to itself, even without support for
other drivers.

For drm_gem_prime_handle_to_fd() it is similar: using it by default
allows each driver to export to itself, even without support for other
drivers.

This functionality enables userspace to share per-driver buffers
across process boundaries via PRIME (e.g., wlroots requires this
functionality). The patch generalizes a pattern that has previously
been implemented by GEM VRAM helpers [1] to work with any driver.
For example, gma500 can now run the wlroots-based sway compositor.

v2:
* clean up docs and TODO comments (Simon, Zack)
* clean up style in drm_getcap()

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://lore.kernel.org/dri-devel/20230302143502.500661-1-contact@emersion.fr/
Reviewed-by: Simon Ser <contact@emersion.fr>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230620080252.16368-2-tzimmermann@suse.de
12 months agodrm/mxsfb: Disable overlay plane in mxsfb_plane_overlay_atomic_disable()
Liu Ying [Mon, 12 Jun 2023 09:23:59 +0000 (17:23 +0800)]
drm/mxsfb: Disable overlay plane in mxsfb_plane_overlay_atomic_disable()

When disabling overlay plane in mxsfb_plane_overlay_atomic_update(),
overlay plane's framebuffer pointer is NULL.  So, dereferencing it would
cause a kernel Oops(NULL pointer dereferencing).  Fix the issue by
disabling overlay plane in mxsfb_plane_overlay_atomic_disable() instead.

Fixes: cb285a5348e7 ("drm: mxsfb: Replace mxsfb_get_fb_paddr() with drm_fb_cma_get_gem_addr()")
Cc: stable@vger.kernel.org # 5.19+
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Marek Vasut <marex@denx.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230612092359.784115-1-victor.liu@nxp.com
12 months agodrm/vkms: Isolate writeback pixel conversion functions
Maíra Canal [Tue, 9 May 2023 20:28:53 +0000 (17:28 -0300)]
drm/vkms: Isolate writeback pixel conversion functions

All convertions from the ARGB16161616 format follow the same structure.
Instead of repeting the same structure for each supported format, create
a function to encapsulate the common logic and isolate the pixel
conversion functions in a callback function.

Suggested-by: Melissa Wen <mwen@igalia.com>
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Arthur Grillo <arthurgrillo@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230515135204.115393-4-mcanal@igalia.com
12 months agodrm/vkms: Enable ARGB8888 support for writeback
Maíra Canal [Mon, 15 May 2023 13:52:04 +0000 (10:52 -0300)]
drm/vkms: Enable ARGB8888 support for writeback

The VKMS already has a function to convert ARGB16161616 to ARGB8888, so
it is possible to use this function to provide the writeback support for
the ARGB8888 format. Therefore, add the ARGB8888 format to the writeback
format list.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Arthur Grillo <arthurgrillo@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230515135204.115393-3-mcanal@igalia.com
12 months agodrm/vkms: Reduce critical section
Maíra Canal [Mon, 15 May 2023 13:52:03 +0000 (10:52 -0300)]
drm/vkms: Reduce critical section

The spinlock composer_lock protects the variables crc_pending,
wb_pending, frame_start and frame_end, which are variables that are used
by the composer worker. There is no need to protect the wb_frame_info
information with a spinlock. Therefore, reduce the critical section of
the lock by removing the assignments to the wb_frame_info from the
critical section.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Arthur Grillo <arthurgrillo@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230515135204.115393-2-mcanal@igalia.com
12 months agodrm/bridge: ps8640: Drop the ability of ps8640 to fetch the EDID
Douglas Anderson [Fri, 16 Jun 2023 23:55:17 +0000 (16:55 -0700)]
drm/bridge: ps8640: Drop the ability of ps8640 to fetch the EDID

In order to read the EDID from an eDP panel, you not only need to
power on the bridge chip itself but also the panel. In the ps8640
driver, this was made to work by having the bridge chip manually power
the panel on by calling pre_enable() on everything connectorward on
the bridge chain. This worked OK, but...

...when trying to do the same thing on ti-sn65dsi86, feedback was that
this wasn't a great idea. As a result, we designed the "DP AUX"
bus. With the design we ended up with the panel driver itself was in
charge of reading the EDID. The panel driver could power itself on and
the bridge chip was able to power itself on because it implemented the
DP AUX bus.

Despite the fact that we came up with a new scheme, implemented in on
ti-sn65dsi86, and even implemented it on parade-ps8640, we still kept
the old code around. This was because the new scheme required a DT
change. Previously the panel was a simple "platform_device" and in DT
at the top level. With the new design the panel needs to be listed in
DT under the DP controller node. The old code allowed us to properly
fetch EDIDs with ps8640 with the old DTs.

Unfortunately, the old code stopped working as of commit 102e80d1fa2c
("drm/bridge: ps8640: Use atomic variants of drm_bridge_funcs"). There
are cases at bootup where connector->state->state is NULL and the
kernel crashed at:
* drm_atomic_bridge_chain_pre_enable
* drm_atomic_get_old_bridge_state
* drm_atomic_get_old_private_obj_state

The crash went away at commit 4fb912e5e190 ("drm/bridge: Introduce
pre_enable_prev_first to alter bridge init order") which added a NULL
check. However, even though we were no longer crashing the end result
was that we weren't actually powering the panel on when we thought we
were. Things could end up working (despite warning splats) if
userspace was persistent and tried to get the mode again, but it
wasn't great.

A bit of digging was done to see if there was an easy fix but there
was nothing obvious. Instead, the only device using ps8640 the "old"
way had its DT updated so that the panel was no longer a simple
"platform_deice". See commit c2d94f72140a ("arm64: dts: mediatek:
mt8173-elm: Move display to ps8640 auxiliary bus") and commit
113b5cc06f44 ("arm64: dts: mediatek: mt8173-elm: remove panel model
number in DT").

Let's delete the old broken code so nobody gets tempted to copy it or
figure out how it works (since it doesn't).

NOTE: from a device tree "purist" point of view, we're supposed to
keep old device trees working and this patch is technically "against
policy". Reasons I'm still proposing it anyway:
1. Officially, old mt8173-elm device trees worked via the "little
   white lie" approach. The DT would list an arbitrary/representative
   panel that would be used for power sequencing. The mode information
   in the panel driver would then be ignored / overridden by the EDID
   reading code in ps8640. I don't feel too terrible breaking DTs that
   contained the wrong "compatible" string to begin with. NOTE that
   any old device trees that _didn't_ lie about their compatible will
   still work because the mode information will come from the
   hardcoded panels in panel-edp.
2. The only users of the old code were Chromebooks and Chromebooks
   don't bake their DTs into the BIOS (they are bundled with the
   kernel). Thus we don't need to worry about breaking someone using
   an old DT with a new kernel.
3. The old code was broken anyway. If someone wants to fix the old
   code instead of deleting it then they have my blessing, but without
   a proper fix the old code isn't useful.

Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230616165517.v2.1.I7b8f60b3fbfda068f9bf452d584dc934494bfbfa@changeid
12 months agodrm/kms: log when querying an object not included in lease
Simon Ser [Fri, 23 Jun 2023 14:35:18 +0000 (14:35 +0000)]
drm/kms: log when querying an object not included in lease

User-space may query an existing object not included in a lease.
Make it easier to debug such situations by logging a debug message.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20230623143514.38707-1-contact@emersion.fr
12 months agodrm/atomic: log errors in drm_mode_atomic_ioctl()
Simon Ser [Wed, 19 Oct 2022 14:38:22 +0000 (14:38 +0000)]
drm/atomic: log errors in drm_mode_atomic_ioctl()

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221019143736.267324-7-contact@emersion.fr
12 months agodrm/atomic: log when page-flip is requested without CRTCs
Simon Ser [Wed, 19 Oct 2022 14:38:16 +0000 (14:38 +0000)]
drm/atomic: log when page-flip is requested without CRTCs

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221019143736.267324-6-contact@emersion.fr
12 months agodrm/atomic: log on attempt to set legacy DPMS property
Simon Ser [Wed, 19 Oct 2022 14:38:10 +0000 (14:38 +0000)]
drm/atomic: log on attempt to set legacy DPMS property

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221019143736.267324-5-contact@emersion.fr
12 months agodrm/atomic: log when CRTC_ID prop value is invalid
Simon Ser [Wed, 19 Oct 2022 14:38:04 +0000 (14:38 +0000)]
drm/atomic: log when CRTC_ID prop value is invalid

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221019143736.267324-4-contact@emersion.fr
12 months agodrm/atomic: log when getting/setting unknown properties
Simon Ser [Wed, 19 Oct 2022 14:37:57 +0000 (14:37 +0000)]
drm/atomic: log when getting/setting unknown properties

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221019143736.267324-3-contact@emersion.fr
12 months agodrm/atomic: drop extra bracket from log messages
Simon Ser [Wed, 19 Oct 2022 14:37:51 +0000 (14:37 +0000)]
drm/atomic: drop extra bracket from log messages

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221019143736.267324-2-contact@emersion.fr
12 months agodrm/atomic: log drm_atomic_replace_property_blob_from_id() errors
Simon Ser [Wed, 19 Oct 2022 14:37:44 +0000 (14:37 +0000)]
drm/atomic: log drm_atomic_replace_property_blob_from_id() errors

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221019143736.267324-1-contact@emersion.fr
12 months agodrm/bridge_connector: use drm_kms_helper_connector_hotplug_event()
Simon Ser [Tue, 20 Jun 2023 17:55:09 +0000 (17:55 +0000)]
drm/bridge_connector: use drm_kms_helper_connector_hotplug_event()

This adds more information to the hotplug uevent and lets user-space
know that it's about a particular connector only.

Signed-off-by: Simon Ser <contact@emersion.fr>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230620175506.263109-1-contact@emersion.fr
12 months agodrm/sysfs: rename drm_sysfs_connector_status_event()
Simon Ser [Tue, 20 Jun 2023 17:42:42 +0000 (17:42 +0000)]
drm/sysfs: rename drm_sysfs_connector_status_event()

Rename drm_sysfs_connector_status_event() to
drm_sysfs_connector_property_event(). Indeed, "status" is a bit
vague: it can easily be confused with the connected/disconnected
status of the connector. This function has nothing to do with
connected/disconnected: it merely sends a notification that a
connector's property has changed (e.g. HDCP, privacy screen, etc).

Signed-off-by: Simon Ser <contact@emersion.fr>
Cc: Manasi Navare <navaremanasi@chromium.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230620174231.260335-1-contact@emersion.fr
12 months agodrm: fix code style for embedded structs in hdr_metadata_infoframe
Simon Ser [Fri, 28 Apr 2023 10:01:24 +0000 (10:01 +0000)]
drm: fix code style for embedded structs in hdr_metadata_infoframe

Only the stuff inside the brackets should be indented.

Signed-off-by: Simon Ser <contact@emersion.fr>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Sebastian Wick <sebastian.wick@redhat.com>
Cc: Joshua Ashton <joshua@froggi.es>
Cc: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230428100115.9802-1-contact@emersion.fr
12 months agodrm/mgag200: set variable mgag200_modeset storage-class-specifier to static
Tom Rix [Wed, 17 May 2023 13:41:40 +0000 (09:41 -0400)]
drm/mgag200: set variable mgag200_modeset storage-class-specifier to static

smatch reports
drivers/gpu/drm/mgag200/mgag200_drv.c:23:5: warning: symbol
  'mgag200_modeset' was not declared. Should it be static?

This variable is only used in its defining file, so it should be static

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230517134140.874179-1-trix@redhat.com
12 months agodrm: bridge: dw-mipi-dsi: Fix enable/disable of DSI controller
Ondrej Jirman [Sat, 17 Jun 2023 22:48:25 +0000 (00:48 +0200)]
drm: bridge: dw-mipi-dsi: Fix enable/disable of DSI controller

Before this patch, booting to Linux VT and doing a simple:

  echo 2 > /sys/class/graphics/fb0/blank
  echo 0 > /sys/class/graphics/fb0/blank

would result in failures to re-enable the panel. Mode set callback is
called only once during boot in this scenario, while calls to
enable/disable callbacks are balanced afterwards. The driver doesn't
work unless userspace calls modeset before enabling the CRTC/connector.

This patch moves enabling of the DSI host from mode_set into pre_enable
callback, and removes some old hacks where this bridge driver is
directly calling into other bridge driver's callbacks.

pre_enable_prev_first flag is set on the panel's bridge so that panel
drivers will get their prepare function called between DSI host's
pre_enable and enable callbacks, so that they get a chance to
perform panel setup while DSI host is already enabled in command
mode. Otherwise panel's prepare would be called before DSI host
is enabled, and any DSI communication used in prepare callback
would fail.

With all these changes, the enable/disable sequence is now well
balanced, and host's and panel's callbacks are called in proper order
documented in the drm_panel API documentation without needing the old
hacks. (Mainly that panel->prepare is called when DSI host is ready to
allow the panel driver to send DSI commands and vice versa during
disable.)

Tested on Pinephone Pro. Trace of the callbacks follows.

Before:

[    1.253882] dw-mipi-dsi-rockchip ff960000.dsi: mode_set
[    1.290732] panel-himax-hx8394 ff960000.dsi.0: prepare
[    1.475576] dw-mipi-dsi-rockchip ff960000.dsi: enable
[    1.475593] panel-himax-hx8394 ff960000.dsi.0: enable

echo 2 > /sys/class/graphics/fb0/blank

[   13.722799] panel-himax-hx8394 ff960000.dsi.0: disable
[   13.774502] dw-mipi-dsi-rockchip ff960000.dsi: post_disable
[   13.774526] panel-himax-hx8394 ff960000.dsi.0: unprepare

echo 0 > /sys/class/graphics/fb0/blank

[   17.735796] panel-himax-hx8394 ff960000.dsi.0: prepare
[   17.923522] dw-mipi-dsi-rockchip ff960000.dsi: enable
[   17.923540] panel-himax-hx8394 ff960000.dsi.0: enable
[   17.944330] dw-mipi-dsi-rockchip ff960000.dsi: failed to write command FIFO
[   17.944335] panel-himax-hx8394 ff960000.dsi.0: sending command 0xb9 failed: -110
[   17.944340] panel-himax-hx8394 ff960000.dsi.0: Panel init sequence failed: -110

echo 2 > /sys/class/graphics/fb0/blank

[  431.148583] panel-himax-hx8394 ff960000.dsi.0: disable
[  431.169259] dw-mipi-dsi-rockchip ff960000.dsi: failed to write command FIFO
[  431.169268] panel-himax-hx8394 ff960000.dsi.0: Failed to enter sleep mode: -110
[  431.169282] dw-mipi-dsi-rockchip ff960000.dsi: post_disable
[  431.169316] panel-himax-hx8394 ff960000.dsi.0: unprepare
[  431.169357] pclk_mipi_dsi0 already disabled

echo 0 > /sys/class/graphics/fb0/blank

[  432.796851] panel-himax-hx8394 ff960000.dsi.0: prepare
[  432.981537] dw-mipi-dsi-rockchip ff960000.dsi: enable
[  432.981568] panel-himax-hx8394 ff960000.dsi.0: enable
[  433.002290] dw-mipi-dsi-rockchip ff960000.dsi: failed to write command FIFO
[  433.002299] panel-himax-hx8394 ff960000.dsi.0: sending command 0xb9 failed: -110
[  433.002312] panel-himax-hx8394 ff960000.dsi.0: Panel init sequence failed: -110

-----------------------------------------------------------------------

After:

[    1.248372] dw-mipi-dsi-rockchip ff960000.dsi: mode_set
[    1.248704] dw-mipi-dsi-rockchip ff960000.dsi: pre_enable
[    1.285377] panel-himax-hx8394 ff960000.dsi.0: prepare
[    1.468392] dw-mipi-dsi-rockchip ff960000.dsi: enable
[    1.468421] panel-himax-hx8394 ff960000.dsi.0: enable

echo 2 > /sys/class/graphics/fb0/blank

[   16.210357] panel-himax-hx8394 ff960000.dsi.0: disable
[   16.261315] dw-mipi-dsi-rockchip ff960000.dsi: post_disable
[   16.261339] panel-himax-hx8394 ff960000.dsi.0: unprepare

echo 0 > /sys/class/graphics/fb0/blank

[   19.161453] dw-mipi-dsi-rockchip ff960000.dsi: pre_enable
[   19.197869] panel-himax-hx8394 ff960000.dsi.0: prepare
[   19.382141] dw-mipi-dsi-rockchip ff960000.dsi: enable
[   19.382158] panel-himax-hx8394 ff960000.dsi.0: enable

       (But depends on functionality intorduced in Linux 6.3, so this patch will
        not build on older kernels when applied to older stable branches.)

Fixes: 46fc51546d44 ("drm/bridge/synopsys: Add MIPI DSI host controller bridge")
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230617224915.1923630-1-megi@xff.cz
12 months agodrm/i2c: Switch i2c drivers back to use .probe()
Uwe Kleine-König [Sun, 11 Jun 2023 20:27:40 +0000 (22:27 +0200)]
drm/i2c: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
commit 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter")
convert back to (the new) .probe() to be able to eventually drop
.probe_new() from struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230611202740.826120-1-u.kleine-koenig@pengutronix.de
12 months agodrm/bridge: tc358762: Handle HS/VS polarity
Marek Vasut [Thu, 15 Jun 2023 20:19:02 +0000 (22:19 +0200)]
drm/bridge: tc358762: Handle HS/VS polarity

Add support for handling the HS/VS sync signals polarity in the bridge
driver, otherwise e.g. DSIM bridge feeds the TC358762 inverted polarity
sync signals and the image is shifted to the left, up, and wobbly.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230615201902.566182-5-marex@denx.de
12 months agodrm/bridge: tc358762: Guess the meaning of LCDCTRL bits
Marek Vasut [Thu, 15 Jun 2023 20:19:01 +0000 (22:19 +0200)]
drm/bridge: tc358762: Guess the meaning of LCDCTRL bits

The register content and behavior is very similar to TC358764 VP_CTRL.
All the bits except for unknown bit 6 also seem to match, even though
the datasheet is just not available. Add a comment and reuse the bit
definitions.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230615201902.566182-4-marex@denx.de
12 months agodrm/bridge: tc358762: Instruct DSI host to generate HSE packets
Marek Vasut [Thu, 15 Jun 2023 20:19:00 +0000 (22:19 +0200)]
drm/bridge: tc358762: Instruct DSI host to generate HSE packets

This bridge seems to need the HSE packet, otherwise the image is
shifted up and corrupted at the bottom. This makes the bridge
work with Samsung DSIM on i.MX8MM and i.MX8MP.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230615201902.566182-3-marex@denx.de
12 months agodrm/bridge: tc358762: Switch to atomic ops
Marek Vasut [Thu, 15 Jun 2023 20:18:59 +0000 (22:18 +0200)]
drm/bridge: tc358762: Switch to atomic ops

Switch the bridge driver over to atomic ops. No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230615201902.566182-2-marex@denx.de
12 months agodrm/bridge: tc358762: Split register programming from pre-enable to enable
Marek Vasut [Thu, 15 Jun 2023 20:18:58 +0000 (22:18 +0200)]
drm/bridge: tc358762: Split register programming from pre-enable to enable

Move the register programming part, which actually enables the bridge and
makes it push data out of its DPI side, into the enable callback. The DSI
host like DSIM may not be able to transmit commands in pre_enable, moving
the register programming into enable assures it can transmit commands.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230615201902.566182-1-marex@denx.de
12 months agodrm/bridge: tc358764: Use BIT() macro for actual bits
Marek Vasut [Thu, 15 Jun 2023 20:16:35 +0000 (22:16 +0200)]
drm/bridge: tc358764: Use BIT() macro for actual bits

None of these four bits are bitfields, use BIT() macro and treat
them as bits. No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230615201635.565973-1-marex@denx.de
12 months agodrm/shmem-helper: Switch to reservation lock
Dmitry Osipenko [Mon, 29 May 2023 22:39:35 +0000 (01:39 +0300)]
drm/shmem-helper: Switch to reservation lock

Replace all drm-shmem locks with a GEM reservation lock. This makes locks
consistent with dma-buf locking convention where importers are responsible
for holding reservation lock for all operations performed over dma-bufs,
preventing deadlock between dma-buf importers and exporters.

Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230529223935.2672495-7-dmitry.osipenko@collabora.com
12 months agodma-buf: Change locking policy for mmap()
Dmitry Osipenko [Mon, 29 May 2023 22:39:34 +0000 (01:39 +0300)]
dma-buf: Change locking policy for mmap()

Change locking policy of mmap() callback, making exporters responsible
for handling dma-buf reservation locking. Previous locking policy stated
that dma-buf is locked for both importers and exporters by the dma-buf
core, which caused a deadlock problem for DRM drivers in a case of
self-imported dma-bufs which required to take the lock from the DRM
exporter side.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230529223935.2672495-6-dmitry.osipenko@collabora.com
12 months agodrm: Don't assert held reservation lock for dma-buf mmapping
Dmitry Osipenko [Mon, 29 May 2023 22:39:33 +0000 (01:39 +0300)]
drm: Don't assert held reservation lock for dma-buf mmapping

Don't assert held dma-buf reservation lock on memory mapping of exported
buffer.

We're going to change dma-buf mmap() locking policy such that exporters
will have to handle the lock. The previous locking policy caused deadlock
problem for DRM drivers in a case of self-imported dma-bufs once these
drivers are moved to use reservation lock universally. The problem is
solved by moving the lock down to exporters. This patch prepares DRM
drivers for the locking policy update.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230529223935.2672495-2-dmitry.osipenko@collabora.com
Link: https://patchwork.freedesktop.org/patch/msgid/20230529223935.2672495-3-dmitry.osipenko@collabora.com
Link: https://patchwork.freedesktop.org/patch/msgid/20230529223935.2672495-4-dmitry.osipenko@collabora.com
Link: https://patchwork.freedesktop.org/patch/msgid/20230529223935.2672495-2-dmitry.osipenko@collabora.com
Link: https://patchwork.freedesktop.org/patch/msgid/20230529223935.2672495-3-dmitry.osipenko@collabora.com
Link: https://patchwork.freedesktop.org/patch/msgid/20230529223935.2672495-4-dmitry.osipenko@collabora.com