linux-2.6-microblaze.git
3 years agodrm: Remove unnecessary drm_panel_attach and drm_panel_detach
Joe Perches [Sun, 2 Aug 2020 16:43:59 +0000 (09:43 -0700)]
drm: Remove unnecessary drm_panel_attach and drm_panel_detach

These functions are now empty and no longer
useful so remove the functions and their uses.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Bernard Zhao <bernard@vivo.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>,
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Icenowy Zheng <icenowy@aosc.io>,
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: dri-devel@lists.freedesktop.org,
Cc: linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com
Signed-off-by: Sam Ravnborg <sam@ravnborg.org> # Fixed build and a few warnings
Link: https://patchwork.freedesktop.org/patch/msgid/9e13761020750b1ce2f1fabee23ef6e2a2942882.camel@perches.com
3 years agodrm/mgag200: fix build on alpha arch
Sam Ravnborg [Fri, 7 Aug 2020 18:05:47 +0000 (20:05 +0200)]
drm/mgag200: fix build on alpha arch

When building imgag200 for the alpha architecture it fails like this:
mgag200_drv.c:233:9: error: implicit declaration of function ‘vmalloc’
  233 |  bios = vmalloc(size);
      |         ^~~~~~~
      |         kmalloc

When building for other architectures vmalloc.h is pulled in via some
other header file - for example asm-generic/io.h.
Use an explicit include of vmalloc.h to fix the build.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Fixes: e20dfd27f7aa ("drm/mgag200: Add support for G200 desktop cards")
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Egbert Eich <eich@suse.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200807180547.GA923146@ravnborg.org
3 years agodrm/panfrost: perfcnt: fix ref count leak in panfrost_perfcnt_enable_locked
Navid Emamdoost [Sun, 14 Jun 2020 06:36:19 +0000 (01:36 -0500)]
drm/panfrost: perfcnt: fix ref count leak in panfrost_perfcnt_enable_locked

in panfrost_perfcnt_enable_locked, pm_runtime_get_sync is called which
increments the counter even in case of failure, leading to incorrect
ref count. In case of failure, decrement the ref count before returning.

Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200614063619.44944-1-navid.emamdoost@gmail.com
3 years agodrm/panfrost: add regulators to devfreq
Clément Péron [Fri, 10 Jul 2020 09:54:05 +0000 (11:54 +0200)]
drm/panfrost: add regulators to devfreq

Some OPP tables specify voltage for each frequency. Devfreq can
handle these regulators but they should be get only 1 time to avoid
issue and know who is in charge.

If OPP table is probe don't init regulator.

Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Clément Péron <peron.clem@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-11-peron.clem@gmail.com
3 years agodrm/panfrost: dynamically alloc regulators
Clément Péron [Fri, 10 Jul 2020 09:54:04 +0000 (11:54 +0200)]
drm/panfrost: dynamically alloc regulators

We will later introduce regulators managed by OPP.

Only alloc regulators when it's needed. This also help use
to release the regulators only when they are allocated.

Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Clément Péron <peron.clem@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-10-peron.clem@gmail.com
3 years agodrm/panfrost: move devfreq_init()/fini() in device
Clément Péron [Fri, 10 Jul 2020 09:54:03 +0000 (11:54 +0200)]
drm/panfrost: move devfreq_init()/fini() in device

Later we will introduce devfreq probing regulator if they
are present. As regulator should be probe only one time we
need to get this logic in the device_init().

panfrost_device is already taking care of devfreq_resume()
and devfreq_suspend(), so it's not totally illogic to move
the devfreq_init() and devfreq_fini() here.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Clément Péron <peron.clem@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-9-peron.clem@gmail.com
3 years agodrm/panfrost: rename error labels in device_init
Clément Péron [Fri, 10 Jul 2020 09:54:02 +0000 (11:54 +0200)]
drm/panfrost: rename error labels in device_init

Rename goto labels in device_init it will be easier to maintain.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Clément Péron <peron.clem@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-8-peron.clem@gmail.com
3 years agodrm/panfrost: properly handle error in probe
Clément Péron [Fri, 10 Jul 2020 09:54:01 +0000 (11:54 +0200)]
drm/panfrost: properly handle error in probe

Introduce a boolean to know if opp table has been added.

With this, we can call panfrost_devfreq_fini() in case of error
and release what has been initialised.

Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Clément Péron <peron.clem@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-7-peron.clem@gmail.com
3 years agodrm/panfrost: use spinlock instead of atomic
Clément Péron [Fri, 10 Jul 2020 09:54:00 +0000 (11:54 +0200)]
drm/panfrost: use spinlock instead of atomic

Convert busy_count to a simple int protected by spinlock.

Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Clément Péron <peron.clem@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-6-peron.clem@gmail.com
3 years agodrm/panfrost: introduce panfrost_devfreq struct
Clément Péron [Fri, 10 Jul 2020 09:53:59 +0000 (11:53 +0200)]
drm/panfrost: introduce panfrost_devfreq struct

