Re: [PATCH] drm/hisilicon: Fixed pcie resource conflict between drm and firmware

2020-02-19 Thread Thomas Zimmermann
Hi Am 19.02.20 um 08:57 schrieb Tian Tao: > remove the framebuffer initialized by fireware/bootloader,which will use > hibmc's pcie resource, and may cause conflict. > > Signed-off-by: Tian Tao > Signed-off-by: Gong junjie > --- > drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 18 ++

[PATCH v2 8/8] drm/ttm: do not keep GPU dependent addresses

2020-02-19 Thread Nirmoy Das
GPU address handling is device specific and should be handle by its device driver. Signed-off-by: Nirmoy Das --- drivers/gpu/drm/ttm/ttm_bo.c| 7 --- include/drm/ttm/ttm_bo_api.h| 2 -- include/drm/ttm/ttm_bo_driver.h | 1 - 3 files changed, 10 deletions(-) diff --git a/drivers/gpu/

Re: [PATCH v2 2/2] ARM: sun7i: dts: Add LVDS panel support on A20

2020-02-19 Thread Andrey Lebedev
On Mon, Feb 17, 2020 at 06:51:35PM +0100, Maxime Ripard wrote: > > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h > > b/drivers/gpu/drm/sun4i/sun4i_tcon.h > > index cfbf4e6c1679..bc87d28ee341 100644 > > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h > > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h > > @@ -

[PATCH] drm/nouveau: remove checks for return value of debugfs functions

2020-02-19 Thread Wambui Karuga
As there is no need to check for the return value of debugfs_create_file and drm_debugfs_create_files, remove unnecessary checks and error handling in nouveau_drm_debugfs_init. Signed-off-by: Wambui Karuga --- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 20 1 file changed, 8

[PATCH v2 5/8] drm/qxl: don't use ttm bo->offset

2020-02-19 Thread Nirmoy Das
This patch removes slot->gpu_offset which is not required as VRAM and PRIV slot are in separate PCI bar This patch also removes unused qxl_bo_gpu_offset() Signed-off-by: Nirmoy Das Acked-by: Christian König Acked-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_drv.h| 6 ++ drivers/gpu/d

[PATCH] drm/hisilicon: Fixed pcie resource conflict between drm and firmware

2020-02-19 Thread Tian Tao
remove the framebuffer initialized by fireware/bootloader,which will use hibmc's pcie resource, and may cause conflict. Signed-off-by: Tian Tao Signed-off-by: Gong junjie --- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/

[PATCH] drm/arc: make arcpgu_debugfs_init return 0

2020-02-19 Thread Wambui Karuga
As drm_debugfs_create_files should return void, remove its use as the return value of arcpgu_debugfs_init and have the latter function return 0 directly. Signed-off-by: Wambui Karuga --- drivers/gpu/drm/arc/arcpgu_drv.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dr

[PATCH] drm/tilcdc: remove check for return value of debugfs functions.

2020-02-19 Thread Wambui Karuga
Remove the check and error handling of the return value of drm_debugfs_create_files as it is not needed in tilcdc_debugfs_init. Also remove local variables that are not used after the changes. Signed-off-by: Wambui Karuga --- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 15 --- 1 file chang

[PATCH 2/2] drm/virtio: Support virtgpu exported resources

2020-02-19 Thread David Stevens
Add support for exported resources to virtgpu. This includes adding support for the new virtgpu command as well as well as switching from regular prime dma-bufs to virtio dma-bufs. Signed-off-by: David Stevens --- drivers/gpu/drm/virtio/virtgpu_drv.c | 3 + drivers/gpu/drm/virtio/virtgpu_drv

[PATCH] drm/tegra: remove checks for debugfs functions return value

2020-02-19 Thread Wambui Karuga
Remove the return checks and error handling of the drm_debugfs_create_files function from various debugfs init functions in drm/tegra and have them return 0 directly. Signed-off-by: Wambui Karuga --- drivers/gpu/drm/tegra/dc.c | 11 +-- drivers/gpu/drm/tegra/drm.c | 7 --- driver

[PATCH 0/2] Support virtio cross-device resources

2020-02-19 Thread David Stevens
This patchset implements the current proposal for virtio cross-device resource sharing [1], with minor changes based on recent comments (i.e. renumbering the new virtio gpu command and adding a feature flag). The patchset adds a new flavor of dma-bufs that supports querying the underlying virtio o

[PATCH 1/2] virtio: add dma-buf support for exported objects

2020-02-19 Thread David Stevens
This change adds a new flavor of dma-bufs that can be used by virtio drivers to share exported objects. A virtio dma-buf can be queried by virtio drivers to obtain the UUID which identifies the underlying exported object. Signed-off-by: David Stevens --- drivers/virtio/Makefile | 2 +-

[PATCH 1/2] drm/debugfs: remove checks for return value of drm_debugfs functions.

