1201230 Commits

Author SHA1 Message Date
Ruan Jinjie
275e37221b drm/amdkfd: Remove unnecessary NULL values
The NULL initialization of the pointers assigned by kzalloc() first is
not necessary, because if the kzalloc() failed, the pointers will be
assigned NULL, otherwise it works as usual. so remove it.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:08:27 -04:00
Randy Dunlap
56dd5140eb drm/amd/display: dmub_replay: don't use kernel-doc markers
These functions don't use kernel-doc notation for comments so
don't begin each comment block with the "/**" kernel-doc marker.

This prevents a bunch of kernel-doc warnings:

dmub_replay.c:37: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
dmub_replay.c:37: warning: missing initial short description on line:
 * Get Replay state from firmware.
dmub_replay.c:66: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
dmub_replay.c:66: warning: missing initial short description on line:
 * Enable/Disable Replay.
dmub_replay.c:116: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
dmub_replay.c:116: warning: missing initial short description on line:
 * Set REPLAY power optimization flags.
dmub_replay.c:134: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
dmub_replay.c:134: warning: missing initial short description on line:
 * Setup Replay by programming phy registers and sending replay hw context values to firmware.
and 10 more similar warnings.

Fixes: c7ddc0a800bc ("drm/amd/display: Add Functions to enable Freesync Panel Replay")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Link: lore.kernel.org/r/202308081459.US5rLYAY-lkp@intel.com
Cc: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: Christian König <christian.koenig@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:08:27 -04:00
Mario Limonciello
d78c227fce drm/amd: Add amdgpu_hwmon_get_sensor_generic()
Many sensor function have a lot of boilerplate checks.  Move these
into a generic amdgpu_hwmon_get_sensor_generic() instead.

No intended functional changes.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:08:27 -04:00
Samir Dhume
8d72444288 drm/amdgpu/vcn: Add MMSCH v4_0_3 support for sriov
The structures are the same as v4_0 except for the
init header

Signed-off-by: Samir Dhume <samir.dhume@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:08:27 -04:00
Candice Li
b81fde0dfe drm/amdgpu: Add I2C EEPROM support on smu v13_0_6
Support I2C EEPROM on smu v13_0_6.

v2: Move IP_VERSION(13, 0, 6) ahead of IP_VERSION(13, 0, 10).

Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:08:27 -04:00
Tim Huang
258ee02e23 drm/amd/pm: bump SMU v13.0.5 driver_if header version
Align the SMU driver interface version with PMFW to
suppress the version mismatch message on driver loading.

Signed-off-by: Tim Huang <Tim.Huang@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:42 -04:00
Evan Quan
0514dda30f drm/amd/pm: correct the logics for retreiving SMU13 OD setting limits
To better meet the growing demainds for more OD features.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:42 -04:00
Evan Quan
b7cc5b421c drm/amd/pm: correct the way for checking custom OD settings
`FeatureCtrlMask` should not be included in those settings interested.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:42 -04:00
Lijo Lazar
669f237247 drm/amd/pm: Fix temperature unit of SMU v13.0.6
Temperature needs to be reported in millidegree Celsius.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:42 -04:00
Xiongfeng Wang
bdacd16afa drm/amd: Use pci_dev_id() to simplify the code
PCI core API pci_dev_id() can be used to get the BDF number for a pci
device. We don't need to compose it mannually. Use pci_dev_id() to
simplify the code a little bit.

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:42 -04:00
Jonathan Kim
8b4c350c4d drm/amdkfd: fix double assign skip process context clear
Remove redundant assignment when skipping process ctx clear.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:42 -04:00
Bhawanpreet Lakha
f51069bac6 drm/amd/display: Update replay for clk_mgr optimizations
Add Replay calls to clk_mgr updates (just like PSR)

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:42 -04:00
Srinivasan Shanmugam
d0d6928058 drm/amdgpu: Fix identifier names to function definition arguments in atom.h
Fixes the following:

WARNING: function definition argument 'struct card_info *' should also have an identifier name
WARNING: function definition argument 'uint32_t' should also have an identifier name
WARNING: function definition argument 'void *' should also have an identifier name
WARNING: function definition argument 'struct atom_context *' should also have an identifier name
WARNING: function definition argument 'int' should also have an identifier name
WARNING: function definition argument 'uint32_t *' should also have an identifier name
WARNING: Unnecessary space before function pointer name
ERROR: space prohibited after that '*' (ctx:BxW)
CHECK: Prefer kernel type 'u32' over 'uint32_t'