Introduce a proper panfrost_devfreq to deal with devfreq variables.

Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Clément Péron <peron.clem@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-5-peron.clem@gmail.com
3 years agodrm/panfrost: don't use pfdevfreq.busy_count to know if hw is idle
Clément Péron [Fri, 10 Jul 2020 09:53:58 +0000 (11:53 +0200)]
drm/panfrost: don't use pfdevfreq.busy_count to know if hw is idle

This use devfreq variable that will be lock with spinlock in future
patches. We should either introduce a function to access this one
but as devfreq is optional let's just remove it.

Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Clément Péron <peron.clem@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-4-peron.clem@gmail.com
3 years agodrm/panfrost: clean headers in devfreq
Clément Péron [Fri, 10 Jul 2020 09:53:57 +0000 (11:53 +0200)]
drm/panfrost: clean headers in devfreq

Don't include not required headers and sort them.

Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Clément Péron <peron.clem@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-3-peron.clem@gmail.com
3 years agodrm/panfrost: avoid static declaration
Clément Péron [Fri, 10 Jul 2020 09:53:56 +0000 (11:53 +0200)]
drm/panfrost: avoid static declaration

This declaration can be avoided so change it.

Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Clément Péron <peron.clem@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-2-peron.clem@gmail.com
3 years agodrm/panfrost: Add compatible string for bifrost
Tomeu Vizoso [Thu, 11 Jun 2020 08:58:44 +0000 (10:58 +0200)]
drm/panfrost: Add compatible string for bifrost

Mesa now supports some Bifrost devices, so enable it.

Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200611085900.49740-2-tomeu.vizoso@collabora.com
3 years agodrm/panfrost: Make sure GPU is powered on when reading GPU_LATEST_FLUSH_ID
Tomeu Vizoso [Thu, 11 Jun 2020 08:58:43 +0000 (10:58 +0200)]
drm/panfrost: Make sure GPU is powered on when reading GPU_LATEST_FLUSH_ID

Bifrost devices do support the flush reduction feature, so on first job
submit we were trying to read the register while still powered off.

If the GPU is powered off, the feature doesn't bring any benefit, so
don't try to read.

Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200611085900.49740-1-tomeu.vizoso@collabora.com
3 years agodrm/amdgpu: make sure userptr ttm is allocated
Christian König [Thu, 6 Aug 2020 12:44:07 +0000 (14:44 +0200)]
drm/amdgpu: make sure userptr ttm is allocated

We need to allocate that manually now.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Tested-by: Michel Dänzer <mdaenzer@redhat.com>
Link: https://patchwork.freedesktop.org/patch/384330/
3 years agodrm/ttm: rename ttm_mem_reg to ttm_resource.
Dave Airlie [Tue, 4 Aug 2020 02:56:32 +0000 (12:56 +1000)]
drm/ttm: rename ttm_mem_reg to ttm_resource.

This name better reflects what the object does. I didn't rename
all the pointers it seemed too messy.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-60-airlied@gmail.com
3 years agodrm/ttm: rename ttm_mem_type_manager -> ttm_resource_manager.
Dave Airlie [Tue, 4 Aug 2020 02:56:31 +0000 (12:56 +1000)]
drm/ttm: rename ttm_mem_type_manager -> ttm_resource_manager.

This name makes a lot more sense, since these are about managing
driver resources rather than just memory ranges.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-59-airlied@gmail.com
3 years agodrm/ttm: rename bo manager to range manager.
Dave Airlie [Tue, 4 Aug 2020 02:56:30 +0000 (12:56 +1000)]
drm/ttm: rename bo manager to range manager.

The generic manager is called the range manager now, rename
the file and some internals.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-58-airlied@gmail.com
3 years agodrm/ttm: add a wrapper for checking if manager is in use
Dave Airlie [Tue, 4 Aug 2020 02:56:29 +0000 (12:56 +1000)]
drm/ttm: add a wrapper for checking if manager is in use

This converts vmwgfx over to using an interface to set the
in use and check the in use flag.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-57-airlied@gmail.com
3 years agodrm/ttm: drop type manager has_type
Dave Airlie [Tue, 4 Aug 2020 02:56:28 +0000 (12:56 +1000)]
drm/ttm: drop type manager has_type

under driver control, this flag isn't needed anymore,
remove the API that used to access it, and consoldiate
with the used api.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-56-airlied@gmail.com
3 years agodrm/ttm: drop list of memory managers from device. (v2)
Dave Airlie [Tue, 4 Aug 2020 02:56:27 +0000 (12:56 +1000)]
drm/ttm: drop list of memory managers from device. (v2)

The driver now controls these, the core just controls the system
memory one.