2020-02-19 Thread Wambui Karuga
As there is no need to check the return value of drm_debugfs_create_files, remove unnecessary checks and error handling statement blocks. Signed-off-by: Wambui Karuga --- drivers/gpu/drm/drm_debugfs.c | 28 +--- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git

[PATCH] drm/vc4: remove check of return value of drm_debugfs functions

2020-02-19 Thread Wambui Karuga
Remove unnecessary check and error handling for the return value of drm_debugfs_create_files in vc4_debugfs_init. Signed-off-by: Wambui Karuga --- drivers/gpu/drm/vc4/vc4_debugfs.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/dri

[PATCH v2 3/8] drm/vmwgfx: don't use ttm bo->offset

2020-02-19 Thread Nirmoy Das
Calculate GPU offset within vmwgfx driver itself without depending on bo->offset Signed-off-by: Nirmoy Das Acked-by: Christian König --- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c| 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 2 +- dri

Re: [PATCH] drm/etnaviv: remove check for return value of drm_debugfs function

2020-02-19 Thread Wambui Karuga
On Tue, 18 Feb 2020, Lucas Stach wrote: On Di, 2020-02-18 at 20:28 +0300, Wambui Karuga wrote: As there is no need to check the return value if drm_debugfs_create_files, And here is where the commit message skips a very important information: Since 987d65d01356 (drm: debugfs: make drm_debu

[PATCH] drm/v3d: make v3d_debugfs_init return 0

2020-02-19 Thread Wambui Karuga
As drm_debugfs_create_files should return void, remove its use as the return value of v3d_debugfs_init and have the function return 0 directly. Signed-off-by: Wambui Karuga --- drivers/gpu/drm/v3d/v3d_debugfs.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gp

[PATCH v2 7/8] drm/bochs: use drm_gem_vram_offset to get bo offset

2020-02-19 Thread Nirmoy Das
Switch over to GEM VRAM's implementation to retrieve bo->offset Signed-off-by: Nirmoy Das Acked-by: Christian König --- drivers/gpu/drm/bochs/bochs_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c in

[PATCH v2 2/8] drm/radeon: don't use ttm bo->offset

2020-02-19 Thread Nirmoy Das
Calculate GPU offset in radeon_bo_gpu_offset without depending on bo->offset Signed-off-by: Nirmoy Das Reviewed-and-tested-by: Christian König --- drivers/gpu/drm/radeon/radeon.h| 1 + drivers/gpu/drm/radeon/radeon_object.h | 16 +++- drivers/gpu/drm/radeon/radeon_ttm.c

[PATCH] video: fbdev: radeon: Remove dead code

2020-02-19 Thread Souptick Joarder
This is dead code since 3.15 and can be removed if not going to be useful further. Signed-off-by: Souptick Joarder --- drivers/video/fbdev/aty/radeon_base.c | 16 1 file changed, 16 deletions(-) diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeo

Re: [PATCH v2 RESEND] drm/i915/gvt: make gvt oblivious of kvmgt data structures

2020-02-19 Thread Julian Stecklina
On Tue, 2020-02-18 at 16:50 +0800, Zhenyu Wang wrote: > Looks this needs some backmerge first to apply, I'll include this > for -next pull later. I usually base these patches on gvt-staging. If there is some other branch to rebase them onto to make your life easier, just point me to it. > Thanks

[PATCH v2 1/8] drm/amdgpu: move ttm bo->offset to amdgpu_bo

2020-02-19 Thread Nirmoy Das
GPU address should belong to driver not in memory management. This patch moves ttm bo.offset and gpu_offset calculation to amdgpu driver. Signed-off-by: Nirmoy Das Acked-by: Huang Rui Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 22 ++-- drivers/gpu

[PATCH] drm/etnaviv: remove check for return value of drm_debugfs function

2020-02-19 Thread Wambui Karuga
As there is no need to check the return value if drm_debugfs_create_files, remove the check and error handling in etnaviv_debugfs_init and have the function return 0 directly. Signed-off-by: Wambui Karuga --- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 16 1 file changed, 4 insertio

[PATCH v2 6/8] drm/vram-helper: don't use ttm bo->offset

2020-02-19 Thread Nirmoy Das
Calculate GPU offset within vram-helper without depending on bo->offset Signed-off-by: Nirmoy Das --- drivers/gpu/drm/drm_gem_vram_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c index 92a

stable-rc 5.5.5-rc1: [drm:ade_irq_handler [kirin_drm]] *ERROR* LDI underflow!

2020-02-19 Thread Naresh Kamboju
The arm64 device running LTP hugetlb test suite caused test hang on stable-rc 5.5.5-rc1 due to [drm:ade_irq_handler [kirin_drm]] *ERROR* LDI underflow!. Same problem noticed while running libhugetlbfs test suite. Problematic patch not identified yet. hugemmap05.c:223: INFO: original nr_hugepages

[PATCH 2/2] drm: convert drm_debugfs functions to return void

2020-02-19 Thread Wambui Karuga
As drm_debug_create_files will be converted to return void, drop return value from various drm_debugfs functions that return drm_debug_create_files and convert the functions to return void. Signed-off-by: Wambui Karuga --- drivers/gpu/drm/drm_atomic.c| 8 drivers/gpu/drm/drm_cli

[PATCH] drm/vram-helper: make drm_vram_mm_debugfs_init return 0

2020-02-19 Thread Wambui Karuga
As drm_debugfs_create_files() should return 0, remove its use as the return value of drm_vram_mm_debugfs_init(), and have the function return 0 directly. Signed-off-by: Wambui Karuga --- drivers/gpu/drm/drm_gem_vram_helper.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) di

