[PATCH v8 5/5] drm: protect drm_master pointers in drm_lease.c

2021-07-11 Thread Desmond Cheong Zhi Xi
drm_file->master pointers should be protected by drm_device.master_mutex or drm_file.master_lookup_lock when being dereferenced. However, in drm_lease.c, there are multiple instances where drm_file->master is accessed and dereferenced while neither lock is held. This makes drm_lease.c vulnerable

[PATCH v8 4/5] drm: serialize drm_file.master with a new spinlock

2021-07-11 Thread Desmond Cheong Zhi Xi
Currently, drm_file.master pointers should be protected by drm_device.master_mutex when being dereferenced. This is because drm_file.master is not invariant for the lifetime of drm_file. If drm_file is not the creator of master, then drm_file.is_master is false, and a call to drm_setmaster_ioctl

[PATCH v8 3/5] drm: add a locked version of drm_is_current_master

2021-07-11 Thread Desmond Cheong Zhi Xi
While checking the master status of the DRM file in drm_is_current_master(), the device's master mutex should be held. Without the mutex, the pointer fpriv->master may be freed concurrently by another process calling drm_setmaster_ioctl(). This could lead to use-after-free errors when the pointer

[PATCH v8 2/5] drm: avoid blocking in drm_clients_info's rcu section

2021-07-11 Thread Desmond Cheong Zhi Xi
Inside drm_clients_info, the rcu_read_lock is held to lock pid_task()->comm. However, within this protected section, a call to drm_is_current_master is made, which involves a mutex lock in a future patch. However, this is illegal because the mutex lock might block while in the RCU read-side

[PATCH v8 1/5] drm: avoid circular locks in drm_mode_getconnector

2021-07-11 Thread Desmond Cheong Zhi Xi
In preparation for a future patch to take a lock on drm_device.master_mutex inside drm_is_current_master(), we first move the call to drm_is_current_master() in drm_mode_getconnector out from the section locked by >mode_config.mutex. This avoids creating a circular lock dependency. Failing to

[PATCH v8 0/5] drm: address potential UAF bugs with drm_master ptrs

2021-07-11 Thread Desmond Cheong Zhi Xi
Hi, In the previous thread on this series we decided to remove a patch that was violating a lockdep requirement in drm_lease. In addition to this change, I took a closer look at the CI logs for the Basic Acceptance Tests and noticed that another regression was introduced. The new patch 2 is a

Re: [v1] drm/msm/disp/dpu1: add safe lut config in dpu driver

2021-07-11 Thread Sai Prakash Ranjan
On 2021-07-09 16:10, Kalyan Thota wrote: Add safe lut configuration for all the targets in dpu driver as per QOS recommendation. Issue reported on SC7280: With wait-for-safe feature in smmu enabled, RT client buffer levels are checked to be safe before smmu invalidation. Since display was

Re: drm/amd/display: Simplify hdcp validate_bksv

2021-07-11 Thread kernel test robot
Hi Joe, I love your patch! Yet something to improve: [auto build test ERROR on drm-intel/for-linux-next] [also build test ERROR on drm-tip/drm-tip drm-exynos/exynos-drm-next linus/master v5.14-rc1 next-20210709] [cannot apply to kees/for-next/pstore tegra-drm/drm/tegra/for-next drm/drm-next]

[PATCH v2, 0/3] drm/mediatek: Separate aal module

2021-07-11 Thread Yongqiang Niu
Chnage since v1: - seprate patch - keep gamma register setting with cpu Yongqiang Niu (3): drm/mediatek: Separate aal module drm/mediatek: add mt8183 aal support arm64: dts: mt8183: refine aal compatible name arch/arm64/boot/dts/mediatek/mt8183.dtsi| 3 +-

[PATCH v2, 2/3] drm/mediatek: add mt8183 aal support

2021-07-11 Thread Yongqiang Niu
This patch add mt8183 private data Signed-off-by: Yongqiang Niu --- drivers/gpu/drm/mediatek/mtk_disp_aal.c | 1 + drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c

[PATCH v2, 1/3] drm/mediatek: Separate aal module