v2: init sysman explicitly and assign it as a driver manager
to simplify the lookup sequence.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-55-airlied@gmail.com
3 years agodrm/ttm: drop man->bdev link.
Dave Airlie [Tue, 4 Aug 2020 02:56:26 +0000 (12:56 +1000)]
drm/ttm: drop man->bdev link.

This link isn't needed anymore, drop it from the init interface.

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-54-airlied@gmail.com
3 years agodrm/amdgpu/ttm: remove man->bdev references.
Dave Airlie [Tue, 4 Aug 2020 02:56:25 +0000 (12:56 +1000)]
drm/amdgpu/ttm: remove man->bdev references.

Just store the device in the private so the link
can be removed from the manager

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-53-airlied@gmail.com
3 years agodrm/ttm: drop priv pointer in memory manager
Dave Airlie [Tue, 4 Aug 2020 02:56:24 +0000 (12:56 +1000)]
drm/ttm: drop priv pointer in memory manager

This isn't needed anymore by any drivers.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-52-airlied@gmail.com
3 years agodrm/nouveau/ttm: move to driver allocated manager
Dave Airlie [Tue, 4 Aug 2020 02:56:23 +0000 (12:56 +1000)]
drm/nouveau/ttm: move to driver allocated manager

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-51-airlied@gmail.com
3 years agodrm/vmwgfx/gmrid: convert to driver controlled allocation.
Dave Airlie [Tue, 4 Aug 2020 02:56:22 +0000 (12:56 +1000)]
drm/vmwgfx/gmrid: convert to driver controlled allocation.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-50-airlied@gmail.com
3 years agodrm/vmwgfx/ttm: move thp to driver managed
Dave Airlie [Tue, 4 Aug 2020 02:56:21 +0000 (12:56 +1000)]
drm/vmwgfx/ttm: move thp to driver managed

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-49-airlied@gmail.com
3 years agodrm/ttm: move range manager to subclassed driver allocation
Dave Airlie [Tue, 4 Aug 2020 02:56:20 +0000 (12:56 +1000)]
drm/ttm: move range manager to subclassed driver allocation

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-48-airlied@gmail.com
3 years agodrm/ttm: make ttm_range_man_init/takedown take type + args
Dave Airlie [Tue, 4 Aug 2020 02:56:19 +0000 (12:56 +1000)]
drm/ttm: make ttm_range_man_init/takedown take type + args

This makes it easier to move these to a driver allocated system

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-47-airlied@gmail.com
3 years agodrm/amdgpu/ttm: use bo manager subclassing for vram/gtt mgrs
Dave Airlie [Tue, 4 Aug 2020 02:56:18 +0000 (12:56 +1000)]
drm/amdgpu/ttm: use bo manager subclassing for vram/gtt mgrs

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-46-airlied@gmail.com
3 years agodrm/ttm: allow drivers to provide their own manager subclasses
Dave Airlie [Tue, 4 Aug 2020 02:56:17 +0000 (12:56 +1000)]
drm/ttm: allow drivers to provide their own manager subclasses

This will get removed eventually and all drivers will use this.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-45-airlied@gmail.com
3 years agodrm/ttm: rename manager variable to make sure wrapper is used.
Dave Airlie [Tue, 4 Aug 2020 02:56:16 +0000 (12:56 +1000)]
drm/ttm: rename manager variable to make sure wrapper is used.

Other users of this should notice this change and switch to wrapper.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-44-airlied@gmail.com
3 years agodrm/vmwgfx/ttm: use wrapper to access memory manager
Dave Airlie [Tue, 4 Aug 2020 02:56:15 +0000 (12:56 +1000)]
drm/vmwgfx/ttm: use wrapper to access memory manager

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-43-airlied@gmail.com
3 years agodrm/radeon/ttm: use wrapper to access memory manager
Dave Airlie [Tue, 4 Aug 2020 02:56:14 +0000 (12:56 +1000)]
drm/radeon/ttm: use wrapper to access memory manager

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-42-airlied@gmail.com
3 years agodrm/qxl/ttm: use wrapper to access memory manager
Dave Airlie [Tue, 4 Aug 2020 02:56:13 +0000 (12:56 +1000)]
drm/qxl/ttm: use wrapper to access memory manager

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-41-airlied@gmail.com
3 years agodrm/nouveau/ttm: use wrapper to access memory managers
Dave Airlie [Tue, 4 Aug 2020 02:56:12 +0000 (12:56 +1000)]
drm/nouveau/ttm: use wrapper to access memory managers

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-40-airlied@gmail.com
3 years agodrm/vram-helper: use wrapper to access memory managers
Dave Airlie [Tue, 4 Aug 2020 02:56:11 +0000 (12:56 +1000)]
drm/vram-helper: use wrapper to access memory managers

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-39-airlied@gmail.com
3 years agodrm/amdgfx/ttm: use wrapper to get ttm memory managers
Dave Airlie [Tue, 4 Aug 2020 02:56:10 +0000 (12:56 +1000)]
drm/amdgfx/ttm: use wrapper to get ttm memory managers

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-38-airlied@gmail.com
3 years agodrm/ttm: add wrapper to get manager from bdev.
Dave Airlie [Tue, 4 Aug 2020 02:56:09 +0000 (12:56 +1000)]
drm/ttm: add wrapper to get manager from bdev.