Cc: Guchun Chen <guchun.chen@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:42 -04:00
Umio Yasuno
e4538bc78b drm/amdgpu/pm: fix throttle_status for other than MP1 11.0.7
Use the right metrics table version based on the firmware.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2720
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Umio Yasuno <coelacanth_dream@protonmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:41 -04:00
YiPeng Chai
1b98a5f8e0 drm/amdgpu: mode1 reset needs to recover mp1 for mp0 v13_0_10
Mode1 reset needs to recover mp1 in fatal error case
for mp0 v13_0_10.

v2:
  Define a macro to wrap psp function calls.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:41 -04:00
Yang Wang
e01eeffc3f drm/amd/pm: avoid driver getting empty metrics table for the first time
add metrics.AccumulationCouter check to avoid driver getting an empty
metrics data since metrics table not updated completely in pmfw side.

Signed-off-by: Yang Wang <KevinYang.Wang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Tested-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:41 -04:00
Atul Raut
bd6040b0ea drm/amdkfd: Use memdup_user() rather than duplicating its implementation
To prevent its redundant implementation and streamline
code, use memdup_user.

This fixes warnings reported by Coccinelle:
./drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c:2811:13-20: WARNING opportunity for memdup_user

Signed-off-by: Atul Raut <rauji.raut@gmail.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:41 -04:00
Hawking Zhang
8b3a7a707c drm/amdgpu: Remove unnecessary ras cap check
RAS global isr will only be invoked by hardware
interrupt. Don't need to query ras capability in isr
In addition, amdgpu_ras_interrupt_fatal_error_handler
ensures the isr won't be called from guest linux
side by accident. The RAS cap check in isr that
introduced to fix sriov crash is not needed any more

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:41 -04:00
Arnd Bergmann
475968fe4a drm/amdkfd: fix build failure without CONFIG_DYNAMIC_DEBUG
When CONFIG_DYNAMIC_DEBUG is disabled altogether, calling
_dynamic_func_call_no_desc() does not work:

drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c: In function 'svm_range_set_attr':
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c:52:9: error: implicit declaration of function '_dynamic_func_call_no_desc' [-Werror=implicit-function-declaration]
   52 |         _dynamic_func_call_no_desc("svm_range_dump", svm_range_debug_dump, svms)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c:3564:9: note: in expansion of macro 'dynamic_svm_range_dump'
 3564 |         dynamic_svm_range_dump(svms);
      |         ^~~~~~~~~~~~~~~~~~~~~~

Add a compile-time conditional in addition to the runtime check.

Fixes: 8923137dbe4b ("drm/amdkfd: avoid svm dump when dynamic debug disabled")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 18:07:28 -04:00
Jiadong Zhu
1e9e15dcf4 drm/amdgpu: disable mcbp if parameter zero is set
The parameter amdgpu_mcbp shall have priority against the default value
calculated from the chip version.
User could disable mcbp by setting the parameter mcbp as zero.

v2: do not trigger preemption in sw ring muxer when mcbp is disabled.

Signed-off-by: Jiadong Zhu <Jiadong.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 17:44:02 -04:00
Srinivasan Shanmugam
ba4c1d772c drm/radeon: Fix multiple line dereference in 'atom_iio_execute'
Fixes the following:

