linux-2.6-microblaze.git
15 months agoMerge tag 'drm-next-xilinx-20230802' of git://git.kernel.org/pub/scm/linux/kernel...
Dave Airlie [Mon, 7 Aug 2023 00:52:12 +0000 (10:52 +1000)]
Merge tag 'drm-next-xilinx-20230802' of git://git./linux/kernel/git/pinchartl/linux into drm-next

Miscellaneous fixes for the Xilinx zynqmp-dpsub driver

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230801224454.GB335@pendragon.ideasonboard.com
15 months agoMerge tag 'amd-drm-next-6.6-2023-07-28' of https://gitlab.freedesktop.org/agd5f/linux...
Daniel Vetter [Fri, 4 Aug 2023 09:10:18 +0000 (11:10 +0200)]
Merge tag 'amd-drm-next-6.6-2023-07-28' of https://gitlab.freedesktop.org/agd5f/linux into drm-next

amd-drm-next-6.6-2023-07-28:

amdgpu:
- Lots of checkpatch cleanups
- GFX 9.4.3 updates
- Add USB PD and IFWI flashing documentation
- GPUVM updates
- RAS fixes
- DRR fixes
- FAMS fixes
- Virtual display fixes
- Soft IH fixes
- SMU13 fixes
- Rework PSP firmware loading for other IPs
- Kernel doc fixes
- DCN 3.0.1 fixes
- LTTPR fixes
- DP MST fixes
- DCN 3.1.6 fixes
- SubVP fixes
- Display bandwidth calculation fixes
- VCN4 secure submission fixes
- Allow building DC on RISC-V
- Add visible FB info to bo_print_info
- HBR3 fixes
- Add PSP 14.0 support
- GFX9 MCBP fix
- GMC10 vmhub index fix
- GMC11 vmhub index fix
- Create a new doorbell manager
- SR-IOV fixes

amdkfd:
- Cleanup CRIU dma-buf handling
- Use KIQ to unmap HIQ
- GFX 9.4.3 debugger updates
- GFX 9.4.2 debugger fixes
- Enable cooperative groups fof gfx11
- SVM fixes

radeon:
- Lots of checkpatch cleanups