This will allow different abstractions later.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-37-airlied@gmail.com
3 years agodrm/ttm: make TTM responsible for cleaning system only.
Dave Airlie [Tue, 4 Aug 2020 02:56:08 +0000 (12:56 +1000)]
drm/ttm: make TTM responsible for cleaning system only.

Drivers should all be cleaning up their memory managers
themselves now, so let the core just clean the system one up.

Remove the legacy cleaning interface.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-36-airlied@gmail.com
3 years agodrm/ttm: remove range manager legacy takedown path
Dave Airlie [Tue, 4 Aug 2020 02:56:07 +0000 (12:56 +1000)]
drm/ttm: remove range manager legacy takedown path

Now all drivers have been converted, drop the non-driver path.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-35-airlied@gmail.com
3 years agodrm/vmwgfx: fix gmrid takedown paths to new interface
Dave Airlie [Tue, 4 Aug 2020 02:56:06 +0000 (12:56 +1000)]
drm/vmwgfx: fix gmrid takedown paths to new interface

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-34-airlied@gmail.com
3 years agodrm/qxl/ttm: use new takedown path
Dave Airlie [Tue, 4 Aug 2020 02:56:05 +0000 (12:56 +1000)]
drm/qxl/ttm: use new takedown path

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-33-airlied@gmail.com
3 years agodrm/radeon/ttm: use new takedown paths
Dave Airlie [Tue, 4 Aug 2020 02:56:04 +0000 (12:56 +1000)]
drm/radeon/ttm: use new takedown paths

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-32-airlied@gmail.com
3 years agodrm/nouveau: use new cleanup paths
Dave Airlie [Tue, 4 Aug 2020 02:56:03 +0000 (12:56 +1000)]
drm/nouveau: use new cleanup paths

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-31-airlied@gmail.com
3 years agodrm/vram_helper: call explicit mm takedown
Dave Airlie [Tue, 4 Aug 2020 02:56:02 +0000 (12:56 +1000)]
drm/vram_helper: call explicit mm takedown

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-30-airlied@gmail.com
3 years agodrm/vmwgfx: takedown vram manager
Dave Airlie [Tue, 4 Aug 2020 02:56:01 +0000 (12:56 +1000)]
drm/vmwgfx: takedown vram manager

Don't bother returning EBUSY, nobody cares enough,
if the driver has a problem, it should deal with it.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-29-airlied@gmail.com
3 years agodrm/amdgpu/ttm: use new takedown path
Dave Airlie [Tue, 4 Aug 2020 02:56:00 +0000 (12:56 +1000)]
drm/amdgpu/ttm: use new takedown path

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-28-airlied@gmail.com
3 years agodrm/ttm: start allowing drivers to use new takedown path (v2)
Dave Airlie [Tue, 4 Aug 2020 02:55:59 +0000 (12:55 +1000)]
drm/ttm: start allowing drivers to use new takedown path (v2)

Allow the takedown path callback to be optional as well.

v2: use fini for range manager

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-27-airlied@gmail.com
3 years agodrm/ttm: make some inline helper functions for cleanup paths. (v2)
Dave Airlie [Tue, 4 Aug 2020 02:55:58 +0000 (12:55 +1000)]
drm/ttm: make some inline helper functions for cleanup paths. (v2)

The disable path is just temporary for now, it will be dropped once has_type
is gone in a later patch.

v2: add docs.
rename to ttm_mem_type_manager namespace

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-26-airlied@gmail.com
3 years agodrm/ttm: pass man around instead of mem_type in some places
Dave Airlie [Tue, 4 Aug 2020 02:55:57 +0000 (12:55 +1000)]
drm/ttm: pass man around instead of mem_type in some places

This makes it easier to cleanup things

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-25-airlied@gmail.com
3 years agodrm/ttm: purge old manager init path.
Dave Airlie [Tue, 4 Aug 2020 02:55:56 +0000 (12:55 +1000)]
drm/ttm: purge old manager init path.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-24-airlied@gmail.com
3 years agodrm/ttm: convert system manager init to new code.
Dave Airlie [Tue, 4 Aug 2020 02:55:55 +0000 (12:55 +1000)]
drm/ttm: convert system manager init to new code.

Remove the exit path, since this can't fail now.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-23-airlied@gmail.com
3 years agodrm/vmwgfx/ttm: switch gmrid allocator to new init paths.
Dave Airlie [Tue, 4 Aug 2020 02:55:54 +0000 (12:55 +1000)]
drm/vmwgfx/ttm: switch gmrid allocator to new init paths.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-22-airlied@gmail.com
3 years agodrm/vmwgfx/ttm: convert vram mm init to new code paths
Dave Airlie [Tue, 4 Aug 2020 02:55:53 +0000 (12:55 +1000)]
drm/vmwgfx/ttm: convert vram mm init to new code paths