2021-07-11 Thread Yongqiang Niu
mt8183 aal has no gamma function Signed-off-by: Yongqiang Niu --- drivers/gpu/drm/mediatek/Makefile | 3 +- drivers/gpu/drm/mediatek/mtk_disp_aal.c | 166 drivers/gpu/drm/mediatek/mtk_disp_drv.h | 9 ++

[PATCH v2, 3/3] arm64: dts: mt8183: refine aal compatible name

2021-07-11 Thread Yongqiang Niu
mt8183 aal is different with mt8173 remove mt8173 compatible name for mt8183 aal Signed-off-by: Yongqiang Niu --- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi

Re: drm/amd/display: Simplify hdcp validate_bksv

2021-07-11 Thread Joe Perches
On Mon, 2021-07-12 at 07:02 +0800, kernel test robot wrote: > Hi Joe, > > I love your patch! Yet something to improve: > > [auto build test ERROR on drm-intel/for-linux-next] > [also build test ERROR on drm-exynos/exynos-drm-next linus/master > next-20210709] > [cannot apply to

Re: drm/amd/display: Simplify hdcp validate_bksv

2021-07-11 Thread kernel test robot
Hi Joe, I love your patch! Yet something to improve: [auto build test ERROR on drm-intel/for-linux-next] [also build test ERROR on drm-exynos/exynos-drm-next linus/master next-20210709] [cannot apply to kees/for-next/pstore tegra-drm/drm/tegra/for-next drm/drm-next v5.13] [If your patch is

Re: [PATCH 0/4] vkms: Switch to shadow-buffered plane state

2021-07-11 Thread Melissa Wen
On 07/06, Thomas Zimmermann wrote: > Hi > > Am 05.07.21 um 23:29 schrieb Melissa Wen: > > On 07/05, Daniel Vetter wrote: > > > On Mon, Jul 05, 2021 at 12:05:28PM +0200, Thomas Zimmermann wrote: > > > > Hi > > > > > > > > Am 05.07.21 um 11:27 schrieb Daniel Vetter: > > > > > On Mon, Jul 05, 2021

drm/amd/display: Simplify hdcp validate_bksv

2021-07-11 Thread Joe Perches
commit 06888d571b51 ("drm/amd/display: Avoid HDCP over-read and corruption") fixed an overread with an invalid buffer length but added an unnecessary buffer and copy. Simplify the code by using a single uint64_t and __builtin_popcountll to count the number of bits set in the original bksv buffer

Re: [RESEND PATCH v4] drm/panel: simple: add SGD GKTW70SDAD1SD

2021-07-11 Thread Sam Ravnborg
Hi Oliver. On Sun, Jul 11, 2021 at 05:49:29PM +0200, Oliver Graute wrote: > Add support for the Solomon Goldentek Display Model: GKTW70SDAD1SD > to panel-simple. > > The panel spec from Variscite can be found at: > https://www.variscite.com/wp-content/uploads/2017/12/VLCD-CAP-GLD-RGB.pdf > >

Re: [PATCH] drm/amd/display: Fix identical code for different branches

2021-07-11 Thread Joe Perches
On Sun, 2021-07-11 at 19:24 +0200, Len Baker wrote: > The branches of the "if" statement are the same. So remove the > unnecessary if and goto statements. > > Addresses-Coverity-ID: 1456916 ("Identical code for different branches") > Fixes: 4c283fdac08ab ("drm/amd/display: Add HDCP module") >

[PATCH] drm/amd/display: Fix identical code for different branches

2021-07-11 Thread Len Baker
The branches of the "if" statement are the same. So remove the unnecessary if and goto statements. Addresses-Coverity-ID: 1456916 ("Identical code for different branches") Fixes: 4c283fdac08ab ("drm/amd/display: Add HDCP module") Signed-off-by: Len Baker ---

Re: [RFC PATCH v2 1/4] drm_print.h: rewrap __DRM_DEFINE_DBG_RATELIMITED macro

2021-07-11 Thread Joe Perches
On Sat, 2021-07-10 at 23:49 -0600, Jim Cromie wrote: > whitespace only, to diff-minimize a later commit. > no functional changes [] > diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h [] > @@ -524,19 +524,24 @@ void __drm_err(const char *format, ...); >  #define DRM_DEBUG_DP(fmt, ...)

[RESEND PATCH v4] drm/panel: simple: add SGD GKTW70SDAD1SD

2021-07-11 Thread Oliver Graute
Add support for the Solomon Goldentek Display Model: GKTW70SDAD1SD to panel-simple. The panel spec from Variscite can be found at: https://www.variscite.com/wp-content/uploads/2017/12/VLCD-CAP-GLD-RGB.pdf Signed-off-by: Oliver Graute Reviewed-by: Marco Felsch Reviewed-by: Fabio Estevam ---

[PATCH v5 2/2] habanalabs: add support for dma-buf exporter

2021-07-11 Thread Oded Gabbay
From: Tomer Tayar Implement the calls to the dma-buf kernel api to create a dma-buf object backed by FD. We block the option to mmap the DMA-BUF object because we don't support DIRECT_IO and implicit P2P. We only implement support for explicit P2P through importing the FD of the DMA-BUF. In

[PATCH v5 1/2] habanalabs: define uAPI to export FD for DMA-BUF

2021-07-11 Thread Oded Gabbay
User process might want to share the device memory with another driver/device, and to allow it to access it over PCIe (P2P). To enable this, we utilize the dma-buf mechanism and add a dma-buf exporter support, so the other driver can import the device memory and access it. The device memory is

[PATCH v5 0/2] Add p2p via dmabuf to habanalabs

2021-07-11 Thread Oded Gabbay
Hi, This is v5 of this patch-set following again a long email thread. It contains fixes to the implementation according to the review that Jason did on v4. Jason, I appreciate your feedback. If you can take another look to see I didn't miss anything that would be great. The details of the fixes

[PATCH] drm/amd/display: Fix identical code for different branches

2021-07-11 Thread Len Baker
The ternary expression: vrr->state == VRR_STATE_ACTIVE_VARIABLE ? max_refresh : max_refresh; has identical then and else expressions. So, simplify the code. Addresses-Coverity-ID: 1471122 ("Identical code for different branches") Fixes: 9bc4162665827 ("drm/amd/display: Implement VSIF V3

Re: [PATCH 1/1] drm: bridge: Mark deprecated operations in drm_bridge_funcs

2021-07-11 Thread Sam Ravnborg
On Sun, Jul 11, 2021 at 11:16:44AM +0200, Sam Ravnborg wrote: > drm_bridge_funcs includes several duplicated operations as atomic > variants has been added over time. > New bridge drivers shall use the atomic variants - mark the deprecated > operations to try to avoid usage in new bridge drivers.

[PATCH v1 2/2] drm/atmel-hlcdc: Convert to Linux IRQ interfaces

2021-07-11 Thread Sam Ravnborg
The drm mid-layer for irq's is not relevant for atomic display drivers, and will be available only for legacy drivers in the future. Drop usage in the atmel hlcdc driver. Signed-off-by: Sam Ravnborg Cc: Sam Ravnborg Cc: Boris Brezillon Cc: Nicolas Ferre Cc: Alexandre Belloni Cc: Ludovic

[PATCH v1 1/2] drm/atmel-hlcdc: Move interrupt helper funtions

2021-07-11 Thread Sam Ravnborg
This is in preparation for removal of drm_irq use. Functions are moved without any other changes. Signed-off-by: Sam Ravnborg Cc: Sam Ravnborg Cc: Boris Brezillon Cc: Nicolas Ferre Cc: Alexandre Belloni Cc: Ludovic Desroches Cc: linux-arm-ker...@lists.infradead.org ---

[PATCH v1 0/2] drm/atmel-hlcdc: drop use of drm_irq mid-layer

2021-07-11 Thread Sam Ravnborg
[Ignore the first mail - wrong patch was attached] Two small patches to drop the use of the drm irq mid-layer. My atmel hlcdc target has stopped working - so unfortunately un-tested :-( I picked up this to continue the work of Thomas Zimmermann. Sam Sam Ravnborg (2):

[PATCH 1/1] drm: bridge: Mark deprecated operations in drm_bridge_funcs

2021-07-11 Thread Sam Ravnborg
drm_bridge_funcs includes several duplicated operations as atomic variants has been added over time. New bridge drivers shall use the atomic variants - mark the deprecated operations to try to avoid usage in new bridge drivers. Signed-off-by: Sam Ravnborg Cc: Laurent Pinchart Cc: Andrzej Hajda

[PATCH v1 0/2] drm/atmel-hlcdc: drop use of drm_irq mid-layer

2021-07-11 Thread Sam Ravnborg
Two small patches to drop the use of the drm irq mid-layer. My atmel hlcdc target has stopped working - so unfortunately un-tested :-( I picked up this to continue the work of Thomas Zimmermann. Sam Sam Ravnborg (2): drm/atmel-hlcdc: Move interrupt helper funtions

[PATCH] drivers:gpu:drm:selftests: cleanup __FUNCTION__ usage

2021-07-11 Thread Dwaipayan Ray
__FUNCTION__ exists only for backwards compatibility reasons with old gcc versions. Replace it with __func__. Signed-off-by: Dwaipayan Ray --- drivers/gpu/drm/selftests/test-drm_modeset_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[RFC PATCH v2 0/4] Allow using dyndbg to replace drm_debug_enabled

2021-07-11 Thread Jim Cromie
drm_debug_enabled() is called a lot to do unlikely bit-tests to control debug printing; this is a good job for dynamic-debug, IFF it is built with JUMP_LABEL. Enable the use of dynamic-debug to avoid drm_debug_enabled() overheads, opt in with CONFIG_DRM_USE_DYNAMIC_DEBUG=y. I have this patchset

[RFC PATCH v2 2/4] drm: fixup comment spelling

2021-07-11 Thread Jim Cromie
s/prink/printk/ - no functional changes --- include/drm/drm_print.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 6419b4e7c5dc..4559583bc88b 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -327,7

[RFC PATCH v2 4/4] i915: map gvt pr_debug categories to bits in parameters/debug_gvt

2021-07-11 Thread Jim Cromie
The gvt component of this driver has ~120 pr_debugs, in 9 "classes". Following the interface model of drm.debug, add a parameter to map bits to these classes. If CONFIG_DRM_USE_DYNAMIC_DEBUG=y (and CONFIG_DYNAMIC_DEBUG_CORE), add -DDYNAMIC_DEBUG_MODULE into Makefile. TBD: maybe add a separate

[RFC PATCH v2 3/4] drm: RFC add choice to use dynamic debug in drm-debug

2021-07-11 Thread Jim Cromie
drm's debug system uses distinct categories of debug messages, encoded in an enum (DRM_UT_), which are mapped to bits in drm.debug. drm_debug_enabled() does a lot of unlikely bit-mask checks on drm.debug; we can use dynamic debug instead, and get all that static_key/jump_label goodness. Dynamic

[RFC PATCH v2 1/4] drm_print.h: rewrap __DRM_DEFINE_DBG_RATELIMITED macro

2021-07-11 Thread Jim Cromie
whitespace only, to diff-minimize a later commit. no functional changes --- include/drm/drm_print.h | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 9b66be54dd16..6419b4e7c5dc 100644 ---

[PATCHi v3] drm/mediatek: adjust rdma fifo threshold calculate formula

2021-07-11 Thread Yongqiang Niu
Change since v2: - add more commit message Yongqiang Niu (1): drm/mediatek: adjust rdma fifo threshold calculate formula drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 1.8.1.1.dirty

[PATCH v3] drm/mediatek: adjust rdma fifo threshold calculate formula

2021-07-11 Thread Yongqiang Niu
the orginal formula will caused rdma fifo threshold config overflow and no one could come out a solution for all SoC, set threshold to 70% of max fifo size to make sure it will not overflow, and 70% is a empirical vlaue Signed-off-by: Yongqiang Niu --- drivers/gpu/drm/mediatek/mtk_disp_rdma.c |