[PATCH] drm/arm: make hdlcd_debugfs_init return 0

2020-02-19 Thread Wambui Karuga
As drm_debugfs_create_files should return void, remove its use as a return value in hdlcd_debugfs_init and have the latter function return 0 directly. Signed-off-by: Wambui Karuga --- drivers/gpu/drm/arm/hdlcd_drv.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/driver

[PATCH v2 0/8] do not store GPU address in TTM

2020-02-19 Thread Nirmoy Das
With this patch series I am trying to remove GPU address dependency in TTM and moving GPU address calculation to individual drm drivers. I tested this patch series on qxl, bochs and amdgpu. Christian tested it on radeon HW. It would be nice if someone test this for nouveau and vmgfx. v2: set bo-

Re: LED backlight on Droid 4 and others

2020-02-19 Thread Tony Lindgren
* Lee Jones [200218 13:52]: > On Wed, 12 Feb 2020, Pavel Machek wrote: > > > Hi! > > > > > > > It would be good to get LED backlight to work in clean way for 5.6 > > > > > kernel. > > > ... > > > > > [If you have an idea what else is needed, it would be welcome; it > > > > > works for me in deve

[PATCH] drm/hisilicon: Set preferred mode resolution and maximum resolution

2020-02-19 Thread Tian Tao
set the preferred mode resolution to 1024 * 768 and maximum resolution to 1920 * 1200. Signed-off-by: Tian Tao Signed-off-by: Gong junjie --- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/hisilicon/

[PATCH v2 4/8] drm/nouveau: don't use ttm bo->offset

2020-02-19 Thread Nirmoy Das
Store ttm bo->offset in struct nouveau_bo instead. Signed-off-by: Nirmoy Das Acked-by: Christian König --- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/disp.c | 2 +- drivers/gpu/drm/nouveau/dispnv04/overlay.c | 6 +++--- drivers/gpu/drm/nouve

[PATCH] drm/i915: make i915_debugfs_register return void.

2020-02-19 Thread Wambui Karuga
As drm_debugfs_create_files should return void, remove its use as the return value of i915_debugfs_register and have i915_debugfs_register return void. Signed-off-by: Wambui Karuga --- drivers/gpu/drm/i915/i915_debugfs.c | 8 drivers/gpu/drm/i915/i915_debugfs.h | 4 ++-- 2 files changed

[Bug 206519] [amdgpu] kernel NULL pointer dereference on shutdown when CONFIG_DRM_AMD_DC_HDCP=y

2020-02-19 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=206519 --- Comment #6 from Shlomo (shl...@fastmail.com) --- Yes, this fixes the bug. I applied your patch over linux v5.5, but I first had to modify it so it would apply: - drm_connector_attach_content_protection_property(&aconnect

RE: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-19 Thread Tian, Kevin
> From: Paolo Bonzini > Sent: Wednesday, February 19, 2020 12:29 AM > > On 14/02/20 23:03, Sean Christopherson wrote: > >> On Fri, Feb 14, 2020 at 1:47 PM Chia-I Wu wrote: > >>> AFAICT, it is currently allowed on ARM (verified) and AMD (not > >>> verified, but svm_get_mt_mask returns 0 which supp

RE: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-19 Thread Tian, Kevin
> From: Chia-I Wu > Sent: Saturday, February 15, 2020 5:15 AM > > On Fri, Feb 14, 2020 at 2:26 AM Paolo Bonzini wrote: > > > > On 13/02/20 23:18, Chia-I Wu wrote: > > > > > > The bug you mentioned was probably this one > > > > > > https://bugzilla.kernel.org/show_bug.cgi?id=104091 > > > > Yes,

[PATCH 01/52] mm/sl[uo]b: export __kmalloc_track(_node)_caller

2020-02-19 Thread Daniel Vetter
slab does this already, and I want to use this in a memory allocation tracker in drm for stuff that's tied to the lifetime of a drm_device, not the underlying struct device. Kinda like devres, but for drm. Signed-off-by: Daniel Vetter Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes C

[PATCH 02/52] drm/i915: Don't clear drvdata in ->release

2020-02-19 Thread Daniel Vetter
For two reasons: - The driver core clears this already for us after we're unloaded in __device_release_driver(). - It's way too late, the drm_device ->release callback might massively outlive the underlying physical device, since a drm_device can't be kept alive by open drm_file or well rea

[PATCH 04/52] drm: Set final_kfree in drm_dev_alloc

2020-02-19 Thread Daniel Vetter
I also did a full review of all callers, and only the xen driver forgot to call drm_dev_put in the failure path. Fix that up too. v2: I noticed that xen has a drm_driver.release hook, and uses drm_dev_alloc(). We need to remove the kfree from xen_drm_drv_release(). bochs also has a release hook,

[PATCH 06/52] drm/udl: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
With this we can drop the final kfree from the release function. Signed-off-by: Daniel Vetter Cc: Dave Airlie Cc: Sean Paul Cc: Thomas Zimmermann Cc: Emil Velikov Cc: Daniel Vetter Cc: "Noralf Trønnes" Cc: Thomas Gleixner Cc: Sam Ravnborg --- drivers/gpu/drm/udl/udl_drv.c | 3 ++- 1 file

[PATCH 00/52] drm_device managed resources

2020-02-19 Thread Daniel Vetter
Hi all, So I finally bit the bullet and started a little framework for managed resources tied to the drm_device lifetime, instead of the lifetime of the underlying physical device. Because I've seen one patch too many that just totally got this wrong. Yes it's huge, but I think this is what we mi

[PATCH 11/52] drm/v3d: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
With this we can drop the final kfree from the release function. I also noticed that the unwind code is wrong, after drm_dev_init the drm_device owns the v3d allocation, so the kfree(v3d) is a double-free. Reorder the setup to fix this issue. After a bit more prep in drivers and drm core v3d shou

[PATCH 05/52] drm/mipi_dbi: Use drmm_add_final_kfree in all drivers

2020-02-19 Thread Daniel Vetter
They all share mipi_dbi_release so we need to switch them all together. With this we can drop the final kfree from the release function. Aside, I think we could perhaps have a tiny additional helper for these mipi_dbi drivers, the first few lines around devm_drm_dev_init are all the same (except f

[PATCH 07/52] drm/udl: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
With this we can drop the final kfree from the release function. v2: We need drm_dev_put to unroll the driver creation (once drm_dev_init and drmm_add_final_kfree suceeded), otherwise the drmm_ magic doesn't happen. Signed-off-by: Daniel Vetter Cc: Dave Airlie Cc: Sean Paul Cc: Thomas Zimmerma

[PATCH 03/52] drm: add managed resources tied to drm_device

2020-02-19 Thread Daniel Vetter
We have lots of these. And the cleanup code tends to be of dubious quality. The biggest wrong pattern is that developers use devm_, which ties the release action to the underlying struct device, whereas all the userspace visible stuff attached to a drm_device can long outlive that one (e.g. after a

[PATCH 13/52] drm/mcde: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
With this we can drop the final kfree from the release function. Signed-off-by: Daniel Vetter Cc: Linus Walleij --- drivers/gpu/drm/mcde/mcde_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c index f28cb

[PATCH 21/52] drm: Handle dev->unique with drmm_

2020-02-19 Thread Daniel Vetter
We need to add a drmm_kstrdup for this, but let's start somewhere. This is not exactly perfect onion unwinding, but it's jsut a kfree so doesn't really matter at all. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_drv.c | 5 ++--- drivers/gpu/drm/drm_managed.c | 16

[PATCH 09/52] drm/i915: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
With this we can drop the final kfree from the release function. The mock device in the selftests needed it's pci_device split up from the drm_device. In the future we could simplify this again by allocating the pci_device as a managed allocation too. v2: I overlooked that i915_driver_destroy is

[PATCH 31/52] drm/cirrus: Fully embrace devm_

2020-02-19 Thread Daniel Vetter
With the drm_device lifetime fun cleaned up there's nothing in the way anymore to use devm_ for everything hw releated. Do it, and in the process, throw out the entire onion unwinding. Signed-off-by: Daniel Vetter Cc: Dave Airlie Cc: Gerd Hoffmann Cc: Daniel Vetter Cc: "Noralf Trønnes" Cc: Em

[PATCH 14/52] drm/vgem: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
With this we can drop the final kfree from the release function. v2: After drm_dev_init/drmm_add_final_kfree we need to clean up everything through a drm_dev_put. Rework the unwind code to match that. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Emil Velikov Cc: Chris Wilson Cc: Sean Pa

[PATCH 17/52] drm/inigenic: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
With this we can drop the final kfree from the release function. Signed-off-by: Daniel Vetter Cc: Paul Cercueil --- drivers/gpu/drm/ingenic/ingenic-drm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ing

[PATCH 18/52] drm/gm12u320: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
With this we can drop the final kfree from the release function. Signed-off-by: Daniel Vetter Cc: Hans de Goede --- drivers/gpu/drm/tiny/gm12u320.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tiny/gm12u320.c b/drivers/gpu/drm/tiny/gm12u320.c index a4817

[PATCH 29/52] drm/bochs: Drop explicit drm_mode_config_cleanup

2020-02-19 Thread Daniel Vetter
Instead rely on the automatic clean, for which we just need to check that drm_mode_config_init succeeded. To avoid an inversion in the cleanup we also have to move the dev_private allocation over to drmm_kzalloc. Signed-off-by: Daniel Vetter Cc: Gerd Hoffmann Cc: virtualizat...@lists.linux-found

[PATCH 24/52] drm: Manage drm_gem_init with drmm_

2020-02-19 Thread Daniel Vetter
We might want to look into pushing this down into drm_mm_init, but that would mean rolling out return codes to a pile of functions unfortunately. So let's leave that for now. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_drv.c | 8 +--- drivers/gpu/drm/drm_gem.c | 21 ++

[PATCH 27/52] drm: Manage drm_mode_config_init with drmm_

2020-02-19 Thread Daniel Vetter
drm_mode_config_cleanup is idempotent, so no harm in calling this twice. This allows us to gradually switch drivers over by removing explicit drm_mode_config_cleanup calls. With this step it's not also possible that (at least for simple drivers) automatic resource cleanup can be done correctly wit

[PATCH 16/52] drm/repaper: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
With this we can drop the final kfree from the release function. Signed-off-by: Daniel Vetter Cc: "Noralf Trønnes" --- drivers/gpu/drm/tiny/repaper.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c index f5

[PATCH 20/52] drm: Cleanups after drmm_add_final_kfree rollout

2020-02-19 Thread Daniel Vetter
A few things: - Update the example driver in the documentation. - We can drop the old kfree in drm_dev_release. - Add a WARN_ON check in drm_dev_register to make sure everyone calls drmm_add_final_kfree and there's no leaks. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_drv.c | 11 -

[PATCH 10/52] drm/cirrus: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
With this we can drop the final kfree from the release function. I also noticed that cirrus forgot to call drm_dev_fini(). v2: Don't call kfree(cirrus) after we've handed overship of that to drm_device and the drmm_ stuff. Signed-off-by: Daniel Vetter Cc: Dave Airlie Cc: Gerd Hoffmann Cc: Dan

[PATCH 23/52] drm: manage drm_minor cleanup with drmm_

2020-02-19 Thread Daniel Vetter
The cleanup here is somewhat tricky, since we can't tell apart the allocated minor index from 0. So register a cleanup action first, and if the index allocation fails, unregister that cleanup action again to avoid bad mistakes. The kdev for the minor already handles NULL, so no problem there. Hen

[PATCH 08/52] drm/qxl: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
With this we can drop the final kfree from the release function. Signed-off-by: Daniel Vetter Cc: Dave Airlie Cc: Gerd Hoffmann Cc: virtualizat...@lists.linux-foundation.org Cc: spice-de...@lists.freedesktop.org --- drivers/gpu/drm/qxl/qxl_drv.c | 2 -- drivers/gpu/drm/qxl/qxl_kms.c | 2 ++ 2

[PATCH 26/52] drm: Garbage collect drm_dev_fini

2020-02-19 Thread Daniel Vetter
It has become empty. Given the few users I figured not much point splitting this up. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/cirrus/cirrus.c | 1 - drivers/gpu/drm/drm_drv.c | 23 +-- drivers/gpu/drm/drm_mipi_dbi.c| 1 -

[PATCH 15/52] drm/vkms: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
With this we can drop the final kfree from the release function. v2: After drm_dev_init/drmm_add_final_kfree we need to clean up everything through a drm_dev_put. Rework the unwind code to match that. Signed-off-by: Daniel Vetter Cc: Rodrigo Siqueira Cc: Haneen Mohammed Cc: Daniel Vetter ---

[PATCH 30/52] drm/cirrus: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
We can even delete the drm_driver.release hook now! Signed-off-by: Daniel Vetter Cc: Dave Airlie Cc: Gerd Hoffmann Cc: Daniel Vetter Cc: "Noralf Trønnes" Cc: Sam Ravnborg Cc: Thomas Zimmermann Cc: virtualizat...@lists.linux-foundation.org --- drivers/gpu/drm/cirrus/cirrus.c | 21 ++

[PATCH 12/52] drm/tidss: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
With this we can drop the final kfree from the release function. Signed-off-by: Daniel Vetter Cc: Jyri Sarha Cc: Tomi Valkeinen --- drivers/gpu/drm/tidss/tidss_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tid

[PATCH 19/52] drm/: Use drmm_add_final_kfree

2020-02-19 Thread Daniel Vetter
These are the leftover drivers that didn't have a ->release hook that needed to be updated. Signed-off-by: Daniel Vetter Cc: "James (Qian) Wang" Cc: Liviu Dudau Cc: Mihail Atanassov Cc: Russell King Cc: Hans de Goede --- drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 2 ++ drivers/gpu/dr

[PATCH 52/52] drm: Add docs for managed resources

2020-02-19 Thread Daniel Vetter
All collected together to provide a consistent story in one patch, instead of the somewhat bumpy refactor-evolution leading to this. Also some thoughts on what the next steps could be: - Create a macro called devm_drm_dev_alloc() which essentially wraps the kzalloc(); devm_drm_dev_init(); drmm_

[PATCH 50/52] drm/udl: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
It's right above the drm_dev_put(). This allows us to delete a bit of onion unwinding in udl_modeset_init(). Signed-off-by: Daniel Vetter Cc: Dave Airlie Cc: Sean Paul Cc: Daniel Vetter Cc: Thomas Zimmermann Cc: Emil Velikov Cc: Gerd Hoffmann Cc: "Noralf Trønnes" Cc: Thomas Gleixner Cc:

[PATCH 34/52] drm/mcde: More devm_drm_dev_init

2020-02-19 Thread Daniel Vetter
Auto-unwind ftw, now possible with the fixed drm_device related management. Aside, clk/regulator seem to be missing devm versions for a bunch of functions, preventing a pile of these simpler drivers from outright losing their ->remove hook. Signed-off-by: Daniel Vetter Cc: Linus Walleij --- dr

[PATCH 40/52] drm/shmob: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
It's right above the drm_dev_put(). Aside: Another driver with a bit much devm_kzalloc, which should probably use drmm_kzalloc instead ... Signed-off-by: Daniel Vetter Cc: Laurent Pinchart Cc: Kieran Bingham Cc: linux-renesas-...@vger.kernel.org --- drivers/gpu/drm/shmobile/shmob_drm_drv.c |

[PATCH 32/52] drm/ingenic: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
Allows us to drop the drm_driver.release callback. Signed-off-by: Daniel Vetter Cc: Paul Cercueil --- drivers/gpu/drm/ingenic/ingenic-drm.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-dr

[PATCH 38/52] drm/rockchip: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
It's (almost, there's some iommu stuff without significance) right above the drm_dev_put(). Aside: Another driver with a bit much devm_kzalloc, which should probably use drmm_kzalloc instead ... Signed-off-by: Daniel Vetter Cc: Sandy Huang Cc: "Heiko Stübner" Cc: linux-arm-ker...@lists.infrade

[PATCH 41/52] drm/mtk: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
It's right above the drm_dev_put(). Aside: Another driver with a bit much devm_kzalloc, which should probably use drmm_kzalloc instead ... Signed-off-by: Daniel Vetter --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers

[PATCH 25/52] drm: Manage drm_vblank_cleanup with drmm_

2020-02-19 Thread Daniel Vetter
Nothing special here, except that this is the first time that we automatically clean up something that's initialized with an explicit driver call. But the cleanup was done at the very of the release sequence for all drivers, and that's still the case. At least without more uses of drmm_ through exp

[PATCH 46/52] drm/gm12u320: Simplify upload work

2020-02-19 Thread Daniel Vetter
Instead of having a work item that never stops (which really should be a kthread), with a dedicated workqueue to not upset anyone else, use a delayed work. A bunch of changes: - We can throw out all the custom wakeup and requeue logic and state tracking. If we schedule the work with a 0 delay it

[PATCH 43/52] drm/gm12u320: More drmm_

2020-02-19 Thread Daniel Vetter
The drm_mode_config_cleanup call we can drop, and all the allocations we can switch over to drmm_kzalloc. Unfortunately the work queue is still present, so can't get rid of the drm_driver->release function outright. Signed-off-by: Daniel Vetter Cc: Hans de Goede Cc: "Noralf Trønnes" --- driver

[PATCH 36/52] drm/pl111: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
It's right above the drm_dev_put(). Aside: This driver gets its devm_ stuff all wrong wrt drm_device and anything hanging off that. Not the only one unfortunately. Signed-off-by: Daniel Vetter Cc: Eric Anholt --- drivers/gpu/drm/pl111/pl111_drv.c | 12 ++-- 1 file changed, 6 insertions

[PATCH 49/52] drm/mipi-dbi: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
Allows us to drop the drm_driver.release callback from all drivers, and remove the mipi_dbi_release() function. Signed-off-by: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter Cc: Eric Anholt Cc: David Lechner Cc: Kamlesh Guruda

[PATCH 42/52] drm/tidss: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
It's right above the drm_dev_put(). Aside: Another driver with a bit much devm_kzalloc, which should probably use drmm_kzalloc instead ... I'm pretty sure this one blows up already under KASAN because it's using devm_drm_dev_init, and later on devm_kzalloc. Hence the memory will get freed before

[PATCH 47/52] drm/repaper: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
Allows us to drop the drm_driver.release callback. Signed-off-by: Daniel Vetter Cc: "Noralf Trønnes" --- drivers/gpu/drm/tiny/repaper.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c index 4741ff670ec9..2f70fb1be200 100

[PATCH 37/52] drm/rcar-du: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
It's right above the drm_dev_put(). Aside: Another driver with a bit much devm_kzalloc, which should probably use drmm_kzalloc instead ... Signed-off-by: Daniel Vetter Cc: Laurent Pinchart Cc: Kieran Bingham Cc: linux-renesas-...@vger.kernel.org --- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 1 -

[PATCH 28/52] drm/bochs: Remove leftover drm_atomic_helper_shutdown

2020-02-19 Thread Daniel Vetter
Small mistake that crept into commit 81da8c3b8d3df6f05b11300b7d17ccd1f3017fab Author: Gerd Hoffmann Date: Tue Feb 11 14:52:18 2020 +0100 drm/bochs: add drm_driver.release callback where drm_atomic_helper_shutdown was left in both places. The ->release callback really shouldn't touch hardw

[PATCH 33/52] drm/mcde: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
Allows us to drop the drm_driver.release callback. Signed-off-by: Daniel Vetter Cc: Linus Walleij --- drivers/gpu/drm/mcde/mcde_drv.c | 22 ++ 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c ind

[PATCH 48/52] drm/mipi-dbi: Move drm_mode_config_init into mipi library

2020-02-19 Thread Daniel Vetter
7/7 drivers agree that's the right choice, let's do this. This avoids duplicating the same old error checking code over all 7 drivers, which is the motivation here. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_mipi_dbi.c | 4 drivers/gpu/drm/tiny/hx8357d.c | 2 -- drivers/gpu/drm

[PATCH 22/52] drm: Use drmm_ for drm_dev_init cleanup

2020-02-19 Thread Daniel Vetter
Well for the simple stuff at least, vblank, gem and minor cleanup I want to further split up as a demonstration. v2: We need to clear drm_device->dev otherwise the debug drm printing after our cleanup hook (e.g. in drm_manged_release) will chase released memory and result in a use-after-free. Not

[PATCH 44/52] drm/gm12u320: Use devm_drm_dev_init

2020-02-19 Thread Daniel Vetter
Only drops the drm_dev_put, but hey a few lines! Signed-off-by: Daniel Vetter Cc: Hans de Goede Cc: "Noralf Trønnes" --- drivers/gpu/drm/tiny/gm12u320.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/tiny/gm12u320.c b/drivers/gpu/drm/ti

[PATCH 51/52] drm/udl: drop drm_driver.release hook

2020-02-19 Thread Daniel Vetter
There's only two functions called from that: drm_kms_helper_poll_fini() and udl_free_urb_list(). Both of these are also called from the ubs_driver->disconnect hook, so entirely pointless to do the same again in the ->release hook. Furthermore by the time we clean up the drm_driver we really should

[PATCH 35/52] drm/meson: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
It's right above the drm_dev_put(). Aside: This driver gets its devm_ stuff all wrong wrt drm_device and anything hanging off that. Not the only one unfortunately. Signed-off-by: Daniel Vetter Cc: Neil Armstrong Cc: Kevin Hilman Cc: linux-amlo...@lists.infradead.org Cc: linux-arm-ker...@lists.

[PATCH 45/52] drm/gm12u320: Use helpers for shutdown/suspend/resume

2020-02-19 Thread Daniel Vetter
Also there's a race in the disconnect implemenation. First shut down, then unplug, leaves a window where userspace could sneak in and restart the entire machinery. With this we can also delete the very un-atomic global pipe_enabled tracking. Signed-off-by: Daniel Vetter Cc: Hans de Goede Cc: "N

[PATCH 39/52] drm/stm: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
It's right above the drm_dev_put(). Aside: Another driver with a bit much devm_kzalloc, which should probably use drmm_kzalloc instead ... Signed-off-by: Daniel Vetter Cc: Yannick Fertre Cc: Philippe Cornu Cc: Benjamin Gaignard Cc: Vincent Abriou Cc: Maxime Coquelin Cc: Alexandre Torgue Cc

Re: [PATCH 37/52] drm/rcar-du: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Geert Uytterhoeven
Hi Daniel, On Wed, Feb 19, 2020 at 11:22 AM Daniel Vetter wrote: > It's right above the drm_dev_put(). > > Aside: Another driver with a bit much devm_kzalloc, which should > probably use drmm_kzalloc instead ... What's drmm_kzalloc()? The only references I can find are in this patch series. Gr{

Re: [PATCH 35/52] drm/meson: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Neil Armstrong
On 19/02/2020 11:21, Daniel Vetter wrote: > It's right above the drm_dev_put(). > > Aside: This driver gets its devm_ stuff all wrong wrt drm_device and > anything hanging off that. Not the only one unfortunately. > > Signed-off-by: Daniel Vetter > Cc: Neil Armstrong > Cc: Kevin Hilman > Cc: l

Re: [PATCH 37/52] drm/rcar-du: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
On Wed, Feb 19, 2020 at 11:30 AM Geert Uytterhoeven wrote: > > Hi Daniel, > > On Wed, Feb 19, 2020 at 11:22 AM Daniel Vetter wrote: > > It's right above the drm_dev_put(). > > > > Aside: Another driver with a bit much devm_kzalloc, which should > > probably use drmm_kzalloc instead ... > > What's

RE: [PATCH 3/3] drm/dp_mst: Remove single tx msg restriction.

2020-02-19 Thread Lin, Wayne
[AMD Public Use] > -Original Message- > From: Sean Paul > Sent: Wednesday, February 19, 2020 1:15 AM > To: Lin, Wayne > Cc: Sean Paul ; dri-devel@lists.freedesktop.org; > ly...@redhat.com; Sean Paul ; Maarten Lankhorst > ; Maxime Ripard ; > David Airlie > Subject: Re: [PATCH 3/3] drm/

Re: [PATCH 37/52] drm/rcar-du: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Geert Uytterhoeven
Hi Daniel, On Wed, Feb 19, 2020 at 11:57 AM Daniel Vetter wrote: > On Wed, Feb 19, 2020 at 11:30 AM Geert Uytterhoeven > wrote: > > On Wed, Feb 19, 2020 at 11:22 AM Daniel Vetter > > wrote: > > > It's right above the drm_dev_put(). > > > > > > Aside: Another driver with a bit much devm_kzalloc

Re: [PATCH 05/52] drm/mipi_dbi: Use drmm_add_final_kfree in all drivers

2020-02-19 Thread Thomas Zimmermann
Hi Daniel, good idea. I guess it's the simple encoder's fault. :) I only read briefly over the whole thing. Am 19.02.20 um 11:20 schrieb Daniel Vetter: > They all share mipi_dbi_release so we need to switch them all > together. With this we can drop the final kfree from the release > function. >

Re: [PATCH 37/52] drm/rcar-du: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Laurent Pinchart
Hi Daniel, On Wed, Feb 19, 2020 at 12:10:18PM +0100, Geert Uytterhoeven wrote: > On Wed, Feb 19, 2020 at 11:57 AM Daniel Vetter wrote: > > On Wed, Feb 19, 2020 at 11:30 AM Geert Uytterhoeven wrote: > > > On Wed, Feb 19, 2020 at 11:22 AM Daniel Vetter wrote: > > > > It's right above the drm_dev_put

Re: [PATCH 03/52] drm: add managed resources tied to drm_device

2020-02-19 Thread Neil Armstrong
Hi, On 19/02/2020 11:20, Daniel Vetter wrote: > We have lots of these. And the cleanup code tends to be of dubious > quality. The biggest wrong pattern is that developers use devm_, which > ties the release action to the underlying struct device, whereas > all the userspace visible stuff attached

Re: [PATCH 37/52] drm/rcar-du: Drop explicit drm_mode_config_cleanup call

2020-02-19 Thread Daniel Vetter
On Wed, Feb 19, 2020 at 02:17:27PM +0200, Laurent Pinchart wrote: > Hi Daniel, > > On Wed, Feb 19, 2020 at 12:10:18PM +0100, Geert Uytterhoeven wrote: > > On Wed, Feb 19, 2020 at 11:57 AM Daniel Vetter wrote: > > > On Wed, Feb 19, 2020 at 11:30 AM Geert Uytterhoeven wrote: > > > > On Wed, Feb 19,

Re: [Nouveau] [PATCH 8/8] drm/ttm: do not keep GPU dependent addresses

2020-02-19 Thread Nirmoy
On 2/18/20 8:06 PM, Daniel Vetter wrote: On Tue, Feb 18, 2020 at 07:37:44PM +0100, Christian König wrote: Am 18.02.20 um 19:28 schrieb Thomas Zimmermann: Hi Am 18.02.20 um 19:23 schrieb Christian König: Am 18.02.20 um 19:16 schrieb Thomas Zimmermann: Hi Am 18.02.20 um 18:13 schrieb Nirmoy:

Re: [PATCH 05/52] drm/mipi_dbi: Use drmm_add_final_kfree in all drivers

2020-02-19 Thread Thomas Zimmermann
Am 19.02.20 um 12:47 schrieb Thomas Zimmermann: > Hi Daniel, > > good idea. I guess it's the simple encoder's fault. :) I only read > briefly over the whole thing. > > Am 19.02.20 um 11:20 schrieb Daniel Vetter: >> They all share mipi_dbi_release so we need to switch them all >> together. With

  1   2   3   >