Split out the vram thp init path vs the range manager init.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-21-airlied@gmail.com
3 years agodrm/nouveau: use new memory manager init paths
Dave Airlie [Tue, 4 Aug 2020 02:55:52 +0000 (12:55 +1000)]
drm/nouveau: use new memory manager init paths

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-20-airlied@gmail.com
3 years agodrm/vram_helper: use new ttm manager init function
Dave Airlie [Tue, 4 Aug 2020 02:55:51 +0000 (12:55 +1000)]
drm/vram_helper: use new ttm manager init function

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-19-airlied@gmail.com
3 years agodrm/qxl/ttm: use new init path for manager
Dave Airlie [Tue, 4 Aug 2020 02:55:50 +0000 (12:55 +1000)]
drm/qxl/ttm: use new init path for manager

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-18-airlied@gmail.com
3 years agodrm/radeon: use new ttm man init path
Dave Airlie [Tue, 4 Aug 2020 02:55:49 +0000 (12:55 +1000)]
drm/radeon: use new ttm man init path

Use the new common manager init path.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-17-airlied@gmail.com
3 years agodrm/amdgpu/ttm: init managers from the driver side.
Dave Airlie [Tue, 4 Aug 2020 02:55:48 +0000 (12:55 +1000)]
drm/amdgpu/ttm: init managers from the driver side.

Use new init calls to unwrap manager init

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-16-airlied@gmail.com
3 years agodrm/ttm: provide a driver-led init path for range mm manager. (v2)
Dave Airlie [Tue, 4 Aug 2020 02:55:47 +0000 (12:55 +1000)]
drm/ttm: provide a driver-led init path for range mm manager. (v2)

This lets the generic range mm manager be initialised by the driver.

v2: add docs.
rename api to range_man_init for now.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-15-airlied@gmail.com
3 years agodrm/ttm: split the mm manager init code (v2)
Dave Airlie [Tue, 4 Aug 2020 02:55:46 +0000 (12:55 +1000)]
drm/ttm: split the mm manager init code (v2)

This will allow the driver to control the ordering here better.

Eventually the old path will be removed.

v2: add docs for new APIs.
rename new path to ttm_mem_type_manager_init/set_used(for now)

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-14-airlied@gmail.com
3 years agodrm/vram-helper: call the ttm manager debug function
Dave Airlie [Tue, 4 Aug 2020 02:55:45 +0000 (12:55 +1000)]
drm/vram-helper: call the ttm manager debug function

This code was assuming there was a drm_mm here, don't do
that call the correct API.

v2: use the new exported interface.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-13-airlied@gmail.com
3 years agodrm/qxl/ttm: call ttm manager debug (v2)
Dave Airlie [Tue, 4 Aug 2020 02:55:44 +0000 (12:55 +1000)]
drm/qxl/ttm: call ttm manager debug (v2)

v2: use the new exported interface.
This code was poking inside a struct and assuming it was a drm_mm
at the start. Call the proper API.

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-12-airlied@gmail.com
3 years agodrm/vmwgfx/gmrid: don't provide pointless ttm debug callback
Dave Airlie [Tue, 4 Aug 2020 02:55:43 +0000 (12:55 +1000)]
drm/vmwgfx/gmrid: don't provide pointless ttm debug callback

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-11-airlied@gmail.com
3 years agodrm/nouveau/ttm: don't fill in blank ttm debug callback
Dave Airlie [Tue, 4 Aug 2020 02:55:42 +0000 (12:55 +1000)]
drm/nouveau/ttm: don't fill in blank ttm debug callback

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-10-airlied@gmail.com
3 years agodrm/ttm: export memory type debug entrypoint.
Dave Airlie [Tue, 4 Aug 2020 02:55:41 +0000 (12:55 +1000)]
drm/ttm: export memory type debug entrypoint.

As suggested on review, just export the memory type debug for
drivers to use, while also making the debug callback optional
(don't need to test for system as it won't init it).

rename it to be more consistent with object name for now.
(we may rename all the objects later.)

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-9-airlied@gmail.com
3 years agodrm/vram-helper: remove populate/unpopulate
Dave Airlie [Tue, 4 Aug 2020 02:55:40 +0000 (12:55 +1000)]
drm/vram-helper: remove populate/unpopulate

The default path for populate/unpopulate is already this.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-8-airlied@gmail.com
3 years agodrm/ttm: use a helper for unlocked moves to the lru tail
Dave Airlie [Tue, 4 Aug 2020 02:55:39 +0000 (12:55 +1000)]
drm/ttm: use a helper for unlocked moves to the lru tail