Merge conflicts:
- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
The switch to drm eu helpers in 8a206685d36f ("drm/amdgpu: use
drm_exec for GEM and CSA handling v2") clashed with the
cosmetic cleanups from 30953c4d000b ("drm/amdgpu: Fix style
issues in amdgpu_gem.c"). I
kept the former since the cleanup up code is gone.
- drivers/gpu/drm/amd/amdgpu/atom.c.
adf64e214280 ("drm/amd: Avoid reading the VBIOS part number
twice") removed code that 992b8fe106ab ("drm/radeon: Replace
all non-returning strlcpy with strscpy") polished.

From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230728214228.8102-1-alexander.deucher@amd.com
[sima: some merge conflict wrangling as noted]
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
15 months agodrm: xlnx: zynqmp_dpsub: Use devm_platform_ioremap_resource_byname()
Li Zetao [Tue, 1 Aug 2023 08:32:20 +0000 (16:32 +0800)]
drm: xlnx: zynqmp_dpsub: Use devm_platform_ioremap_resource_byname()

Convert platform_get_resource_byname() + devm_ioremap_resource() to a
single call to devm_platform_ioremap_resource_byname(), as this is
exactly what this function does.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
15 months agodrm: xlnx: zynqmp_dpsub: Use dev_err_probe instead of dev_err
Wang Ming [Wed, 26 Jul 2023 11:57:56 +0000 (19:57 +0800)]
drm: xlnx: zynqmp_dpsub: Use dev_err_probe instead of dev_err

It is possible that dma_request_chan() returns EPROBE_DEFER, in which
case the driver defers probing without printing any message. Use
dev_err_probe() to record the probe deferral cause and ease debugging.

Signed-off-by: Wang Ming <machel@vivo.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
15 months agodrm: xlnx: zynqmp_dpsub: Add missing check for dma_set_mask
Jiasheng Jiang [Wed, 7 Jun 2023 02:05:29 +0000 (10:05 +0800)]
drm: xlnx: zynqmp_dpsub: Add missing check for dma_set_mask

Add check for dma_set_mask() and return the error if it fails.

Fixes: d76271d22694 ("drm: xlnx: DRM/KMS driver for Xilinx ZynqMP DisplayPort Subsystem")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
15 months agodrm/xlnx/zynqmp_dp: Fix function name zynqmp_dp_link_train() -> zynqmp_dp_train()
Lee Jones [Fri, 17 Mar 2023 08:16:45 +0000 (08:16 +0000)]
drm/xlnx/zynqmp_dp: Fix function name zynqmp_dp_link_train() -> zynqmp_dp_train()

Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/xlnx/zynqmp_dp.c:793: warning: expecting prototype for zynqmp_dp_link_train(). Prototype was for zynqmp_dp_train() instead

Signed-off-by: Lee Jones <lee@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
16 months agodrm/radeon: Prefer strscpy over strlcpy calls in radeon_atombios.c
Srinivasan Shanmugam [Wed, 26 Jul 2023 14:56:30 +0000 (20:26 +0530)]
drm/radeon: Prefer strscpy over strlcpy calls in radeon_atombios.c

Use the strscpy method instead of strlcpy method.

Fixes the below:

WARNING: Prefer strscpy over strlcpy

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amdgpu: correct vmhub index in GMC v10/11
Lang Yu [Wed, 26 Jul 2023 11:04:25 +0000 (19:04 +0800)]
drm/amdgpu: correct vmhub index in GMC v10/11

Align with new vmhub definition.

v2: use client_id == VMC to decide vmhub(Hawking)

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: Fix non-standard format specifiers in 'amdgpu_show_fdinfo'
Srinivasan Shanmugam [Wed, 26 Jul 2023 07:26:32 +0000 (12:56 +0530)]
drm/amdgpu: Fix non-standard format specifiers in 'amdgpu_show_fdinfo'

Fixes the following:

WARNING: %Lu is non-standard C, use %llu
+       seq_printf(m, "drm-client-id:\t%Lu\n", vm->immediate.fence_context);

WARNING: %Ld is non-standard C, use %lld
+               seq_printf(m, "drm-engine-%s:\t%Ld ns\n", amdgpu_ip_name[hw_ip],

Cc: Guchun Chen <guchun.chen@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amdgpu: set completion status as preempted for the resubmission
Jiadong Zhu [Wed, 26 Jul 2023 07:21:48 +0000 (15:21 +0800)]
drm/amdgpu: set completion status as preempted for the resubmission

The driver's CSA buffer is shared by all the ibs. When the high priority ib
is submitted after the preempted ib, CP overrides the ib_completion_status
as completed in the csa buffer. After that the preempted ib is resubmitted,
CP would clear some locals stored for ib resume when reading the completed
status, which causes gpu hang in some cases.

Always set status as preempted for those resubmitted ib instead of reading
everything from the CSA buffer.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2535
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2717
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>
16 months agodrm/radeon: Fix ENOSYS with better fitting error codes in radeon_gem.c
Srinivasan Shanmugam [Wed, 26 Jul 2023 14:10:27 +0000 (19:40 +0530)]
drm/radeon: Fix ENOSYS with better fitting error codes in radeon_gem.c

Replace the error code from 'ENOSYS' to 'EOPNOTSUPP' for unimplemented
radeon_gem_pread_ioctl & radeon_gem_pwrite_ioctl

Fixes the following:

WARNING: ENOSYS means 'invalid syscall nr' and nothing else.

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/radeon: Remove unnecessary NULL test before kfree in 'radeon_connector_free_edid'
Srinivasan Shanmugam [Wed, 26 Jul 2023 16:17:37 +0000 (21:47 +0530)]
drm/radeon: Remove unnecessary NULL test before kfree in 'radeon_connector_free_edid'

Fixes the below:

WARNING: kfree(NULL) is safe and this check is probably not required.

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amdgpu: Use parentheses for sizeof *numa_info in 'amdgpu_acpi_get_numa_info'
Srinivasan Shanmugam [Wed, 26 Jul 2023 15:12:00 +0000 (20:42 +0530)]
drm/amdgpu: Use parentheses for sizeof *numa_info in 'amdgpu_acpi_get_numa_info'

Fixes the below:

WARNING: sizeof *numa_info should be sizeof(*numa_info)

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/radeon: Prefer strscpy over strlcpy in 'radeon_combios_get_power_modes'
Srinivasan Shanmugam [Wed, 26 Jul 2023 14:42:11 +0000 (20:12 +0530)]
drm/radeon: Prefer strscpy over strlcpy in 'radeon_combios_get_power_modes'

strlcpy() reads the entire source buffer first. This read may exceed the
destination size limit. This is both inefficient and can lead to linear
read overflows if a source string is not NUL-terminated. The safe
replacement is strscpy() [1].

cleanup to remove the strlcpy() function entirely from the kernel [2].

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Fixes the following:

WARNING: Prefer strscpy over strlcpy
+                               strlcpy(info.type, name, sizeof(info.type));

WARNING: Prefer strscpy over strlcpy
+                               strlcpy(info.type, name, sizeof(info.type));

Cc: Guchun Chen <guchun.chen@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amdgpu: Fix unnecessary else after return in 'amdgpu_eeprom_xfer'
Srinivasan Shanmugam [Wed, 26 Jul 2023 07:11:17 +0000 (12:41 +0530)]
drm/amdgpu: Fix unnecessary else after return in 'amdgpu_eeprom_xfer'

Fixes the following:

WARNING: else is not generally useful after a break or return
+               return -EINVAL;
+       } else {

Cc: Guchun Chen <guchun.chen@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amdgpu/discovery: enable PSP 14.0.0 support
Li Ma [Tue, 18 Jul 2023 21:48:04 +0000 (17:48 -0400)]
drm/amdgpu/discovery: enable PSP 14.0.0 support

Add it to IP discovery.

Signed-off-by: Li Ma <li.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: add PSP 14.0.0 support
Li Ma [Tue, 18 Jul 2023 21:47:06 +0000 (17:47 -0400)]
drm/amdgpu: add PSP 14.0.0 support

Uses same driver interface as 13.0.

Signed-off-by: Li Ma <li.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/radeon: Fix format error
Yonggang Wu [Tue, 25 Jul 2023 04:43:48 +0000 (12:43 +0800)]
drm/radeon: Fix format error

Fix the error(s):

ERROR: space required before the open parenthesis '('

Signed-off-by: Yonggang Wu <wuyonggang001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdkfd: fix and enable ttmp setup for gfx11
Jonathan Kim [Mon, 12 Jun 2023 15:31:07 +0000 (11:31 -0400)]
drm/amdkfd: fix and enable ttmp setup for gfx11

The MES cached process context must be cleared on adding any queue for
the first time.

For proper debug support, the MES will clear it's cached process context
on the first call to SET_SHADER_DEBUGGER.

This allows TTMPs to be pesistently enabled in a safe manner.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Eric Huang <jinhuieric@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: Move externs to amdgpu.h file from amdgpu_drv.c
Srinivasan Shanmugam [Tue, 25 Jul 2023 04:39:42 +0000 (10:09 +0530)]
drm/amdgpu: Move externs to amdgpu.h file from amdgpu_drv.c

Fixes the following:

WARNING: externs should be avoided in .c files
+extern const struct attribute_group amdgpu_vram_mgr_attr_group;

WARNING: externs should be avoided in .c files
+extern const struct attribute_group amdgpu_gtt_mgr_attr_group;

WARNING: externs should be avoided in .c files
+extern const struct attribute_group amdgpu_flash_attr_group;

And other style fixes:

WARNING: Block comments should align the * on each line
WARNING: void function return statements are not generally useful
WARNING: braces {} are not necessary for single statement blocks

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amdgpu: Prefer dev_* variant over printk in amdgpu_atpx_handler.c
Srinivasan Shanmugam [Tue, 25 Jul 2023 13:04:49 +0000 (18:34 +0530)]
drm/amdgpu: Prefer dev_* variant over printk in amdgpu_atpx_handler.c

Changed from printk to dev_* variants so that
we get better debug info when there are multiple GPUs
in the system.

Fixes other style issue:

ERROR: open brace '{' following function definitions go on the next line
WARNING: printk() should include KERN_<LEVEL> facility level

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amdgpu: Fix no new typedefs for enum _AMDGPU_DOORBELL_*
Srinivasan Shanmugam [Tue, 25 Jul 2023 11:59:19 +0000 (17:29 +0530)]
drm/amdgpu: Fix no new typedefs for enum _AMDGPU_DOORBELL_*

Fixes the following:

WARNING: do not add new typedefs

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: Fix ENOSYS means 'invalid syscall nr' in amdgpu_device.c
Srinivasan Shanmugam [Sun, 23 Jul 2023 06:00:47 +0000 (11:30 +0530)]
drm/amdgpu: Fix ENOSYS means 'invalid syscall nr' in amdgpu_device.c

ENOSYS should be used for nonexistent syscalls only, replace ENOSYS with
EOPNOTSUPP for reset handlers that are not implemented for respective ASIC.

WARNING: ENOSYS means 'invalid syscall nr' and nothing else
+       if (r == -ENOSYS)

WARNING: ENOSYS means 'invalid syscall nr' and nothing else
+       if (r == -ENOSYS)

And other following style fixes in amdgpu_device.c:

WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
WARNING: Block comments should align the * on each line
WARNING: Missing a blank line after declarations
WARNING: braces {} are not necessary for single statement blocks

Cc: Lijo Lazar <lijo.lazar@amd.com>
Cc: Kent Russell <kent.russell@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: remove repeat code for mes_add_queue_pkt
Bob Zhou [Mon, 24 Jul 2023 02:46:35 +0000 (10:46 +0800)]
drm/amdgpu: remove repeat code for mes_add_queue_pkt

The setting of mes_add_queue_pkt is repeated, so remove it.

Signed-off-by: Bob Zhou <bob.zhou@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: Checkpoint and Restore VRAM BOs without VA
Ramesh Errabolu [Fri, 21 Jul 2023 23:00:41 +0000 (18:00 -0500)]
drm/amdgpu: Checkpoint and Restore VRAM BOs without VA

Extend checkpoint logic to allow inclusion of VRAM BOs that
do not have a VA attached

Signed-off-by: Ramesh Errabolu <Ramesh.Errabolu@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: enable trap of each kfd vmid for gfx v9.4.3
Eric Huang [Tue, 25 Jul 2023 17:54:42 +0000 (13:54 -0400)]
drm/amdgpu: enable trap of each kfd vmid for gfx v9.4.3

To setup ttmp on as default for gfx v9.4.3 in IP hw init.

Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
Reviewed-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/pm: open brace '{' following struct go on the same line
Ran Sun [Mon, 24 Jul 2023 09:08:19 +0000 (17:08 +0800)]
drm/amd/pm: open brace '{' following struct go on the same line

ERROR: open brace '{' following struct go on the same line

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/pm: open brace '{' following function definitions go on the next line
Ran Sun [Mon, 24 Jul 2023 08:44:02 +0000 (16:44 +0800)]
drm/amd/pm: open brace '{' following function definitions go on the next line

ERROR: open brace '{' following function definitions go on the next line

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/pm: that open brace { should be on the previous line
Ran Sun [Mon, 24 Jul 2023 08:42:07 +0000 (16:42 +0800)]
drm/amd/pm: that open brace { should be on the previous line

ERROR: that open brace { should be on the previous line

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/pm: Clean up errors in arcturus_ppt.c
Ran Sun [Mon, 24 Jul 2023 07:49:11 +0000 (15:49 +0800)]
drm/amd/pm: Clean up errors in arcturus_ppt.c

Fix the following errors reported by checkpatch:

ERROR: "foo* bar" should be "foo *bar"
ERROR: spaces required around that '=' (ctx:VxW)
ERROR: space prohibited before that close parenthesis ')'

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/pm: Clean up errors in arcturus_ppt.c
Ran Sun [Mon, 24 Jul 2023 07:32:43 +0000 (15:32 +0800)]
drm/amd/pm: Clean up errors in arcturus_ppt.c

Fix the following errors reported by checkpatch:

ERROR: spaces required around that '=' (ctx:VxW)
ERROR: spaces required around that '>=' (ctx:WxV)

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/pm: Clean up errors in navi10_ppt.c
Ran Sun [Mon, 24 Jul 2023 07:21:01 +0000 (15:21 +0800)]
drm/amd/pm: Clean up errors in navi10_ppt.c

Fix the following errors reported by checkpatch:

ERROR: open brace '{' following function definitions go on the next line
ERROR: space required before the open parenthesis '('
ERROR: space required after that ',' (ctx:VxV)
ERROR: spaces required around that '=' (ctx:VxW)

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/pm: add missing spaces before '('
Ran Sun [Mon, 24 Jul 2023 07:02:18 +0000 (15:02 +0800)]
drm/amd/pm: add missing spaces before '('

ERROR: space required before the open parenthesis '('

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/radeon: Move assignment outside if condition
Ran Sun [Mon, 24 Jul 2023 03:44:56 +0000 (11:44 +0800)]
drm/radeon: Move assignment outside if condition

Fixes the following checkpatch errors:

ERROR: do not use assignment in if condition

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/radeon: that open brace { should be on the previous line
Ran Sun [Mon, 24 Jul 2023 03:40:33 +0000 (11:40 +0800)]
drm/radeon: that open brace { should be on the previous line

ERROR: that open brace { should be on the previous line

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/radeon: that open brace { should be on the previous line
Ran Sun [Mon, 24 Jul 2023 03:36:59 +0000 (11:36 +0800)]
drm/radeon: that open brace { should be on the previous line

ERROR: that open brace { should be on the previous line

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/radeon: add missing spaces after ',' and else should follow close brace '}'
Ran Sun [Mon, 24 Jul 2023 03:30:18 +0000 (11:30 +0800)]
drm/radeon: add missing spaces after ',' and else should follow close brace '}'

ERROR: else should follow close brace '}'

ERROR: space required after that ',' (ctx:VxV)

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agoMerge tag 'drm-misc-next-2023-07-27' of git://anongit.freedesktop.org/drm/drm-misc...
Daniel Vetter [Thu, 27 Jul 2023 13:01:26 +0000 (15:01 +0200)]
Merge tag 'drm-misc-next-2023-07-27' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for v6.6:

UAPI Changes:

Cross-subsystem Changes:

 * dma-buf:
   * Documentation fixes

 * fbdev:
   * Make FB core selectable without drivers
   * Remove obsolete flags FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT
     from all drivers and <linux/fb.h>
   * Add helper macros and Kconfig tokens for DMA-allocated framebuffers
   * Cleanups

Core Changes:

 * Respect given gfp flags in drmm_kmalloc()

Driver Changes:

 * ast:
   * Cleanups

 * bridge:
   * anx7625: Locking fixes
 * tc358767: Fix hardware delays
   * Minor fixes and cleanups

 * exynos:
   * Use fbdev DMA helpers

 * komeda:
   * Always attach encoder

 * omapdrm:
   * Use fbdev DMA helpers

 * panel:
   * ld9040: Fix Kconfig dependency
   * Minor cleanups

 * ssd130x:
   * Fix allocation of temporary buffers
   * Fix pitch computation

 * tegra:
   * Use fbdev DMA helpers

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230727124444.GA5547@linux-uq9g
16 months agoMerge tag 'drm-misc-next-2023-07-21' of ssh://git.freedesktop.org/git/drm/drm-misc...
Daniel Vetter [Thu, 27 Jul 2023 08:49:56 +0000 (10:49 +0200)]
Merge tag 'drm-misc-next-2023-07-21' of ssh://git.freedesktop.org/git/drm/drm-misc into drm-next

drm-misc-next for 6.6:

UAPI Changes:
  - syncobj: New DRM_IOCTL_SYNCOBJ_EVENTFD ioctl

Cross-subsystem Changes:
  - Converge to use of_device_uevent()

Core Changes:
  - GPU VA Manager
  - improvements to make it clearer that drm_minor_type is uAPI

Driver Changes:
  - ssd130x: Improve intermediate buffer size computation
  - bridges:
    - adv7511: Fix low refresh rate
    - anx7625: Switch to macros instead of hardcoded values
  - panel:
    - ld9040: Backlight support, magic improved

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/urs7omo5xnhglztxgwgsslws7duqfj4jhzrtppaenuvdh2lwuz@4htm4iiqhkep
16 months agodma-buf: Fix the typo in DMA-BUF statistics doc
Luc Ma [Tue, 18 Jul 2023 11:16:34 +0000 (19:16 +0800)]
dma-buf: Fix the typo in DMA-BUF statistics doc

The kernel-doc for DMA-BUF statistics mentions /sys/kernel/dma-buf/buffers
but the correct path is /sys/kernel/dmabuf/buffers instead.

Signed-off-by: Luc Ma <luc@sietium.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/64b6749a.170a0220.3acab.2af9@mx.google.com
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
16 months agodrm/ssd130x: Allocate buffer in the plane's .atomic_check() callback
Javier Martinez Canillas [Wed, 26 Jul 2023 10:54:28 +0000 (12:54 +0200)]
drm/ssd130x: Allocate buffer in the plane's .atomic_check() callback

Drivers are not allowed to fail after drm_atomic_helper_swap_state() has
been called and the new atomic state is stored into the current sw state.

Since the struct ssd130x_device .data_array is allocated in the encoder's
.atomic_enable callback, the operation can fail and this is after the new
state has been stored. So it can break an atomic mode settings assumption.

Fix this by having custom helpers to allocate, duplicate and destroy the
plane state, that will take care of allocating and freeing these buffers.

Suggested-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230726105433.389740-2-javierm@redhat.com
16 months agodrm/ssd130x: Inline the ssd130x_buf_{alloc, free}() function helpers
Javier Martinez Canillas [Wed, 26 Jul 2023 10:54:27 +0000 (12:54 +0200)]
drm/ssd130x: Inline the ssd130x_buf_{alloc, free}() function helpers

There is only a single caller for both helper functions and these don't do
much other than allocate and free two buffers, so let's just inline them.

Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230726105433.389740-1-javierm@redhat.com
16 months agodrm/ast: Do not enable PCI resources multiple times
Thomas Zimmermann [Wed, 12 Jul 2023 13:08:10 +0000 (15:08 +0200)]
drm/ast: Do not enable PCI resources multiple times

Remove ast_init_pci_config() as the ast driver already enables the PCI
resources by calling pcim_enable_device().

Suggested-by: Sui Jingfeng <suijingfeng@loongson.cn>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Sui Jingfeng <suijingfeng@loongson.cn>
Link: https://patchwork.freedesktop.org/patch/msgid/20230712130826.3318-1-tzimmermann@suse.de
16 months agodrm/amdgpu: Restore HQD persistent state register
Lijo Lazar [Tue, 25 Jul 2023 05:30:08 +0000 (11:00 +0530)]
drm/amdgpu: Restore HQD persistent state register

On GFX v9.4.3, compute queue MQD is populated using the values in HQD
persistent state register. Hence don't clear the values on module
unload, instead restore it to the default reset value so that MQD is
initialized correctly during next module load. In particular, preload
flag needs to be set on compute queue MQD, otherwise it could cause
uninitialized values being used at device reset state resulting in EDC.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/radeon: add missing spaces before ';'
Ran Sun [Mon, 24 Jul 2023 03:00:04 +0000 (11:00 +0800)]
drm/radeon: add missing spaces before ';'

ERROR: space required after that ';' (ctx:BxV)

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/radeon/si_dpm: open brace '{' following struct go on the same line
Ran Sun [Mon, 24 Jul 2023 02:55:43 +0000 (10:55 +0800)]
drm/radeon/si_dpm: open brace '{' following struct go on the same line

ERROR: open brace '{' following struct go on the same line

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/pm: Vangogh: Add new gpu_metrics_v2_4 to acquire gpu_metrics
Wenyou Yang [Wed, 31 May 2023 02:16:47 +0000 (10:16 +0800)]
drm/amd/pm: Vangogh: Add new gpu_metrics_v2_4 to acquire gpu_metrics

To acquire the voltage and current info from gpu_metrics interface,
but gpu_metrics_v2_3 doesn't contain them, and to be backward compatible,
add new gpu_metrics_v2_4 structure.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Wenyou Yang <WenYou.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: load sdma ucode in the guest machine
YuanShang [Fri, 30 Jun 2023 08:40:28 +0000 (16:40 +0800)]
drm/amdgpu: load sdma ucode in the guest machine

[why]
User mode driver need to check the sdma ucode version to
see whether the sdma engine supports a new type of PM4 packet.
In SRIOV, sdma is loaded by the host. And, there is no way
to check the sdma ucode version of CHIP_NAVI12 and
CHIP_SIENNA_CICHLID of the host in the guest machine.

[how]
Load the sdma ucode for CHIP_NAVI12 and CHIP_SIENNA_CICHLID
in the guest machine.

Signed-off-by: YuanShang <YuanShang.Mao@amd.com>
Reviewed-By: Horace Chen <horace.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: Use seq_puts() instead of seq_printf()
Srinivasan Shanmugam [Sun, 23 Jul 2023 06:49:26 +0000 (12:19 +0530)]
drm/amdgpu: Use seq_puts() instead of seq_printf()

For a constant format without additional arguments, use seq_puts()
instead of seq_printf(). Also, it fixes the following warning.

WARNING: Prefer seq_puts to seq_printf

And other style fixes:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Block comments should align the * on each line

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amdgpu: Update min() to min_t() in 'amdgpu_info_ioctl'
Srinivasan Shanmugam [Sun, 23 Jul 2023 06:59:14 +0000 (12:29 +0530)]
drm/amdgpu: Update min() to min_t() in 'amdgpu_info_ioctl'

Fixes the following:

WARNING: min() should probably be min_t(size_t, size, sizeof(ip))
+               ret = copy_to_user(out, &ip, min((size_t)size, sizeof(ip)));

And other style fixes:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Missing a blank line after declarations

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amdgpu: Remove else after return in 'is_fru_eeprom_supported'
Srinivasan Shanmugam [Sun, 23 Jul 2023 06:34:13 +0000 (12:04 +0530)]
drm/amdgpu: Remove else after return in 'is_fru_eeprom_supported'

Expressions under 'else' branch under case 'CHIP_SIENNA_CICHLID' in
function 'is_fru_eeprom_supported' are executed whenever the expression
in 'if' is False. Otherwise, return from case occurs. Therefore, there
is no need in 'else', and it has been removed.

Fixes the following:

WARNING: else is not generally useful after a break or return
+                               return false;
+                       } else {

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amd/display: Remove else after return in 'dm_vblank_get_counter' & 'amdgpu_dm_bac...
Srinivasan Shanmugam [Sun, 23 Jul 2023 09:22:09 +0000 (14:52 +0530)]
drm/amd/display: Remove else after return in 'dm_vblank_get_counter' & 'amdgpu_dm_backlight_get_level'

Expressions under 'else' branch in function 'dm_vblank_get_counter' &
'amdgpu_dm_backlight_get_level' are executed whenever the expression in
'if' is False. Otherwise, return from function occurs. Therefore, there is
no need in 'else', and it has been removed.

Fixes the following:

WARNING: else is not generally useful after a break or return
+               return 0;
+       else {

WARNING: else is not generally useful after a break or return
+               return convert_brightness_to_user(&caps, avg);
+       } else {

Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: Add -ENOMEM error handling when there is no memory
Srinivasan Shanmugam [Sun, 23 Jul 2023 09:46:10 +0000 (15:16 +0530)]
drm/amdgpu: Add -ENOMEM error handling when there is no memory

Return -ENOMEM, when there is no sufficient dynamically allocated memory

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amdgpu: Check APU flag to disable RAS
Stanley.Yang [Fri, 21 Jul 2023 08:38:02 +0000 (16:38 +0800)]
drm/amdgpu: Check APU flag to disable RAS

Only disable RAS by default for aqua vanjaram on APU platform.

Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: fix the indexing issue during rlcg access ctrl init
Shiwu Zhang [Thu, 20 Jul 2023 07:25:15 +0000 (15:25 +0800)]
drm/amdgpu: fix the indexing issue during rlcg access ctrl init

In case that the GET_INST() is used for looping, only loops for the
times of actual num of xcc, otherwise GET_INST() will return the invalid
index, a.k.a -1

And also remove the redundant mask checking in case of GET_INST()

Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: add VISIBLE info in amdgpu_bo_print_info
Pierre-Eric Pelloux-Prayer [Wed, 21 Jun 2023 08:42:07 +0000 (10:42 +0200)]
drm/amdgpu: add VISIBLE info in amdgpu_bo_print_info

This allows tools to distinguish between VRAM and visible VRAM.

Use the opportunity to fix locking before accessing bo.

v2: squash in unused variable fix

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdkfd: avoid svm dump when dynamic debug disabled
Alex Sierra [Wed, 19 Jul 2023 21:20:58 +0000 (16:20 -0500)]
drm/amdkfd: avoid svm dump when dynamic debug disabled

Set dynamic_svm_range_dump macro to avoid iterating over SVM lists
from svm_range_debug_dump when dynamic debug is disabled. Otherwise,
it could drop performance, specially with big number of SVM ranges.
Make sure both svm_range_set_attr and svm_range_debug_dump functions
are dynamically enabled to print svm_range_debug_dump debug traces.

Signed-off-by: Alex Sierra <alex.sierra@amd.com>
Tested-by: Alex Sierra <alex.sierra@amd.com>
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/radeon: ERROR: "foo * bar" should be "foo *bar"
Ran Sun [Fri, 21 Jul 2023 06:10:32 +0000 (06:10 +0000)]
drm/radeon: ERROR: "foo * bar" should be "foo *bar"

Fix two occurrences of the checkpatch.pl error:
ERROR: "foo * bar" should be "foo *bar"

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: open brace '{' following struct go on the same line
Ran Sun [Fri, 21 Jul 2023 03:32:06 +0000 (11:32 +0800)]
drm/amdgpu: open brace '{' following struct go on the same line

ERROR: open brace '{' following struct go on the same line

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/pm: open brace '{' following struct go on the same line
Ran Sun [Fri, 21 Jul 2023 03:27:18 +0000 (11:27 +0800)]
drm/amd/pm: open brace '{' following struct go on the same line

ERROR: open brace '{' following struct go on the same line

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd: open brace '{' following struct go on the same line
Ran Sun [Fri, 21 Jul 2023 01:31:10 +0000 (09:31 +0800)]
drm/amd: open brace '{' following struct go on the same line

Fix the checkpatch error as open brace '{' following struct should
go on the same line.

Signed-off-by: Ran Sun <sunran001@208suo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Unlock on error path in dm_handle_mst_sideband_msg_ready_event()
Dan Carpenter [Fri, 21 Jul 2023 14:55:49 +0000 (17:55 +0300)]
drm/amd/display: Unlock on error path in dm_handle_mst_sideband_msg_ready_event()

This error path needs to unlock the "aconnector->handle_mst_msg_ready"
mutex before returning.

Fixes: bb4fa525f327 ("drm/amd/display: Add polling method to handle MST reply packet")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: 3.2.244
Aric Cyr [Mon, 17 Jul 2023 05:36:42 +0000 (01:36 -0400)]
drm/amd/display: 3.2.244

This version brings along following fixes:
- Fix underflow issue on 175hz timing
- Add interface to modify DMUB panel power options
- Remove check for default eDP panel_mode
- Add new sequence for 4-lane HBR3 on vendor specific retimers
- Update DPG test pattern programming
- Correct unit conversion for vstartup
- Exit idle optimizations before attempt to access PHY
- Refactor recout calculation with a more generic formula
- Read down-spread percentage from lut to adjust dprefclk.
- Don't apply FIFO resync W/A if rdivider = 0
- Prevent invalid pipe connections
- Rearrange dmub_cmd defs order
- Add VESA SCR case for default aux backlight
- Guard DCN31 PHYD32CLK logic against chip family
- Correct grammar mistakes

Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Fix underflow issue on 175hz timing
Leo Ma [Thu, 6 Jul 2023 20:17:03 +0000 (16:17 -0400)]
drm/amd/display: Fix underflow issue on 175hz timing

[Why]
Screen underflows happen on 175hz timing for 3 plane overlay case.

[How]
Based on dst y prefetch value clamp to equ or oto for bandwidth
calculation.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Leo Ma <hanghong.ma@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Add interface to modify DMUB panel power options
Paul Hsieh [Tue, 11 Jul 2023 08:07:52 +0000 (16:07 +0800)]
drm/amd/display: Add interface to modify DMUB panel power options

[Why]
This option can vary depending on the panel and may be required to be
called during sink detection phase before transmitter control.

[How]
Allow modify the bit depending on the eDP panel connected with a new
interface.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Paul Hsieh <paul.hsieh@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Rearrange dmub_cmd defs order
Anthony Koo [Mon, 17 Jul 2023 01:16:35 +0000 (21:16 -0400)]
drm/amd/display: Rearrange dmub_cmd defs order

 - Rearranged defs order

Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Anthony Koo <anthony.koo@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Remove check for default eDP panel_mode
Taimur Hassan [Fri, 14 Jul 2023 16:59:06 +0000 (12:59 -0400)]
drm/amd/display: Remove check for default eDP panel_mode

[Why]
DPCD read is skipped first time after driver initialization.

Reviewed-by: Charlene Liu <charlene.liu@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Taimur Hassan <syed.hassan@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: Fix style issues in amdgpu_gem.c
Srinivasan Shanmugam [Fri, 21 Jul 2023 08:33:53 +0000 (14:03 +0530)]
drm/amdgpu: Fix style issues in amdgpu_gem.c

Fixes the following to align to linux coding style:

WARNING: braces {} are not necessary for any arm of this statement
WARNING: Missing a blank line after declarations
ERROR: space prohibited before that close parenthesis ')'
WARNING: unnecessary whitespace before a quoted newline
WARNING: %LX is non-standard C, use %llX

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amd/display: Add new sequence for 4-lane HBR3 on vendor specific retimers
Ovidiu Bunea [Fri, 14 Jul 2023 16:00:16 +0000 (12:00 -0400)]
drm/amd/display: Add new sequence for 4-lane HBR3 on vendor specific retimers

[Why]
In some vendor specific retimer setups for downstream 4-lane HBR3
configuration, the sink will show severe corruption (horizontal shifting)
and intermittent blanking.

[How]
Add new retimer programming sequence before clock recovery when 4 lanes
are active.

Reviewed-by: Michael Strauss <michael.strauss@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Ovidiu Bunea <ovidiu.bunea@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Update DPG test pattern programming
Wenjing Liu [Thu, 13 Jul 2023 22:40:51 +0000 (18:40 -0400)]
drm/amd/display: Update DPG test pattern programming

[Why]
Last ODM slice could be slightly larger than other slice because it can be
including the residual.

[How]
Update DPG pattern programming sequence to use a different width for
last odm slice.

Reviewed-by: Chris Park <chris.park@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Correct unit conversion for vstartup
Reza Amini [Fri, 14 Jul 2023 14:43:05 +0000 (10:43 -0400)]
drm/amd/display: Correct unit conversion for vstartup

[Why]
vstartup is calculated to be a large number. It works because
it is within vertical blank, but it reduces region of blank that
can be used for power gating.

[How]
Calculation needs to convert micro seconds to number of
vertical lines.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Reza Amini <reza.amini@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Exit idle optimizations before attempt to access PHY
Leo Chen [Wed, 12 Jul 2023 20:50:15 +0000 (16:50 -0400)]
drm/amd/display: Exit idle optimizations before attempt to access PHY

[Why & How]
DMUB may hang when powering down pixel clocks due to no dprefclk.

It is fixed by exiting idle optimization before the attempt to access PHY.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Leo Chen <sancchen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Refactor recout calculation with a more generic formula
Wenjing Liu [Thu, 6 Jul 2023 19:00:11 +0000 (15:00 -0400)]
drm/amd/display: Refactor recout calculation with a more generic formula

[Why]
Current recout calculation has a few assumptions and implementation
for MPO + ODM combine calculation is very specific. The equation has
too many cases without enough comments to document the detail.

[How]
The change remove the following assumptions:
1. When MPO is enabled, we only allow ODM Combine 2:1
2. ODM Combine always has even segment width.
3. Secondary MPO plane's pipe_ctx copies pre_odm_pipe from
its top pipe.

The change applies a generic formula with more details in comment to
document this solution so it is eaiser to learn and debug later.

Reviewed-by: Dmytro Laktyushkin <dmytro.laktyushkin@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Read down-spread percentage from lut to adjust dprefclk.
Martin Tsai [Thu, 13 Jul 2023 01:54:51 +0000 (09:54 +0800)]
drm/amd/display: Read down-spread percentage from lut to adjust dprefclk.

[Why]
Panels show corruption with high refresh rate timings when
ss is enabled.

[How]
Read down-spread percentage from lut to adjust dprefclk.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Martin Tsai <martin.tsai@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Don't apply FIFO resync W/A if rdivider = 0
Alvin Lee [Wed, 12 Jul 2023 21:22:25 +0000 (17:22 -0400)]
drm/amd/display: Don't apply FIFO resync W/A if rdivider = 0

[Description]
It is not valid to set the WDIVIDER value to 0, so do not
re-write to DISPCLK_WDIVIDER if the current value is 0
(i.e., it is at it's initial value and we have not made any
requests to change DISPCLK yet).

Reviewed-by: Saaem Rizvi <syedsaaem.rizvi@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alvin Lee <alvin.lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Prevent invalid pipe connections
Ethan Bitnun [Wed, 12 Jul 2023 19:44:00 +0000 (15:44 -0400)]
drm/amd/display: Prevent invalid pipe connections

[Description]
 - Prevent ODM pipe connections between pipes that are not part
   of the same plane when adding a plane to context
 - Re-attach child pipes of ODM slice about to be disconnected
   to prevent any lost pipes with invalid tops/bottoms
 - We cannot split if head_pipe is not in ODM. Preventing this
   avoids creating an invalid context with an invalid pipe.

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Ethan Bitnun <ethan.bitnun@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: Update ring scheduler info as needed
Lijo Lazar [Tue, 18 Jul 2023 12:11:45 +0000 (17:41 +0530)]
drm/amdgpu: Update ring scheduler info as needed

Not all rings have scheduler associated. Only update scheduler data for
rings with scheduler. It could result in out of bound access as total
rings are more than those associated with particular IPs.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: Enabling FW workaround through shared memory for VCN4_0_2
sguttula [Fri, 14 Jul 2023 09:12:16 +0000 (14:42 +0530)]
drm/amdgpu: Enabling FW workaround through shared memory for VCN4_0_2

This patch will enable VCN FW workaround using
DRM KEY INJECT WORKAROUND method,
which is helping in fixing the secure playback.

Signed-off-by: sguttula <Suresh.Guttula@amd.com>
Reviewed-by: Leo Liu <leo.liiu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Add VESA SCR case for default aux backlight
Iswara Nagulendran [Mon, 10 Jul 2023 18:01:35 +0000 (14:01 -0400)]
drm/amd/display: Add VESA SCR case for default aux backlight

[How & Why]
When determining default aux backlight level, read from
DPCD address 0x734 for VESA SCR on OLED.

Reviewed-by: Felipe Clark <felipe.clark@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Iswara Nagulendran <iswara.nagulendran@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/radeon: Prefer dev_* variant over printk
Srinivasan Shanmugam [Thu, 20 Jul 2023 10:09:24 +0000 (15:39 +0530)]
drm/radeon: Prefer dev_* variant over printk

Changed from pr_err/info to dev_* variants so that
we get better debug info when there are multiple GPUs
in the system.

Fixes: 09edeb4c1680 ("drm/radeon: Prefer pr_err/_info over printk")
Suggested-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/radeon: Fix style issues in radeon _encoders.c & _gart.c
Srinivasan Shanmugam [Sat, 15 Jul 2023 05:42:20 +0000 (11:12 +0530)]
drm/radeon: Fix style issues in radeon _encoders.c & _gart.c

Conform to Linux kernel coding style.

Fixes the following & other checks in radeon_encoders.c & radeon_gart.c:

WARNING: Missing a blank line after declarations
WARNING: Block comments use * on subsequent lines
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: braces {} are not necessary for single statement blocks

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amd/amdgpu: Fix warnings in amdgpu/amdgpu_display.c
Srinivasan Shanmugam [Tue, 18 Jul 2023 06:58:37 +0000 (12:28 +0530)]
drm/amd/amdgpu: Fix warnings in amdgpu/amdgpu_display.c

Fixes the below checkpatch.pl warnings:

WARNING: Block comments use * on subsequent lines
WARNING: Block comments use a trailing */ on a separate line
WARNING: suspect code indent for conditional statements (8, 12)
WARNING: braces {} are not necessary for single statement blocks

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/radeon: Avoid externs & do not initialize globals to 0 in radeon_drv.c
Srinivasan Shanmugam [Sat, 15 Jul 2023 05:14:16 +0000 (10:44 +0530)]
drm/radeon: Avoid externs & do not initialize globals to 0 in radeon_drv.c

Fixes the following:

 - WARNING: externs should be avoided in .c files
 - ERROR: do not initialise globals to 0
 - WARNING: Missing a blank line after declarations

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amd/display: Guard DCN31 PHYD32CLK logic against chip family
George Shen [Tue, 11 Jul 2023 17:22:36 +0000 (13:22 -0400)]
drm/amd/display: Guard DCN31 PHYD32CLK logic against chip family

[Why]
Current yellow carp B0 PHYD32CLK logic is incorrectly applied to other
ASICs.

[How]
Add guard to check chip family is yellow carp before applying logic.

Reviewed-by: Hansen Dsouza <hansen.dsouza@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: George Shen <george.shen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/display: Correct grammar mistakes
Reza Amini [Mon, 10 Jul 2023 17:59:22 +0000 (13:59 -0400)]
drm/amd/display: Correct grammar mistakes

[Why]
There are grammer mistakes in comments

[How]
Correct grammar mistakes

Reviewed-by: Anthony Koo <anthony.koo@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Reza Amini <reza.amini@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amdgpu: Return -ENOMEM when there is no memory in 'amdgpu_gfx_mqd_sw_init'
Srinivasan Shanmugam [Fri, 21 Jul 2023 09:12:10 +0000 (14:42 +0530)]
drm/amdgpu: Return -ENOMEM when there is no memory in 'amdgpu_gfx_mqd_sw_init'

Return -ENOMEM, when there is no sufficient dynamically allocated memory
to create MQD backup for ring

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amdgpu: Fix do not add new typedefs in amdgpu_fw_attestation.c
Srinivasan Shanmugam [Fri, 21 Jul 2023 08:10:07 +0000 (13:40 +0530)]
drm/amdgpu: Fix do not add new typedefs in amdgpu_fw_attestation.c

Fixes the following to align to coding style:

WARNING: do not add new typedefs
+typedef struct FW_ATT_DB_HEADER

WARNING: do not add new typedefs
+typedef struct FW_ATT_RECORD

WARNING: Symbolic permissions 'S_IRUSR' are not preferred. Consider using octal permissions '0400'.
+                           S_IRUSR,

ERROR: "(foo*)" should be "(foo *)"
WARNING: please, no space before tabs

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amdgpu: Prefer #if IS_ENABLED over #if defined in amdgpu_drv.c
Srinivasan Shanmugam [Fri, 21 Jul 2023 07:45:41 +0000 (13:15 +0530)]
drm/amdgpu: Prefer #if IS_ENABLED over #if defined in amdgpu_drv.c

Adhere to linux coding style

Fixes the following:

WARNING: Prefer IS_ENABLED(<FOO>) to CONFIG_<FOO> || CONFIG_<FOO>_MODULE
+#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)

WARNING: Prefer IS_ENABLED(<FOO>) to CONFIG_<FOO> || CONFIG_<FOO>_MODULE
+#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@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>
16 months agodrm/amdkfd: enable cooperative groups for gfx11
Jonathan Kim [Wed, 12 Jul 2023 20:58:55 +0000 (16:58 -0400)]
drm/amdkfd: enable cooperative groups for gfx11

MES can concurrently schedule queues on the device that require
exclusive device access if marked exclusively_scheduled without the
requirement of GWS.  Similar to the F32 HWS, MES will manage
quality of service for these queues.
Use this for cooperative groups since cooperative groups are device
occupancy limited.

Since some GFX11 devices can only be debugged with partial CUs, do not
allow the debugging of cooperative groups on these devices as the CU
occupancy limit will change on attach.

In addition, zero initialize the MES add queue submission vector for MES
initialization tests as we do not want these to be cooperative
dispatches.

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>
16 months agodrm/amdgpu: set sw state to gfxoff after SR-IOV reset
Horace Chen [Wed, 19 Jul 2023 07:55:04 +0000 (15:55 +0800)]
drm/amdgpu: set sw state to gfxoff after SR-IOV reset

[Why]
Current SR-IOV will not set GC to off state, while it is a real
GC hard reset. Whthout GFX off flag, driver may do gfxhub invalidation
before firmware load and gfxhub gart enable. This operation may cause
CP to become busy because GC is not in the right state for invalidation.

[How]
Add a function for SR-IOV to clean up some sw state before recover. Set
adev->gfx.is_poweron to false to prevent gfxhub invalidation before gfx
firmware autoload complete.

Signed-off-by: Horace Chen <horace.chen@amd.com>
Reviewed-by: HaiJun Chang <HaiJun.Chang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/amd/smu: use AverageGfxclkFrequency* to replace previous GFX Curr Clock
Jane Jian [Thu, 20 Jul 2023 10:08:07 +0000 (18:08 +0800)]
drm/amd/smu: use AverageGfxclkFrequency* to replace previous GFX Curr Clock

Report current GFX clock also from average clock value as the original
CurrClock data is not valid/accurate any more as per FW team

Signed-off-by: Jane Jian <Jane.Jian@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 months agodrm/panel: ld9040: add backlight Kconfig dependency
Arnd Bergmann [Mon, 24 Jul 2023 12:17:05 +0000 (14:17 +0200)]
drm/panel: ld9040: add backlight Kconfig dependency

The driver now uses the backlight interface, which breaks when that
is disabled:

ld.lld: error: undefined symbol: devm_backlight_device_register

Enforce the necessary Kconfig dependency to avoid this.

Fixes: c2268daa65fb ("drm/panel: ld9040: Register a backlight device")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230724121736.1293270-1-arnd@kernel.org
16 months agofbdev: Harmonize some comments in <linux/fb.h>
Thomas Zimmermann [Fri, 7 Jul 2023 08:32:03 +0000 (10:32 +0200)]
fbdev: Harmonize some comments in <linux/fb.h>

Make the comments for I/O, system and DMA memory say the same.
Makes the header file's structure more obvious.

Suggested-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230707083422.18691-13-tzimmermann@suse.de
16 months agofbdev: Remove FB_DEFAULT_SYS_OPS
Thomas Zimmermann [Fri, 7 Jul 2023 08:32:02 +0000 (10:32 +0200)]
fbdev: Remove FB_DEFAULT_SYS_OPS

Remove the initializer macro FB_DEFAULT_SYS_OPS and its helper macro
__FB_DEFAULT_SYS_OPS_MMAP. There are no users.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Cc: Helge Deller <deller@gmx.de> (maintainer:FRAMEBUFFER LAYER)
Link: https://patchwork.freedesktop.org/patch/msgid/20230707083422.18691-12-tzimmermann@suse.de
16 months agodrm/omapdrm: Set fbdev FBINFO_VIRTFB flag
Thomas Zimmermann [Fri, 7 Jul 2023 08:32:01 +0000 (10:32 +0200)]
drm/omapdrm: Set fbdev FBINFO_VIRTFB flag

Mark the framebuffer with FBINFO_VIRTFB. The framebuffer range is
in DMA-able memory and should be accessed with the CPU's regular
memory ops.

v2:
* drop FBINFO_DEFAULT

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230707083422.18691-11-tzimmermann@suse.de
16 months agodrm/omapdrm: Use GEM mmap for fbdev emulation
Thomas Zimmermann [Fri, 7 Jul 2023 08:32:00 +0000 (10:32 +0200)]
drm/omapdrm: Use GEM mmap for fbdev emulation

The fbdev emulation currently uses fbdev's default mmap code, which
has been written for I/O memory. Provide an mmap that uses GEM's mmap
infrastructure.

Utilize fine-grained fbdev macros to initialize struct fb_ops. The
macros set the read/write and the draw callbacks for DMA memory. Set
the fb_mmap callback to omapdrm's new mmap helper. Also select the
correct Kconfig token for fbdev's DMA helpers. Note that the DMA
helpers are the same as for system memory.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230707083422.18691-10-tzimmermann@suse.de
16 months agodrm/omapdrm: Set VM flags in GEM-object mmap function
Thomas Zimmermann [Fri, 7 Jul 2023 08:31:59 +0000 (10:31 +0200)]
drm/omapdrm: Set VM flags in GEM-object mmap function

Use the mmap callback in struct drm_gem_object_funcs to set the
VM flags. Replace a number of mmap helpers in omapdrm with their
GEM helper counterparts. Generate DRM's file-operations instance
with GEM's DEFINE_DRM_GEM_FOPS.

The omapdrm driver uses DRM's drm_gem_mmap() helper to prepare
the VMA structure. It then modifies the resulting VMA state in
its own helper omap_gem_mmap_obj(). The patch improves this by
setting up the VMA in the mmap callback in drm_gem_object_funcs,
which is called from within drm_gem_mmap().

Omapdrm's omap_gem_mmap() and omap_gem_mmap() can then be removed
from the driver. A call to drm_gem_mmap() is sufficient for the
mmap operation.

Finally, with the omap functions gone, the drivers file_ops in
omapdriver_fops can be generated with DEFINE_DRM_GEM_FOPS, which
sets DRM's default helpers.

v2:
* detailed commit message (Javier)
* do not set VM_PFNMAP

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230707083422.18691-9-tzimmermann@suse.de
16 months agodrm/exynos: Set fbdev FBINFO_VIRTFB flag
Thomas Zimmermann [Fri, 7 Jul 2023 08:31:58 +0000 (10:31 +0200)]
drm/exynos: Set fbdev FBINFO_VIRTFB flag

Mark the framebuffer with FBINFO_VIRTFB. The framebuffer range is
in DMA-able memory and should be accessed with the CPU's regular
memory ops.

v2:
* drop FBINFO_FLAG_DEFAULT

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by : Inki Dae <inki.dae@samsung.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230707083422.18691-8-tzimmermann@suse.de
16 months agodrm/exynos: Use fbdev DMA helpers
Thomas Zimmermann [Fri, 7 Jul 2023 08:31:57 +0000 (10:31 +0200)]
drm/exynos: Use fbdev DMA helpers

Use fbdev's DMA helpers for fbdev emulation. The driver previously
used the I/O-memory helpers, while allocating DMA-able system memory.
This could (in theory) result in bus errors from accessing the memory
range.

This bug has been present since the exynos driver was first added.

v2:
* drop the pointless Fixes tag (Javier)
* fix typo in commit message

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230707083422.18691-7-tzimmermann@suse.de
16 months agodrm/tegra: Store pointer to vmap'ed framebuffer in screen_buffer
Thomas Zimmermann [Fri, 7 Jul 2023 08:31:56 +0000 (10:31 +0200)]
drm/tegra: Store pointer to vmap'ed framebuffer in screen_buffer

Tegra uses DMA-able memory, which has to be acessed with CPU ops
for system-memory. Store the framebuffer's vmap address in struct
fb_info.screen_buffer. The currently used field 'screen_base' is
for I/O memory.

Suggested-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230707083422.18691-6-tzimmermann@suse.de