WARNING: Avoid multiple line dereference - prefer 'ctx->io_attr'
+                           ((ctx->
+                             io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 -

Cc: Guchun Chen <guchun.chen@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 17:43:48 -04:00
Asad Kamal
707b570f42 drm/amd/pm: Add vclk and dclk sysnode for GC 9.4.3
Expose sysfs vclck and dclk entries for GC version 9.4.3

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 17:43:40 -04:00
Kenneth Feng
a57c6c365d drm/amd/pm: disallow the fan setting if there is no fan on smu 13.0.0
drm/amd/pm: disallow the fan setting if there is no fan on smu 13.0.0
V2: depend on pm.no_fan to check

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 17:43:33 -04:00
Jay Cornwall
a34cab4409 drm/amdkfd: Add missing tba_hi programming on aldebaran
Previously asymptomatic because high 32 bits were zero.

Fixes: 96c211f1f9ef ("drm/amdkfd: Relocate TBA/TMA to opposite side of VM hole")
Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 17:40:55 -04:00
Srinivasan Shanmugam
4c452b5c7d drm/amdgpu: Fix missing comment for mb() in 'amdgpu_device_aper_access'
This patch adds the missing code comment for memory barrier

WARNING: memory barrier without comment
+                       mb();

WARNING: memory barrier without comment
+                       mb();

Cc: Guchun Chen <guchun.chen@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 17:40:44 -04:00
Bhawanpreet Lakha
c84f512387 drm/amd/display: Add Replay supported/enabled checks
- Add checks for Cursor update and dirty rects (sending updates to dmub)
- Add checks for dc_notify_vsync, and fbc and subvp

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-15 17:40:31 -04:00
Dave Airlie
a8b273a8fd amdgpu:
- SDMA 6.1.0 support
 - SMU 13.x fixes
 - PSP 13.x fixes
 - HDP 6.1 support
 - SMUIO 14.0 support
 - IH 6.1 support
 - Coding style cleanups
 - Misc display fixes
 - Initial Freesync panel replay support
 - RAS fixes
 - SDMA 5.2 MGCG updates
 - SR-IOV fixes
 - DCN3+ gamma fix
 - Revert zpos properly until IGT regression is fixed
 - NBIO 7.9 fixes
 - Use TTM to manage the doorbell BAR
 - Async flip fix
 - DPIA tracing support
 - DCN 3.x TMDS HDMI fixes
 - FRU fixes
 
 amdkfd:
 - Coding style cleanups
 - SVM fixes
 - Trap handler fixes
 - Convert older APUs to use dGPU path like newer APUs
 - Drop IOMMUv2 path as it is no longer used
 
 radeon:
 - Coding style cleanups
 
 drm buddy:
 - Fix debugging output
 
 UAPI:
 - A new memory pool was added to amdgpu_drm.h since we converted doorbell BAR management to use TTM,
   but userspace is blocked from allocating from it at this point, so kind of not really anything new
   here per se
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQgO5Idg2tXNTSZAr293/aFa7yZ2AUCZNahZwAKCRC93/aFa7yZ
 2KNjAP0UV2vJZjrze7OQI/YoI+40UlGjS81nKGlMIN3eR8nzvAD/c9McLJViL82R
 idEAK7tsr/MaCKoPAlED7CkUZiHNlQw=
 =4w7I
 -----END PGP SIGNATURE-----

Merge tag 'amd-drm-next-6.6-2023-08-11' of https://gitlab.freedesktop.org/agd5f/linux into drm-next

amdgpu:
- SDMA 6.1.0 support
- SMU 13.x fixes
- PSP 13.x fixes
- HDP 6.1 support
- SMUIO 14.0 support
- IH 6.1 support
- Coding style cleanups
- Misc display fixes
- Initial Freesync panel replay support
- RAS fixes
- SDMA 5.2 MGCG updates
- SR-IOV fixes
- DCN3+ gamma fix
- Revert zpos properly until IGT regression is fixed
- NBIO 7.9 fixes
- Use TTM to manage the doorbell BAR
- Async flip fix
- DPIA tracing support
- DCN 3.x TMDS HDMI fixes
- FRU fixes

amdkfd:
- Coding style cleanups
- SVM fixes
- Trap handler fixes
- Convert older APUs to use dGPU path like newer APUs
- Drop IOMMUv2 path as it is no longer used

radeon:
- Coding style cleanups

drm buddy:
- Fix debugging output

UAPI:
- A new memory pool was added to amdgpu_drm.h since we converted doorbell BAR management to use TTM,
  but userspace is blocked from allocating from it at this point, so kind of not really anything new
  here per se

Signed-off-by: Dave Airlie <airlied@redhat.com>

# -----BEGIN PGP SIGNATURE-----
#
# iHUEABYKAB0WIQQgO5Idg2tXNTSZAr293/aFa7yZ2AUCZNahZwAKCRC93/aFa7yZ
# 2KNjAP0UV2vJZjrze7OQI/YoI+40UlGjS81nKGlMIN3eR8nzvAD/c9McLJViL82R
# idEAK7tsr/MaCKoPAlED7CkUZiHNlQw=
# =4w7I
# -----END PGP SIGNATURE-----
# gpg: Signature made Sat 12 Aug 2023 07:00:23 AEST
# gpg:                using EDDSA key 203B921D836B5735349902BDBDDFF6856BBC99D8
# gpg: Can't check signature: No public key
From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230811211554.7804-1-alexander.deucher@amd.com
2023-08-15 13:37:49 +10:00
Dave Airlie
73c98bf2fa Renesas R-Car DU miscellaneous changes
-----BEGIN PGP SIGNATURE-----
 
 iJgEABYKAEAWIQTAnvhxs4J7QT+XHKnMPy2AAyfeZAUCZNoM2SIcbGF1cmVudC5w
 aW5jaGFydEBpZGVhc29uYm9hcmQuY29tAAoJEMw/LYADJ95kwzYA/jNz4u3CzHVr
 kz6QGMhl/mIM5+iRRHI0hIMaKvpkVdmAAP4sDKPJn83oX7XGzDN3EyZsQZ617eAY
 SyqCBGhYMdUDCw==
 =YZ0i
 -----END PGP SIGNATURE-----

Merge tag 'drm-next-20230814' of git://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux into drm-next

Renesas R-Car DU miscellaneous changes

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230814130531.GC22929@pendragon.ideasonboard.com
2023-08-15 12:35:01 +10:00
Dave Airlie
e1f9c849b5 Mediatek DRM Next for Linux 6.6
1. Small mtk-dpi cleanups
 2. DisplayPort: support eDP and aux-bus
 3. Fix uninitialized symbol
 4. Do not check for 0 return after calling platform_get_irq()
 5. Convert to platform remove callback returning void
 6. Fix coverity issues
 7. Fix potential memory leak if vmap() fail
 8. Fix void-pointer-to-enum-cast warning
 9. Rid W=1 warnings from GPU
 -----BEGIN PGP SIGNATURE-----
 
 iQJMBAABCgA2FiEEACwLKSDmq+9RDv5P4cpzo8lZTiQFAmTY8+sYHGNodW5rdWFu
 Zy5odUBrZXJuZWwub3JnAAoJEOHKc6PJWU4k5IQP/0wR+da3Pg0pQMuPTc6bPwQL
 Wk7tMlUpdoExuhalIG7vkPmJqJLq/TpqnH6OKorRdqw2UmZE58pqJncN37drL1+C
 7s3YaABDQYTkxdwgAKXW6CF942ltuYqBd2Lc/wUP+tDCQLVzjb7l15aVFvlPmyy7
 u1hM1WWTEKlTMh+QTYickI9VQ2K1AHba/gxbIGFzN+eixB83ZFj5PfRL7T0Q3VSs
 WeZ9ep7k7zRfsxmgzZ+e+PBTO9eC9utas0b48dLgttoEBVh2kUAQ++J2lMmVin5k
 TIp7vgLkVzhIlS9eZq7Jkl7JvJxIoxMEY2zSbLkMfTf0VXv3KnIUhdP3voqmgxkG
 Nio9NDp4995hx5Qc1GFN7pdxRfISIK738LR2lM2bbEgiPcJy0yzTTctdNJ8s/SGK
 DQ6diSDJDKT7DPpSFlGWE21eDqAPY2e9iMFKPhkHKwSIrm+wUcvNeEGHgljvOXnV
 FdhQwjCqm/al33K7/oLlFUAifzpWcvrvpGMNSH0cU+AAVPNRUEJDgx9txMXLIZIQ
 F/19wloMPGgUfQ9upoDaqpgYWecLl4hQMgVnt1DyBi9rfbEB9PvnnScL2YLUm1wF
 YcilcE6Wm49J3RuySA/zFLGlkqIoT2m6N7YsaGT4LYqMK1d1lUf6GgYdch7+ILZz
 MhGPPfKMYd638xXLgwCA
 =Vku2
 -----END PGP SIGNATURE-----

Merge tag 'mediatek-drm-next-6.6' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux into drm-next

Mediatek DRM Next for Linux 6.6

1. Small mtk-dpi cleanups
2. DisplayPort: support eDP and aux-bus
3. Fix uninitialized symbol
4. Do not check for 0 return after calling platform_get_irq()
5. Convert to platform remove callback returning void
6. Fix coverity issues
7. Fix potential memory leak if vmap() fail
8. Fix void-pointer-to-enum-cast warning
9. Rid W=1 warnings from GPU

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230813152726.14802-1-chunkuang.hu@kernel.org
2023-08-15 12:07:19 +10:00
Dave Airlie
57bca71dce Merge tag 'drm-intel-gt-next-2023-08-11' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
Cross-subsystem Changes:

- Backmerge of drm-next

Driver Changes:

- Apply workaround 22016122933 correctly (Jonathan, Matt R)

- Simplify shmem_create_from_object map_type selection (Jonathan,
  Tvrtko)
- Make i915_coherent_map_type GT-centric (Jonathan, Matt R)

- Selftest improvements (John)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ZNYR3bKFquGc7u9w@jlahtine-mobl.ger.corp.intel.com
2023-08-15 11:53:32 +10:00
Damian Hobson-Garcia
9701845394 drm:rcar-du: Enable ABGR and XBGR formats
These formats are used by Android so having them available
allows the DU to be used for composition operations.

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2023-08-14 13:47:30 +03:00
Damian Hobson-Garcia
0dfcf80d41 drm: rcar-du: Add more formats to DRM_MODE_BLEND_PIXEL_NONE support
Add additional pixel formats for which blending is disabled when
DRM_MODE_BLEND_PIXEL_NONE is set.

Refactor the fourcc selection into a separate function to handle the
increased number of formats.

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2023-08-14 13:47:30 +03:00
Yangtao Li
6e6c74a4de drm/renesas: Convert to devm_platform_ioremap_resource()
Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2023-08-14 13:47:29 +03:00
Laurent Pinchart
f3651bc0b7 drm: rcar-du: Use dev_err_probe() to record cause of KMS init errors
The (large) rcar_du_modeset_init() function can fail for many reasons,
two of two involving probe deferral. Use dev_err_probe() in those code
paths to record the cause of the probe deferral, in order to help
debugging probe issues.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
2023-08-14 13:47:29 +03:00
Laurent Pinchart
c58dcab081 drm: rcar-du: Replace DRM_INFO() with drm_info()
drm_info() adds proper context to the kernel log message, as it receives
the drm_device pointer. It is thus preferred over DRM_INFO(). Replace
the latter with the former.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
2023-08-14 13:47:29 +03:00
Lee Jones
fb7e600df0 drm/mediatek/mtk_disp_ccorr: Remove half completed incorrect struct header
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/mediatek/mtk_disp_ccorr.c:47: warning: Function parameter or member 'clk' not described in 'mtk_disp_ccorr'
 drivers/gpu/drm/mediatek/mtk_disp_ccorr.c:47: warning: Function parameter or member 'regs' not described in 'mtk_disp_ccorr'
 drivers/gpu/drm/mediatek/mtk_disp_ccorr.c:47: warning: Function parameter or member 'cmdq_reg' not described in 'mtk_disp_ccorr'
 drivers/gpu/drm/mediatek/mtk_disp_ccorr.c:47: warning: Function parameter or member 'data' not described in 'mtk_disp_ccorr'

Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Lee Jones <lee@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230609081732.3842341-6-lee@kernel.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
2023-08-13 14:42:43 +00:00
Lee Jones
7bcb838c9a drm/mediatek/mtk_disp_aal: Remove half completed incorrect struct header
Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/mediatek/mtk_disp_aal.c:39: warning: Function parameter or member 'clk' not described in 'mtk_disp_aal'
 drivers/gpu/drm/mediatek/mtk_disp_aal.c:39: warning: Function parameter or member 'regs' not described in 'mtk_disp_aal'
 drivers/gpu/drm/mediatek/mtk_disp_aal.c:39: warning: Function parameter or member 'cmdq_reg' not described in 'mtk_disp_aal'
 drivers/gpu/drm/mediatek/mtk_disp_aal.c:39: warning: Function parameter or member 'data' not described in 'mtk_disp_aal'

Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Lee Jones <lee@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230609081732.3842341-5-lee@kernel.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
2023-08-13 14:40:23 +00:00
Jason-JH.Lin
89cba955f8 drm/mediatek: Fix void-pointer-to-enum-cast warning
1. Fix build warning message in mtk_disp_ovl_adaptor.c
>> drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c:415:10:
  warning: cast to smaller integer type 'enum mtk_ovl_adaptor_comp_type'
  from 'const void *' [-Wvoid-pointer-to-enum-cast]

  type = (enum mtk_ovl_adaptor_comp_type)of_id->data;

         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         1 warning generated.

2. Also fix the same warning message in mtk_drm_drv.c
>> drivers/gpu/drm/mediatek/mtk_drm_drv.c:832:15:
   warning: cast to smaller integer type 'enum mtk_ddp_comp_type'
   from 'const void *' [-Wvoid-pointer-to-enum-cast]

   comp_type = (enum mtk_ddp_comp_type)of_id->data;

               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
               1 warning generated.

Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Fixes: 453c3364632a ("drm/mediatek: Add ovl_adaptor support for MT8195")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202305042054.ZtWME9OU-lkp@intel.com/
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230621075421.1982-1-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
2023-08-13 14:33:59 +00:00
Sui Jingfeng
379091e0f6 drm/mediatek: Fix potential memory leak if vmap() fail
Also return -ENOMEM if such a failure happens, the implement should take
responsibility for the error handling.

Fixes: 3df64d7b0a4f ("drm/mediatek: Implement gem prime vmap/vunmap function")
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230706134000.130098-1-suijingfeng@loongson.cn/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
2023-08-13 14:26:13 +00:00
Alex Deucher
6be2ad4f00 drm/amdgpu: don't allow userspace to create a doorbell BO
We need the domains in amdgpu_drm.h for the kernel driver to manage
the pool, but we don't want userspace using it until the code
is ready.  So reject for now.

Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-11 14:48:07 -04:00
Alex Deucher
80e28aaf93 drm/amdkfd: rename device_queue_manager_init_v10_navi10()
Drop the navi10 in the name for consistency with other
families.  All gfx10 parts use the same implementation.

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-11 14:47:39 -04:00
Alex Deucher
c99a2e7ae2 drm/amdkfd: drop IOMMUv2 support
Now that we use the dGPU path for all APUs, drop the
IOMMUv2 support.

v2: drop the now unused queue manager functions for gfx7/8 APUs

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-11 14:47:25 -04:00
Alex Deucher
2b4adeb34f drm/amdkfd: disable IOMMUv2 support for Raven
Use the dGPU path instead.  There were a lot of platform
issues with IOMMU in general on these chips due to windows
not enabling IOMMU at the time.  The dGPU path has been
used for a long time with newer APUs and works fine.  This
also paves the way to simplify the driver significantly.

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-11 14:47:14 -04:00
Alex Deucher
99c1501996 drm/amdkfd: disable IOMMUv2 support for KV/CZ
Use the dGPU path instead.  There were a lot of platform
issues with IOMMU in general on these chips due to windows
not enabling IOMMU at the time.  The dGPU path has been
used for a long time with newer APUs and works fine.  This
also paves the way to simplify the driver significantly.

v2: use the dGPU queue manager functions

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-11 14:47:03 -04:00
Alex Deucher
95979df25b drm/amdkfd: ignore crat by default
We are dropping the IOMMUv2 path, so no need to enable this.
It's often buggy on consumer platforms anyway.

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2023-08-11 14:46:18 -04:00
Dave Airlie
2b9d7b6515 - Display SDVO fixes (Juha-Pekka, Jani)
- Taking Stolen handling out of FBC code (Jouni)
 - Replace acronym with full platform name in defines (Dnyaneshwar, A\
 nusha)
 - Display IRQ cleanups (Jani)
 - Initialize display version numbers (Luca)
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEbSBwaO7dZQkcLOKj+mJfZA7rE8oFAmTVQBgACgkQ+mJfZA7r
 E8q5GAgAiQEK+1neVQu63PlVh1+efNaf9IqeMDFq81sEqOVtoL2D9g3gtD1/8F79
 wp07gs39YQh8StwX4i6/fyGpcZ36Lxr7+1t9iZgESQI2L/qpfwgcyMqr1vNhlgVB
 TSjvHxL8X9RqqCALElKSNBXAsYYLlJkCdpUQA/6+7zpv1WlNTQMaciNtVKbpWgDD
 /qfll6ZfnqbC+wZCWyKV2dQQJ9UooFj5YJro/mZM/RfFyhYTb/7/MA5GUBAs+Du9
 +19LjTrcdXpD3lgieIGtLS2NBcWYiHktyn9teLb8bwpxCVsNv6p47YKaQJq93Viv
 xu7k0z3sc2FSaeUELG6lGD9jwDCi5g==
 =yfW9
 -----END PGP SIGNATURE-----

Merge tag 'drm-intel-next-2023-08-10' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

- Display SDVO fixes (Juha-Pekka, Jani)
- Taking Stolen handling out of FBC code (Jouni)
- Replace acronym with full platform name in defines (Dnyaneshwar, A\
nusha)
- Display IRQ cleanups (Jani)
- Initialize display version numbers (Luca)

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ZNVAR53jmvA1p6D5@intel.com
2023-08-11 16:33:16 +10:00
Dave Airlie
e6b17f5ce9 drm-misc-next for v6.6:
UAPI Changes:
 
  * nouveau:
    * Provide several GETPARAM ioctls
    * Provide VM_BIND ioctls
 
 Cross-subsystem Changes:
 
  * fbdev: Convert many drivers to fbdev I/O-memory helpers
 
  * media/vivid: Convert to fbdev I/O-memory helpers
 
  * vfio-dev/mdpy-fb: Convert to fbdev I/O-memory helpers
 
 Core Changes:
 
  * Documentation fixes
 
  * Do not select framebuffer console for fbdev emulation, fixes Kconfig
    dependencies
 
  * exec:
    * Add test cases for calling drm_exec() multiple times
    * Fix memory leak in sleftests
    * Build fixes
 
  * gem:
    * Fix lockdep checking
 
  * ttm:
    * Add Kunit tests
    * Cleanups
 
 Driver Changes:
 
  * atmel-hlcdc:
    * Support inverted pixclock polarity, required by several SoCs
 
  * bridge:
    * dw-hdmi: Update EDID on HDMI detection
    * sitronix-st7789v: Support panel orientation; Support rotation
                        property; Add support for Jasonic
  		       JT240MHQS-HWT-EK-E3 plus DT bindings; Minor
        		       fixes
 
  * ivpu:
    * Support VPU4
    * Refactorings
 
  * loongson:
    * Fixes
 
  * mcde:
    * Cleanups
 
  * nouveau:
    * Track GPU virtual memory via DRM GPUVA manager, enables Vulkan
      sparse binding/residency
 
  * panfrost:
    * Fix synchronization in IRQ handling
 
  * tve200:
    * Cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEchf7rIzpz2NEoWjlaA3BHVMLeiMFAmTUooEACgkQaA3BHVML
 eiPbvAgAuuPZVkIKqlVo05yNn8hpbj3iyTSQMvIrb5NTQe+hKh+ce3g41z3kxgRW
 +rShs6hVGupG671je/KbOvg+8qVpZSJwXJGY29dEVVQZ88/3EKON1H19RHm6TZvB
 GB2aL+KVjhCO+hK+K1LOs45ctG/VL+LsbCAcs4X2CiVNef41gyaeXpKjIP6NtEvs
 zxKrCw8q6YNl4Ou7zLSGvIMslA3apJRObcKiFKJS4Mc4Ynbz8nfBZgpVqbAAi8Df
 qYFAoPvbcOzn+MHSgbg41E0Mnje+qX8qGsTlTmikulunvxUdv9sqsGQ3dEw4N8iC
 wmBtCfOIv58cbcxgCwre74bjEozYJw==
 =FHJY
 -----END PGP SIGNATURE-----

Merge tag 'drm-misc-next-2023-08-10' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for v6.6:

UAPI Changes:

 * nouveau:
   * Provide several GETPARAM ioctls
   * Provide VM_BIND ioctls

Cross-subsystem Changes:

 * fbdev: Convert many drivers to fbdev I/O-memory helpers

 * media/vivid: Convert to fbdev I/O-memory helpers

 * vfio-dev/mdpy-fb: Convert to fbdev I/O-memory helpers

Core Changes:

 * Documentation fixes

 * Do not select framebuffer console for fbdev emulation, fixes Kconfig
   dependencies

 * exec:
   * Add test cases for calling drm_exec() multiple times
   * Fix memory leak in sleftests
   * Build fixes

 * gem:
   * Fix lockdep checking

 * ttm:
   * Add Kunit tests
   * Cleanups

Driver Changes:

 * atmel-hlcdc:
   * Support inverted pixclock polarity, required by several SoCs

 * bridge:
   * dw-hdmi: Update EDID on HDMI detection
   * sitronix-st7789v: Support panel orientation; Support rotation
                       property; Add support for Jasonic
 		       JT240MHQS-HWT-EK-E3 plus DT bindings; Minor
       		       fixes

 * ivpu:
   * Support VPU4
   * Refactorings

 * loongson:
   * Fixes

 * mcde:
   * Cleanups

 * nouveau:
   * Track GPU virtual memory via DRM GPUVA manager, enables Vulkan
     sparse binding/residency

 * panfrost:
   * Fix synchronization in IRQ handling

 * tve200:
   * Cleanups

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230810084505.GA14039@linux-uq9g
2023-08-11 16:28:51 +10:00
Dave Airlie
3defb4fe3e Fixup
- fix a possible null pointer dereference issue in
   exynos_drm_crtc_atomic_disable(), which was reported by
   the automatic static analysis tool. And below is a relevant link,
   https://sites.google.com/view/basscheck/home
 
 Cleanup
 - drop the use of of_match_ptr which is redundant.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEENRKOoF7NhdPGpscnVzg0iQxDErgFAmTTJb4ACgkQVzg0iQxD
 ErjFwRAAtamMqg683L2H8WoSHkINGydHQnUAvXMPvT09sD9k7NTKgzLGtmr5CWFV
 uMjrCZczwFrcbSUvnS8emFK/otNu69ozsS/hMEG9yY4QIOj29pjSP4E2PaGSTOyS
 zSCdTBunJXEtOPN4GjgqUAyCXYfus+dZkHmTVGfJQgVIPHSmJUJdXulm0gAX14/8
 uc3QU9hVN+f67pmyIeWZQ76JG6qTBH7jkYEldX9kAj+FIk+G6VbQWl8IkaglpxRK
 CghaWBfdnDCvxJq6ApzV4Eb7cGyC1CrmXObaUbGfOkAvOHrM3pKvV1YvpHhRILOd
 J0o4e8MAKw9gOXcVvehIRWfTq28SfnLs/JchP6Im8QVkl8kR80PRSvS0WASbgr2l
 FZn5FYyocDaTlQm0/JSlal0CdXLy7M37naITxBZTR/+6haLCjSfe/4Q9F9Rb1Kiw
 aXlOnShcPFMY5sIM9wgvcJvIBmJU4fkAywlHnR6VjeVV245VvnOIzJemzHzdm7ce
 L6ZzrZ6KM2AN4FkkZVd3QCjKdqKte257/EligSocsBf2B4gkeRj8dx9lgwmSUjjg
 hARM7qcn7n3xpx81bk31KMYXX2MtyxH0V6CUPzO/lGVPqH7aF4c4suAHZFvTl8qa
 HsAtken8EBGN6Tym+wHg5x9Ov6TBrBPJ/qV3+il1PcEdP0ev5fE=
 =ZP22
 -----END PGP SIGNATURE-----

Merge tag 'exynos-drm-next-for-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-next

Fixup
- fix a possible null pointer dereference issue in
  exynos_drm_crtc_atomic_disable(), which was reported by
  the automatic static analysis tool. And below is a relevant link,
  https://sites.google.com/view/basscheck/home

Cleanup
- drop the use of of_match_ptr which is redundant.

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Inki Dae <inki.dae@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230809060216.374042-1-inki.dae@samsung.com
2023-08-11 10:54:59 +10:00
Jason-JH.Lin
ed6adfb7d4 drm/mediatek: Fix dereference before null check
Null-checking state suggests that it may be null, but it has already
been dereferenced on drm_atomic_get_new_plane_state(state, plane).

The parameter state will never be NULL currently, so just remove the
state is NULL flow in this function.

Fixes: 5ddb0bd4ddc3 ("drm/atomic: Pass the full state to planes async atomic check and update")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230714094908.13087-5-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
2023-08-10 23:50:32 +00:00
Jason-JH.Lin
d761b9450e drm/mediatek: Add cnt checking for coverity issue
CERT-C Characters and Strings (CERT STR31-C)
all_drm_priv[cnt] evaluates to an address that could be at negative
offset of an array.

In mtk_drm_get_all_drm_priv():
Guarantee that storage for strings has sufficient space for character
data and the null terminator.

So change cnt to unsigned int and check its max value.

Fixes: 1ef7ed48356c ("drm/mediatek: Modify mediatek-drm for mt8195 multi mmsys support")
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230714094908.13087-3-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
2023-08-10 23:47:49 +00:00