The pattern was repeated a few times, just make an inline for it.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-7-airlied@gmail.com
3 years agodrm/ttm/amdgpu: consolidate ttm reserve paths
Dave Airlie [Tue, 4 Aug 2020 02:55:38 +0000 (12:55 +1000)]
drm/ttm/amdgpu: consolidate ttm reserve paths

Drop the WARN_ON and consolidate the two paths into one.

Use the consolidate slowpath in the execbuf utils code.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-6-airlied@gmail.com
3 years agoqxl/ttm: drop the unusued no wait flag to reserve function
Dave Airlie [Tue, 4 Aug 2020 02:55:37 +0000 (12:55 +1000)]
qxl/ttm: drop the unusued no wait flag to reserve function

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-5-airlied@gmail.com
3 years agonouveau: use ttm populate mapping functions. (v2)
Dave Airlie [Tue, 4 Aug 2020 02:55:36 +0000 (12:55 +1000)]
nouveau: use ttm populate mapping functions. (v2)

Instead of rolling driver copies of them.

v2: cleanup return handling (Ben)

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-4-airlied@gmail.com
3 years agodrm/vmwgfx: drop bo map/unmap dma functions.
Dave Airlie [Tue, 4 Aug 2020 02:55:35 +0000 (12:55 +1000)]
drm/vmwgfx: drop bo map/unmap dma functions.

The map one was used once, just inline it, and drop them both.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-3-airlied@gmail.com
3 years agodrm/vmwgfx: consolidate ttm object creation and populate
Dave Airlie [Tue, 4 Aug 2020 02:55:34 +0000 (12:55 +1000)]
drm/vmwgfx: consolidate ttm object creation and populate

These two functions has the same code in them, create a common
helper function instead.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-2-airlied@gmail.com
3 years agovideo: fbdev: pvr2fb: initialize variables
Tom Rix [Mon, 20 Jul 2020 19:18:45 +0000 (12:18 -0700)]
video: fbdev: pvr2fb: initialize variables

clang static analysis reports this repesentative error

pvr2fb.c:1049:2: warning: 1st function call argument
  is an uninitialized value [core.CallAndMessage]
        if (*cable_arg)
        ^~~~~~~~~~~~~~~

Problem is that cable_arg depends on the input loop to
set the cable_arg[0].  If it does not, then some random
value from the stack is used.

A similar problem exists for output_arg.

So initialize cable_arg and output_arg.

Signed-off-by: Tom Rix <trix@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200720191845.20115-1-trix@redhat.com
3 years agodrm/mgag200: Set PCI option register in G200SE models
Thomas Zimmermann [Tue, 4 Aug 2020 06:51:58 +0000 (08:51 +0200)]
drm/mgag200: Set PCI option register in G200SE models

The initial value of the PCI option register got lost while refactoring
the driver init code. Restore the setting.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reported-by: kernel test robot <lkp@intel.com>
Fixes: 2021708e0d6e ("drm/mgag200: Initialize PCI registers early during device setup")
Cc: Lyude Paul <lyude@redhat.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804065158.21049-1-tzimmermann@suse.de
3 years agofbdev: Use fallthrough pseudo-keyword
Gustavo A. R. Silva [Tue, 7 Jul 2020 21:05:39 +0000 (16:05 -0500)]
fbdev: 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: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200707210539.GA12530@embeddedor
3 years agoomapfb/dss: Include the right header
Linus Walleij [Mon, 6 Jul 2020 12:59:31 +0000 (14:59 +0200)]
omapfb/dss: Include the right header

The hdmi4.c and hdmi5.c files include the legacy GPIO
header <linux/gpio.h> but does not use any of the symbols
from this file.

What it does use is the implicit inclusion of <linux/of.h>
leading to compile errors if we just drop this include.

Include the right header.

Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200706125931.752539-1-linus.walleij@linaro.org
3 years agofbdev: Remove trailing whitespace
Thomas Zimmermann [Wed, 29 Jul 2020 13:41:44 +0000 (15:41 +0200)]
fbdev: Remove trailing whitespace

Removes trailing whitespaces in several places.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200729134148.6855-2-tzimmermann@suse.de
3 years agodrm/mgag200: Add support for G200 desktop cards
Thomas Zimmermann [Thu, 30 Jul 2020 10:28:44 +0000 (12:28 +0200)]
drm/mgag200: Add support for G200 desktop cards

This patch adds support for G200 desktop cards. We can reuse the whole
memory and modesetting code. A few PCI and DAC register values have to
be updated accordingly.

The most significant change is in the PLL setup. The driver parses the
device's BIOS to retrieve clock limits and reference clocks. With no BIOS
found, safe defaults are being used.

v2:
* copy BIOS ROM to system memory and access with regular
  load/store; resolves potential HW limitations
* fix some stray whitespaces

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Co-developed-by: Egbert Eich <eich@suse.com>
Signed-off-by: Egbert Eich <eich@suse.com>
Co-developed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730102844.10995-9-tzimmermann@suse.de
3 years agodrm/mgag200: Move G200SE's unique id into model-specific data
Thomas Zimmermann [Thu, 30 Jul 2020 10:28:43 +0000 (12:28 +0200)]
drm/mgag200: Move G200SE's unique id into model-specific data

The unique revision id is only useful for G200SE devices. Store the
value in model-specific data within struct mga_device. While at it,
the patch also adds an init helper for the value.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730102844.10995-8-tzimmermann@suse.de
3 years agodrm/mgag200: Clear <page> field during MM init
Thomas Zimmermann [Thu, 30 Jul 2020 10:28:42 +0000 (12:28 +0200)]
drm/mgag200: Clear <page> field during MM init

The modesetting code initialized the memory-related register CRTCEXT4.
Move this code to MM initialization.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730102844.10995-7-tzimmermann@suse.de
3 years agodrm/mgag200: Set MISC memory flags in mm init code
Thomas Zimmermann [Thu, 30 Jul 2020 10:28:41 +0000 (12:28 +0200)]
drm/mgag200: Set MISC memory flags in mm init code

The modesetting code initialized several memory-related flags in the
MISC register. Move this code to MM initialization.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730102844.10995-6-tzimmermann@suse.de
3 years agodrm/mgag200: Enable MGA mode during device register initialization
Thomas Zimmermann [Thu, 30 Jul 2020 10:28:40 +0000 (12:28 +0200)]
drm/mgag200: Enable MGA mode during device register initialization

MGA cards can run in traditional VGA mode or an enhanced MGA mode; with
the latter being required for KMS. So far, MGA mode was enabled during
modesetting. As it's fundamental for device operation, the patch moves
it next to the device register setup.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730102844.10995-5-tzimmermann@suse.de
3 years agodrm/mgag200: Initialize PCI registers early during device setup
Thomas Zimmermann [Thu, 30 Jul 2020 10:28:39 +0000 (12:28 +0200)]
drm/mgag200: Initialize PCI registers early during device setup

So far, PCI option registers were initialized as part of modesetting,
which is late in the process. As these registers control fundamental
operation, they should be set early.

The patch moves the PCI option handling into device register setup,
before even the device MMIO memory is being mapped. No functional
changes made.

Moving the PCI code next to the device-register setup also allows to
remove the has_sdram field from struct mga_device. The state is now
local to the init helper.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730102844.10995-4-tzimmermann@suse.de
3 years agodrm/mgag200: Move register initialization into helper function
Thomas Zimmermann [Thu, 30 Jul 2020 10:28:38 +0000 (12:28 +0200)]
drm/mgag200: Move register initialization into helper function

The mgag200 driver maps registers into the address space. Move the
code into a separate helper function. No functional changes.

One small difference is in the handling of SDRAM/SGRAM. MGA devices
can come with either SDRAM or SGRAM. So far, the driver checked for
SDRAM, which is the common case. The patch moves this code into a
separate helper and checks for SGRAM, which is the special case. The
test itself is the same as before.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730102844.10995-3-tzimmermann@suse.de
3 years agodrm/mgag200: Enable caching for SHMEM pages
Thomas Zimmermann [Thu, 30 Jul 2020 10:28:37 +0000 (12:28 +0200)]
drm/mgag200: Enable caching for SHMEM pages

SHMEM pages use write-combine caching by default, but can also use the
platform's default page caching. Doing so may improve the performance
of I/O on the framebuffer.

Mgag200's hardware does not access framebuffer pages directly (i.e.,
via DMA), so enabling caching does not have an effect on consistency
of the framebuffer memory or the displayed data.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730102844.10995-2-tzimmermann@suse.de
3 years agodrm/ast: Managed device release
Thomas Zimmermann [Thu, 30 Jul 2020 13:52:06 +0000 (15:52 +0200)]
drm/ast: Managed device release

This turns the ast's device cleanup code into a managed release helper
function. Note that the code uses devres helpers. The release function
switches the device back to VGA mode and therefore runs during HW device
cleanup; not at DRM device cleanup.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730135206.30239-10-tzimmermann@suse.de
3 years agodrm/ast: Manage release of firmware backup memory
Thomas Zimmermann [Thu, 30 Jul 2020 13:52:05 +0000 (15:52 +0200)]
drm/ast: Manage release of firmware backup memory

The ast driver keeps a backup copy of the DP501 encoder's firmware. This
patch adds managed release of the allocated memory.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730135206.30239-9-tzimmermann@suse.de
3 years agodrm/ast: Managed release of ast firmware
Thomas Zimmermann [Thu, 30 Jul 2020 13:52:04 +0000 (15:52 +0200)]
drm/ast: Managed release of ast firmware

The ast driver loads firmware for the DP501 display encoder. The
patch replaces the removal code with a managed release function.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730135206.30239-8-tzimmermann@suse.de
3 years agodrm/ast: Embed struct drm_device in struct ast_private
Thomas Zimmermann [Thu, 30 Jul 2020 13:52:03 +0000 (15:52 +0200)]
drm/ast: Embed struct drm_device in struct ast_private

Turns struct ast_private into a subclass of struct drm_device by
embedding the latter. This allows for using DRM's managed device
allocation.

The use of struct drm_device.dev_private is deprecated. The patch
converts the last remaining users to to_ast_private().

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730135206.30239-7-tzimmermann@suse.de
3 years agodrm/ast: Don't use ast->dev if dev is available
Thomas Zimmermann [Thu, 30 Jul 2020 13:52:02 +0000 (15:52 +0200)]
drm/ast: Don't use ast->dev if dev is available

Several places in ast use ast->dev, when a dev pointer is already
available within the function. Remove the extra indirection. No
functional changes made.

This is just a small cleanup before embedding the DRM device instance
in struct ast_private.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730135206.30239-6-tzimmermann@suse.de
3 years agodrm/ast: Replace struct_drm_device.dev_private with to_ast_private()
Thomas Zimmermann [Thu, 30 Jul 2020 13:52:01 +0000 (15:52 +0200)]
drm/ast: Replace struct_drm_device.dev_private with to_ast_private()

The ast code still references dev_private in several place when looking
up the ast device structure. Convert the remaining locations to use
to_ast_private().

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730135206.30239-5-tzimmermann@suse.de
3 years agodrm/ast: Replace driver load/unload functions with device create/destroy
Thomas Zimmermann [Thu, 30 Jul 2020 13:52:00 +0000 (15:52 +0200)]
drm/ast: Replace driver load/unload functions with device create/destroy

The ast driver's load and unload functions are left-overs from when
struct drm_driver.load/unload was still in use. The PCI probe helper
allocated the DRM device and ran load to initialize it.

This patch replaces this code with device create and destroy. The
main difference is that the device's create function allocates the
DRM device and ast structures in the same place. This will be required
for switching ast to managed allocations.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730135206.30239-4-tzimmermann@suse.de
3 years agodrm/ast: Separate DRM driver from PCI code
Thomas Zimmermann [Thu, 30 Jul 2020 13:51:59 +0000 (15:51 +0200)]
drm/ast: Separate DRM driver from PCI code

Putting the DRM driver to the top of the file and the PCI code to the
bottom makes ast_drv.c more readable. While at it, the patch prefixes
file-scope variables with ast_.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730135206.30239-3-tzimmermann@suse.de
3 years agodrm/ast: Embed CRTC and connector in struct ast_private
Thomas Zimmermann [Thu, 30 Jul 2020 13:51:58 +0000 (15:51 +0200)]
drm/ast: Embed CRTC and connector in struct ast_private

Only single instances of CRTC and connector are supported per
device. Embed both in ast's structure and remove the individual
memory allocations. DRM's CRTC cleanup helpers replace the rsp.
destroy function in ast.

While at it, also convert to_ast_connector() to a function.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730135206.30239-2-tzimmermann@suse.de
3 years agodrm/syncobj: Tune down unordered timeline DRM_ERROR
Daniel Vetter [Sat, 1 Aug 2020 09:26:25 +0000 (11:26 +0200)]
drm/syncobj: Tune down unordered timeline DRM_ERROR

Userspace can provoke this, we generally don't allow userspace to spam
dmesg. Tune it down to debug. Unfortunately we don't have easy access
to the drm_device here (not at all without changing a few things), so
leave it as old style dmesg output for now.

References: https://patchwork.freedesktop.org/series/80146/
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "Christian König" <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200801092625.1107609-1-daniel.vetter@ffwll.ch
3 years agodrm/vkms: fix xrgb on compute crc
Melissa Wen [Thu, 30 Jul 2020 20:25:24 +0000 (17:25 -0300)]
drm/vkms: fix xrgb on compute crc

The previous memset operation was not correctly zeroing the alpha
channel to compute the crc, and as a result, the IGT subtest
kms_cursor_crc/pipe-A-cursor-alpha-transparent fails.

Fixes: db7f419c06d7c ("drm/vkms: Compute CRC with Cursor Plane")

Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200730202524.5upzuh4irboru7my@smtp.gmail.com
3 years agodrm/panel: simple: Add Chefree CH101OLHLWH-002 panel
Marek Vasut [Tue, 28 Jul 2020 20:12:42 +0000 (22:12 +0200)]
drm/panel: simple: Add Chefree CH101OLHLWH-002 panel

Add support for the Chefree CH101OLHLWH-002 10.1" (1280x800)
color TFT LCD panel, connected over LVDS.

Timings are taken from the datasheet version P0.5.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: dri-devel@lists.freedesktop.org
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: devicetree@vger.kernel.org
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200728201242.4336-3-marex@denx.de