]> Git Repo - linux.git/log
linux.git
5 months agodrm/amd/display: resolve correct MALL size for dcn401
Dillon Varone [Thu, 26 Sep 2024 00:18:07 +0000 (20:18 -0400)]
drm/amd/display: resolve correct MALL size for dcn401

[WHY]
Code for dcn401 to calculate available MALL size for display was shared
with dcn32 and did not provide the correct result for all ASICs.

[HOW]
Add dcn401 specific function to properly calculate the available MALL
for display.

Reviewed-by: Chris Park <[email protected]>
Signed-off-by: Dillon Varone <[email protected]>
Signed-off-by: Roman Li <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Read Sink emission rate capability
Robin Chen [Thu, 12 Sep 2024 12:59:36 +0000 (20:59 +0800)]
drm/amd/display: Read Sink emission rate capability

[WHY]
To get sink emission rate information for future
supported refresh rate calculation.

Reviewed-by: ChunTao Tso <[email protected]>
Signed-off-by: Robin Chen <[email protected]>
Signed-off-by: Roman Li <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: print messages when programming shaper/3dlut fails
Alex Hung [Wed, 2 Oct 2024 23:55:11 +0000 (17:55 -0600)]
drm/amd/display: print messages when programming shaper/3dlut fails

[WHAT & HOW]
Print error messages when programming shaper lut or 3dlut fails.

This fixes 5 UNUSED_VALUE issues reported by Coverity.

Reviewed-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
Signed-off-by: Roman Li <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Full exit out of IPS2 when all allow signals have been cleared
Leo Chen [Thu, 3 Oct 2024 16:20:23 +0000 (12:20 -0400)]
drm/amd/display: Full exit out of IPS2 when all allow signals have been cleared

[Why]
A race condition occurs between cursor movement and vertical interrupt control
thread from OS, with both threads trying to exit IPS2.
Vertical interrupt control thread clears the prev driver allow signal while not fully
finishing the IPS2 exit process.

[How]
We want to detect all the allow signals have been cleared before we perform the full exit.

Reviewed-by: Nicholas Kazlauskas <[email protected]>
Signed-off-by: Leo Chen <[email protected]>
Signed-off-by: Roman Li <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Fix Coverity change for visual confirm
Leo (Hanghong) Ma [Thu, 19 Sep 2024 19:19:29 +0000 (15:19 -0400)]
drm/amd/display: Fix Coverity change for visual confirm

[Why && How]
Previous change for Coverity has caused regression on visual confirm
so fix it by reverting the part that affects visual confirm.

Reviewed-by: Chris Park <[email protected]>
Signed-off-by: Leo (Hanghong) Ma <[email protected]>
Signed-off-by: Roman Li <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Add 3DLUT FL HW bug workaround
Ilya Bakoulin [Mon, 16 Sep 2024 18:38:19 +0000 (14:38 -0400)]
drm/amd/display: Add 3DLUT FL HW bug workaround

[Why]
There is a known HW bug that causes the internal 3DLUT fetch signal to
be lost at VREADY, regardless of whether the OTG lock is being held or
not. A workaround is necessary to make sure that this internal signal
stays up after OTG unlock.

[How]
Set the 3DLUT_ENABLE bit immediately before and after the unlock. Also
use VUPDATE_KEEPOUT to prevent lock transition in the region between
VSTARTUP and VREADY, which could cause issues with this WA sequence.

Also including misc. 3DLUT DMA-related sequence fixes to address a few
regressions causing corruption.

Reviewed-by: Dillon Varone <[email protected]>
Signed-off-by: Ilya Bakoulin <[email protected]>
Signed-off-by: Roman Li <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Add check for headless for idle optimization
Roman Li [Mon, 30 Sep 2024 22:18:35 +0000 (18:18 -0400)]
drm/amd/display: Add check for headless for idle optimization

[Why]
Currently idle worker thread that checks for HPD while system is in IPS2
only supports headless and static screen use-cases.
In other display-off scenarios hotplug may not work.

[How]
For display-off only allow idle optimization when no display is connected.

Reviewed-by: Sun peng Li <[email protected]>
Signed-off-by: Roman Li <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Increase idle worker HPD detection time
Roman Li [Mon, 30 Sep 2024 22:07:16 +0000 (18:07 -0400)]
drm/amd/display: Increase idle worker HPD detection time

[Why]
Idle worker thread waits HPD_DETECTION_TIME for HPD processing complete.
Some displays require longer time for that.

[How]
Increase HPD_DETECTION_TIME to 100ms.

Reviewed-by: Sun peng Li <[email protected]>
Signed-off-by: Roman Li <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Remove useless assignments
Alex Hung [Mon, 30 Sep 2024 17:29:02 +0000 (11:29 -0600)]
drm/amd/display: Remove useless assignments

[WHAT & HOW]
"split_pipe" are assigned to test_pipe and then immediately are updated
to other values. The same also applies to "status" as well.

Similarly, "id", "dwb" and "unused_dpps" are assigned but the functions
immediately return, and thus they have no effects.

As a results, the assignments removed.

This fixes 5 UNUSED_VALUE issues reported by Coverity.

Reviewed-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
Signed-off-by: Roman Li <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Check status from dpcd_get_tunneling_device_data
Alex Hung [Mon, 30 Sep 2024 17:45:12 +0000 (11:45 -0600)]
drm/amd/display: Check status from dpcd_get_tunneling_device_data

[WHAT & HOW]
dpcd_get_tunneling_device_data calls core_link_read_dpcd which can
fail. The status from core_link_read_dpcd should be checked and error
messages is printed in case of failures.

This fixes 1 UNUSED_VALUE issue reported by Coverity.

Reviewed-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
Signed-off-by: Roman Li <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Check returns from drm_dp_dpcd_write
Alex Hung [Fri, 20 Sep 2024 22:02:05 +0000 (16:02 -0600)]
drm/amd/display: Check returns from drm_dp_dpcd_write

[WHAT & HOW]
drm_dp_dpcd_write() returns negative error on failure and thus returned
values need to be checked.

This fixes 3 UNUSED_VALUE issues reported by Coverity.

Reviewed-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
Signed-off-by: Roman Li <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: Wait for reset on init completion
Lijo Lazar [Mon, 7 Oct 2024 08:19:45 +0000 (13:49 +0530)]
drm/amdgpu: Wait for reset on init completion

When reset on initialization is requested, wait for the reset to finish.
In cases where module is loaded after boot, this makes sure all
initialization work is done after a successful return of modprobe.

Signed-off-by: Lijo Lazar <[email protected]>
Reviewed-by: Ramesh Errabolu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdkfd: Accounting pdd vram_usage for svm
Philip Yang [Fri, 4 Oct 2024 20:28:07 +0000 (16:28 -0400)]
drm/amdkfd: Accounting pdd vram_usage for svm

Process device data pdd->vram_usage is read by rocm-smi via sysfs, this
is currently missing the svm_bo usage accounting, so "rocm-smi
--showpids" per process VRAM usage report is incorrect.

Add pdd->vram_usage accounting when svm_bo allocation and release,
change to atomic64_t type because it is updated outside process mutex
now.

Signed-off-by: Philip Yang <[email protected]>
Reviewed-by: Felix Kuehling <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/amdgpu: Fix double unlock in amdgpu_mes_add_ring
Srinivasan Shanmugam [Tue, 8 Oct 2024 13:31:48 +0000 (19:01 +0530)]
drm/amd/amdgpu: Fix double unlock in amdgpu_mes_add_ring

This patch addresses a double unlock issue in the amdgpu_mes_add_ring
function. The mutex was being unlocked twice under certain error
conditions, which could lead to undefined behavior.

The fix ensures that the mutex is unlocked only once before jumping to
the clean_up_memory label. The unlock operation is moved to just before
the goto statement within the conditional block that checks the return
value of amdgpu_ring_init. This prevents the second unlock attempt after
the clean_up_memory label, which is no longer necessary as the mutex is
already unlocked by this point in the code flow.

This change resolves the potential double unlock and maintains the
correct mutex handling throughout the function.

Fixes below:
Commit d0c423b64765 ("drm/amdgpu/mes: use ring for kernel queue
submission"), leads to the following Smatch static checker warning:

drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1240 amdgpu_mes_add_ring()
warn: double unlock '&adev->mes.mutex_hidden' (orig line 1213)

drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
    1143 int amdgpu_mes_add_ring(struct amdgpu_device *adev, int gang_id,
    1144                         int queue_type, int idx,
    1145                         struct amdgpu_mes_ctx_data *ctx_data,
    1146                         struct amdgpu_ring **out)
    1147 {
    1148         struct amdgpu_ring *ring;
    1149         struct amdgpu_mes_gang *gang;
    1150         struct amdgpu_mes_queue_properties qprops = {0};
    1151         int r, queue_id, pasid;
    1152
    1153         /*
    1154          * Avoid taking any other locks under MES lock to avoid circular
    1155          * lock dependencies.
    1156          */
    1157         amdgpu_mes_lock(&adev->mes);
    1158         gang = idr_find(&adev->mes.gang_id_idr, gang_id);
    1159         if (!gang) {
    1160                 DRM_ERROR("gang id %d doesn't exist\n", gang_id);
    1161                 amdgpu_mes_unlock(&adev->mes);
    1162                 return -EINVAL;
    1163         }
    1164         pasid = gang->process->pasid;
    1165
    1166         ring = kzalloc(sizeof(struct amdgpu_ring), GFP_KERNEL);
    1167         if (!ring) {
    1168                 amdgpu_mes_unlock(&adev->mes);
    1169                 return -ENOMEM;
    1170         }
    1171
    1172         ring->ring_obj = NULL;
    1173         ring->use_doorbell = true;
    1174         ring->is_mes_queue = true;
    1175         ring->mes_ctx = ctx_data;
    1176         ring->idx = idx;
    1177         ring->no_scheduler = true;
    1178
    1179         if (queue_type == AMDGPU_RING_TYPE_COMPUTE) {
    1180                 int offset = offsetof(struct amdgpu_mes_ctx_meta_data,
    1181                                       compute[ring->idx].mec_hpd);
    1182                 ring->eop_gpu_addr =
    1183                         amdgpu_mes_ctx_get_offs_gpu_addr(ring, offset);
    1184         }
    1185
    1186         switch (queue_type) {
    1187         case AMDGPU_RING_TYPE_GFX:
    1188                 ring->funcs = adev->gfx.gfx_ring[0].funcs;
    1189                 ring->me = adev->gfx.gfx_ring[0].me;
    1190                 ring->pipe = adev->gfx.gfx_ring[0].pipe;
    1191                 break;
    1192         case AMDGPU_RING_TYPE_COMPUTE:
    1193                 ring->funcs = adev->gfx.compute_ring[0].funcs;
    1194                 ring->me = adev->gfx.compute_ring[0].me;
    1195                 ring->pipe = adev->gfx.compute_ring[0].pipe;
    1196                 break;
    1197         case AMDGPU_RING_TYPE_SDMA:
    1198                 ring->funcs = adev->sdma.instance[0].ring.funcs;
    1199                 break;
    1200         default:
    1201                 BUG();
    1202         }
    1203
    1204         r = amdgpu_ring_init(adev, ring, 1024, NULL, 0,
    1205                              AMDGPU_RING_PRIO_DEFAULT, NULL);
    1206         if (r)
    1207                 goto clean_up_memory;
    1208
    1209         amdgpu_mes_ring_to_queue_props(adev, ring, &qprops);
    1210
    1211         dma_fence_wait(gang->process->vm->last_update, false);
    1212         dma_fence_wait(ctx_data->meta_data_va->last_pt_update, false);
    1213         amdgpu_mes_unlock(&adev->mes);
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    1214
    1215         r = amdgpu_mes_add_hw_queue(adev, gang_id, &qprops, &queue_id);
    1216         if (r)
    1217                 goto clean_up_ring;
                         ^^^^^^^^^^^^^^^^^^

    1218
    1219         ring->hw_queue_id = queue_id;
    1220         ring->doorbell_index = qprops.doorbell_off;
    1221
    1222         if (queue_type == AMDGPU_RING_TYPE_GFX)
    1223                 sprintf(ring->name, "gfx_%d.%d.%d", pasid, gang_id, queue_id);
    1224         else if (queue_type == AMDGPU_RING_TYPE_COMPUTE)
    1225                 sprintf(ring->name, "compute_%d.%d.%d", pasid, gang_id,
    1226                         queue_id);
    1227         else if (queue_type == AMDGPU_RING_TYPE_SDMA)
    1228                 sprintf(ring->name, "sdma_%d.%d.%d", pasid, gang_id,
    1229                         queue_id);
    1230         else
    1231                 BUG();
    1232
    1233         *out = ring;
    1234         return 0;
    1235
    1236 clean_up_ring:
    1237         amdgpu_ring_fini(ring);
    1238 clean_up_memory:
    1239         kfree(ring);
--> 1240         amdgpu_mes_unlock(&adev->mes);
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    1241         return r;
    1242 }

Fixes: d0c423b64765 ("drm/amdgpu/mes: use ring for kernel queue submission")
Cc: Christian König <[email protected]>
Cc: Alex Deucher <[email protected]>
Cc: Hawking Zhang <[email protected]>
Suggested-by: Jack Xiao <[email protected]>
Reported by: Dan Carpenter <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Reviewed-by: Jack Xiao <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Add hpd_source index out-of-bounds check for dcn3x link encoder...
Srinivasan Shanmugam [Wed, 9 Oct 2024 14:23:59 +0000 (19:53 +0530)]
drm/amd/display: Add hpd_source index out-of-bounds check for dcn3x link encoder creation

This patch adds a boundary check for the hpd_source index during the
link encoder creation process for dcn3x IP's. The check ensures that the
index is within the valid range of the link_enc_hpd_regs array to
prevent out-of-bounds access.

Cc: Tom Chung <[email protected]>
Cc: Rodrigo Siqueira <[email protected]>
Cc: Roman Li <[email protected]>
Cc: Alex Hung <[email protected]>
Cc: Aurabindo Pillai <[email protected]>
Cc: Harry Wentland <[email protected]>
Cc: Hamza Mahfooz <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Reviewed-by: Roman Li <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu/mes: fix issue of writing to the same log buffer from 2 MES pipes
Michael Chen [Tue, 8 Oct 2024 19:29:50 +0000 (15:29 -0400)]
drm/amdgpu/mes: fix issue of writing to the same log buffer from 2 MES pipes

With Unified MES enabled in gfx12, need separate event log buffer for the
2 MES pipes to avoid data overwrite.

Signed-off-by: Michael Chen <[email protected]>
Reviewed-by: Jack Xiao <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: Show current compute partition on VF
Lijo Lazar [Tue, 17 Sep 2024 06:16:44 +0000 (11:46 +0530)]
drm/amdgpu: Show current compute partition on VF

Enable sysfs node for current compute partition mode on VFs also.

Signed-off-by: Lijo Lazar <[email protected]>
Reviewed-by: Vignesh Chander <[email protected]>
Tested-by: Vignesh Chander <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: Fetch NPS mode for GCv9.4.3 VFs
Lijo Lazar [Fri, 13 Sep 2024 11:47:19 +0000 (17:17 +0530)]
drm/amdgpu: Fetch NPS mode for GCv9.4.3 VFs

Use the memory ranges published in discovery table to deduce NPS mode
of GC v9.4.3 VFs.

Signed-off-by: Lijo Lazar <[email protected]>
Reviewed-by: Vignesh Chander <[email protected]>
Tested-by: Vignesh Chander <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: prevent BO_HANDLES error from being overwritten
Mohammed Anees [Wed, 9 Oct 2024 12:28:31 +0000 (17:58 +0530)]
drm/amdgpu: prevent BO_HANDLES error from being overwritten

Before this patch, if multiple BO_HANDLES chunks were submitted,
the error -EINVAL would be correctly set but could be overwritten
by the return value from amdgpu_cs_p1_bo_handles(). This patch
ensures that if there are multiple BO_HANDLES, we stop.

Fixes: fec5f8e8c6bc ("drm/amdgpu: disallow multiple BO_HANDLES chunks in one submit")
Signed-off-by: Mohammed Anees <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/pm: Fill pcie recov cntr to metrics 1.6
Asad Kamal [Fri, 4 Oct 2024 09:42:54 +0000 (17:42 +0800)]
drm/amd/pm: Fill pcie recov cntr to metrics 1.6

Fill pcie other end recovery counter to metrics 1.6

v2: Add separate function to check recovery counter support

Signed-off-by: Asad Kamal <[email protected]>
Reviewed-by: Lijo Lazar <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/pm: Update SMUv13.0.6 PMFW headers
Asad Kamal [Fri, 4 Oct 2024 09:18:20 +0000 (17:18 +0800)]
drm/amd/pm: Update SMUv13.0.6 PMFW headers

Update pmfw headers for smuv13.0.6 to version 0xE

Signed-off-by: Asad Kamal <[email protected]>
Reviewed-by: Lijo Lazar <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: enable enforce_isolation sysfs node on VFs
Alex Deucher [Tue, 8 Oct 2024 20:02:48 +0000 (16:02 -0400)]
drm/amdgpu: enable enforce_isolation sysfs node on VFs

It should be enabled on both bare metal and VFs.

Fixes: e189be9b2e38 ("drm/amdgpu: Add enforce_isolation sysfs attribute")
Signed-off-by: Alex Deucher <[email protected]>
Cc: Srinivasan Shanmugam <[email protected]>
Cc: Amber Lin <[email protected]>
Reviewed-by: Srinivasan Shanmugam <[email protected]>
5 months agodrm/amdgpu: Add NPS switch support for GC 9.4.3
Lijo Lazar [Fri, 20 Sep 2024 09:55:10 +0000 (15:25 +0530)]
drm/amdgpu: Add NPS switch support for GC 9.4.3

Add dynamic NPS switch support for GC 9.4.3 variants. Only GC v9.4.3 and
GC v9.4.4 currently support this. NPS switch is only supported if an SOC
supports multiple NPS modes.

Signed-off-by: Lijo Lazar <[email protected]>
Signed-off-by: Rajneesh Bhardwaj <[email protected]>
Reviewed-by: Feifei Xu <[email protected]>
Reviewed-by: Hawking Zhang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu/gfx12: Apply Isolation Enforcement to GFX & Compute rings
Srinivasan Shanmugam [Wed, 2 Oct 2024 04:36:25 +0000 (10:06 +0530)]
drm/amdgpu/gfx12: Apply Isolation Enforcement to GFX & Compute rings

This commit applies isolation enforcement to the GFX and Compute rings
in the gfx_v12_0 module.

The commit sets `amdgpu_gfx_enforce_isolation_ring_begin_use` and
`amdgpu_gfx_enforce_isolation_ring_end_use` as the functions to be
called when a ring begins and ends its use, respectively.

`amdgpu_gfx_enforce_isolation_ring_begin_use` is called when a ring
begins its use. This function cancels any scheduled
`enforce_isolation_work` and, if necessary, signals the Kernel Fusion
Driver (KFD) to stop the runqueue.

`amdgpu_gfx_enforce_isolation_ring_end_use` is called when a ring ends
its use. This function schedules `enforce_isolation_work` to be run
after a delay.

These functions are part of the Enforce Isolation Handler, which
enforces shader isolation on AMD GPUs to prevent data leakage between
different processes.

Cc: Christian König <[email protected]>
Cc: Alex Deucher <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: optimize fn gfx_v12_ring_insert_nop
Sunil Khatri [Tue, 8 Oct 2024 13:16:49 +0000 (18:46 +0530)]
drm/amdgpu: optimize fn gfx_v12_ring_insert_nop

Optimize gfx_v12_ring_insert_nop() to call
optimized version of amdgpu_ring_insert_nop
instead of calling amdgpu_ring_write for number
of nop times.

Signed-off-by: Sunil Khatri <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: optimize fn gfx_v11_ring_insert_nop
Sunil Khatri [Tue, 8 Oct 2024 13:16:05 +0000 (18:46 +0530)]
drm/amdgpu: optimize fn gfx_v11_ring_insert_nop

Optimize gfx_v11_ring_insert_nop() to call
optimized version of amdgpu_ring_insert_nop
instead of calling amdgpu_ring_write for number
of nop times.

Signed-off-by: Sunil Khatri <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: optimize fn gfx_v10_ring_insert_nop
Sunil Khatri [Tue, 8 Oct 2024 13:15:05 +0000 (18:45 +0530)]
drm/amdgpu: optimize fn gfx_v10_ring_insert_nop

Optimize gfx_v10_ring_insert_nop() to call
optimized version of amdgpu_ring_insert_nop
instead of calling amdgpu_ring_write for number
of nop times.

Signed-off-by: Sunil Khatri <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: optimize fn gfx_v9_ring_insert_nop
Sunil Khatri [Tue, 8 Oct 2024 13:14:09 +0000 (18:44 +0530)]
drm/amdgpu: optimize fn gfx_v9_ring_insert_nop

Optimize gfx_v9_ring_insert_nop() to call
optimized version of amdgpu_ring_insert_nop
instead of calling amdgpu_ring_write for number
of nop times.

Signed-off-by: Sunil Khatri <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: optimize fn gfx_v9_4_3_ring_insert_nop
Sunil Khatri [Tue, 8 Oct 2024 13:10:50 +0000 (18:40 +0530)]
drm/amdgpu: optimize fn gfx_v9_4_3_ring_insert_nop

Optimize gfx_v9_4_3_ring_insert_nop() to call
optimized version of amdgpu_ring_insert_nop
instead of calling amdgpu_ring_write for number
of nop times.

Signed-off-by: Sunil Khatri <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: optimize insert_nop using multi dwords
Sunil Khatri [Tue, 8 Oct 2024 13:02:16 +0000 (18:32 +0530)]
drm/amdgpu: optimize insert_nop using multi dwords

Optimize the ring_insert_nop fn for n dwords in one
step rather then call to amdgpu_ring_write for each
nop packet. This avoid function call for each nop
packet and also wptr is updated once only.

Signed-off-by: Sunil Khatri <[email protected]>
Suggested-by: Christian König <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: Check gmc requirement for reset on init
Lijo Lazar [Fri, 20 Sep 2024 08:47:30 +0000 (14:17 +0530)]
drm/amdgpu: Check gmc requirement for reset on init

Add a callback to check if there is any condition detected by GMC block
for reset on init. One case is if a pending NPS change request is
detected. If reset is done because of NPS switch, refresh NPS info from
discovery table.

Signed-off-by: Lijo Lazar <[email protected]>
Reviewed-by: Feifei Xu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: Place NPS mode request on unload
Lijo Lazar [Fri, 20 Sep 2024 07:44:40 +0000 (13:14 +0530)]
drm/amdgpu: Place NPS mode request on unload

If a user has requested NPS mode switch, place the request through PSP
during unload of the driver. For devices which are part of a hive, all
requests are placed together. If one of them fails, revert back to the
current NPS mode.

Signed-off-by: Lijo Lazar <[email protected]>
Signed-off-by: Rajneesh Bhardwaj <[email protected]>
Reviewed-by: Feifei Xu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/radeon: always set GEM function pointer
Christian König [Mon, 7 Oct 2024 18:30:19 +0000 (20:30 +0200)]
drm/radeon: always set GEM function pointer

Make sure to always set the GEM function pointer even for in kernel
allocations. This fixes a NULL pointer deref caused by switching to GEM
references.

Signed-off-by: Christian König <[email protected]>
Fixes: fd69ef05029f ("drm/radeon: use GEM references instead of TTMs")
Acked-by: Alex Deucher <[email protected]>
Tested-by: Hans de Goede <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: fix dm_suspend/resume arguments to ip_block
Sunil Khatri [Tue, 8 Oct 2024 03:53:12 +0000 (09:23 +0530)]
drm/amdgpu: fix dm_suspend/resume arguments to ip_block

"build failure after merge of the amdgpu tree"
dm_suspend/dm_resume functions argument mismatch
not caught in validation as it was under config
CONFIG_DEBUG_KERNEL_DC which wasnt enabled by
default.

Change argument from adev to ip_block.

Fixes: 982d7f9bfe4a ("drm/amdgpu: update the handle ptr in suspend")
Fixes: 7feb4f3ad8be ("drm/amdgpu: update the handle ptr in resume")
Reported-by: Stephen Rothwell <[email protected]>
Signed-off-by: Sunil Khatri <[email protected]>
Acked-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: no need to log error in multi ring write
Sunil Khatri [Thu, 3 Oct 2024 08:05:22 +0000 (13:35 +0530)]
drm/amdgpu: no need to log error in multi ring write

No need to log error in multi ring write as its taken
care during ring commit.

This is inline with change done in amdgpu_ring_write.

Signed-off-by: Sunil Khatri <[email protected]>
Suggested-by: Christian König <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: move error log from ring write to commit
Sunil Khatri [Thu, 3 Oct 2024 07:57:08 +0000 (13:27 +0530)]
drm/amdgpu: move error log from ring write to commit

Move the error message from ring write as an optimization
to avoid printing that message on every write instead
print once during commit if it exceeds write the allocated
size i.e ring->count_dw.

Also we do not want to log the error message in between a
ring write and complete the write as its mostly not harmful
as it will overwrite stale data only as GPU read from ring
is faster than CPU write to ring.

This reduces the size of amdgpu.ko module by around
600 Kb as write is very often used function and hence
the print.

Signed-off-by: Sunil Khatri <[email protected]>
Suggested-by: Christian König <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: fix typos
Andrew Kreimer [Sun, 6 Oct 2024 11:27:52 +0000 (14:27 +0300)]
drm/amdgpu: fix typos

Fix typos in comments: "wether -> whether".

Signed-off-by: Andrew Kreimer <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: Remove the while loop from amdgpu_job_prepare_job
Tvrtko Ursulin [Tue, 24 Sep 2024 09:51:45 +0000 (10:51 +0100)]
drm/amdgpu: Remove the while loop from amdgpu_job_prepare_job

While loop makes it sound like amdgpu_vmid_grab() potentially needs to be
called multiple times to produce a fence, while in reality all code paths
either return an error, assign a valid job->vmid or assign a vmid which
will be valid once the returned fence signals.

Therefore we can remove the loop to make it clear the call does not need
to be repeated.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
Cc: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: Drop impossible condition from amdgpu_job_prepare_job
Tvrtko Ursulin [Tue, 24 Sep 2024 09:51:44 +0000 (10:51 +0100)]
drm/amdgpu: Drop impossible condition from amdgpu_job_prepare_job

Fence has been initialised to NULL so no need to test it.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
Cc: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: disable SG displays on cyan skillfish
Alex Deucher [Fri, 4 Oct 2024 13:34:24 +0000 (09:34 -0400)]
drm/amd/display: disable SG displays on cyan skillfish

These parts were mainly for compute workloads, but they have
a display that was available for the console.  These chips
should support SG display, but I don't know that the support
was ever validated on Linux so disable it by default. It can
still be enabled by setting sg_display=1 for those that
want to play with it.  These systems also generally had large
carve outs so SG display was less of a factor.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3356
Reviewed-by: Harry Wentland <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: Use drm_print_memory_stats helper from fdinfo
Tvrtko Ursulin [Mon, 20 May 2024 11:13:38 +0000 (12:13 +0100)]
drm/amdgpu: Use drm_print_memory_stats helper from fdinfo

Convert fdinfo memory stats to use the common drm_print_memory_stats
helper.

This achieves alignment with the common keys as documented in
drm-usage-stats.rst, adding specifically drm-total- key the driver was
missing until now.

Additionally I made the code stop skipping total size for objects which
currently do not have a backing store, and I added resident, active and
purgeable reporting.

Legacy keys have been preserved, with the outlook of only potentially
removing only the drm-memory- when the time gets right.

The example output now looks like this:

 pos: 0
 flags: 02100002
 mnt_id: 24
 ino: 1239
 drm-driver: amdgpu
 drm-client-id: 4
 drm-pdev: 0000:04:00.0
 pasid: 32771
 drm-total-cpu: 0
 drm-shared-cpu: 0
 drm-active-cpu: 0
 drm-resident-cpu: 0
 drm-purgeable-cpu: 0
 drm-total-gtt: 2392 KiB
 drm-shared-gtt: 0
 drm-active-gtt: 0
 drm-resident-gtt: 2392 KiB
 drm-purgeable-gtt: 0
 drm-total-vram: 44564 KiB
 drm-shared-vram: 31952 KiB
 drm-active-vram: 0
 drm-resident-vram: 44564 KiB
 drm-purgeable-vram: 0
 drm-memory-vram: 44564 KiB
 drm-memory-gtt:  2392 KiB
 drm-memory-cpu:  0 KiB
 amd-memory-visible-vram: 44564 KiB
 amd-evicted-vram: 0 KiB
 amd-evicted-visible-vram: 0 KiB
 amd-requested-vram: 44564 KiB
 amd-requested-visible-vram: 11952 KiB
 amd-requested-gtt: 2392 KiB
 drm-engine-compute: 46464671 ns

v2:
 * Track purgeable via AMDGPU_GEM_CREATE_DISCARDABLE.

Acked-by: Daniel Vetter <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
Cc: Alex Deucher <[email protected]>
Cc: Christian König <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Rob Clark <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: Drop unused fence argument from amdgpu_vmid_grab_used
Tvrtko Ursulin [Tue, 24 Sep 2024 09:51:43 +0000 (10:51 +0100)]
drm/amdgpu: Drop unused fence argument from amdgpu_vmid_grab_used

Fence argument is unused so lets drop it.

Reviewed-by: Christian König <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
Cc: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: partially revert powerplay `__counted_by` changes
Alex Deucher [Wed, 2 Oct 2024 21:27:25 +0000 (17:27 -0400)]
drm/amdgpu: partially revert powerplay `__counted_by` changes

Partially revert
commit 0ca9f757a0e2 ("drm/amd/pm: powerplay: Add `__counted_by` attribute for flexible arrays")

The count attribute for these arrays does not get set until
after the arrays are allocated and populated leading to false
UBSAN warnings.

Fixes: 0ca9f757a0e2 ("drm/amd/pm: powerplay: Add `__counted_by` attribute for flexible arrays")
Reviewed-by: Mario Limonciello <[email protected]>
Reviewed-by: Lijo Lazar <[email protected]>
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3662
Signed-off-by: Alex Deucher <[email protected]>
5 months agoDocumentation/gpu: Document the situation with unqualified drm-memory-
Tvrtko Ursulin [Tue, 13 Aug 2024 13:57:11 +0000 (14:57 +0100)]
Documentation/gpu: Document the situation with unqualified drm-memory-

Currently it is not well defined what is drm-memory- compared to other
categories.

In practice the only driver which emits these keys is amdgpu and in them
exposes the current resident buffer object memory (including shared).

To prevent any confusion, document that drm-memory- is deprecated and an
alias for drm-resident-memory-.

While at it also clarify that the reserved sub-string 'memory' refers to
the memory region component, and also clarify the intended semantics of
other memory categories.

v2:
 * Also mark drm-memory- as deprecated.
 * Add some more text describing memory categories. (Alex)

v3:
 * Semantics of the amdgpu drm-memory is actually as drm-resident.

Reviewed-by: Rob Clark <[email protected]>
Acked-by: Daniel Vetter <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Tvrtko Ursulin <[email protected]>
Cc: Alex Deucher <[email protected]>
Cc: Christian König <[email protected]>
Cc: Rob Clark <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdkfd: SMI report dropped event count
Philip Yang [Tue, 30 Jul 2024 19:33:23 +0000 (15:33 -0400)]
drm/amdkfd: SMI report dropped event count

Add new SMI event to report the dropped event count.

When the event kfifo is full, drop count is not zero, or no enough space
left to store the event message, increase drop count.

After reading event out from kfifo, if event was dropped, drop_count is
not zero, generate a dropped event record and reset drop count to zero.

Signed-off-by: Philip Yang <[email protected]>
Reviewed-by: James Zhu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: Add sysfs interfaces for NPS mode
Lijo Lazar [Thu, 19 Sep 2024 14:06:19 +0000 (19:36 +0530)]
drm/amdgpu: Add sysfs interfaces for NPS mode

Add a sysfs interface to see available NPS modes to switch to -

cat /sys/bus/pci/devices/../available_memory_paritition

Make the current_memory_partition sysfs node read/write for requesting a
new NPS mode. The request is only cached and at a later point a driver
unload/reload is required to switch to the new NPS mode.

Ex:
echo NPS1 > /sys/bus/pci/devices/../current_memory_paritition
echo NPS4 > /sys/bus/pci/devices/../current_memory_paritition

The above interfaces will be available only if the SOC supports more than
one NPS mode.

Also modify the current memory partition sysfs logic to be more
generic.

Signed-off-by: Lijo Lazar <[email protected]>
Reviewed-by: Rajneesh Bhardwaj <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: Add gmc interface to request NPS mode
Lijo Lazar [Thu, 19 Sep 2024 13:21:07 +0000 (18:51 +0530)]
drm/amdgpu: Add gmc interface to request NPS mode

Add a common interface in GMC to request NPS mode through PSP. Also add
a variable in hive and gmc control to track the last requested mode.

Signed-off-by: Rajneesh Bhardwaj <[email protected]>
Signed-off-by: Lijo Lazar <[email protected]>
Reviewed-by: Feifei Xu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu/gfx10: Apply Isolation Enforcement to GFX & Compute rings
Srinivasan Shanmugam [Wed, 2 Oct 2024 04:05:07 +0000 (09:35 +0530)]
drm/amdgpu/gfx10: Apply Isolation Enforcement to GFX & Compute rings

This commit applies isolation enforcement to the GFX and Compute rings
in the gfx_v10_0 module.

The commit sets `amdgpu_gfx_enforce_isolation_ring_begin_use` and
`amdgpu_gfx_enforce_isolation_ring_end_use` as the functions to be
called when a ring begins and ends its use, respectively.

`amdgpu_gfx_enforce_isolation_ring_begin_use` is called when a ring
begins its use. This function cancels any scheduled
`enforce_isolation_work` and, if necessary, signals the Kernel Fusion
Driver (KFD) to stop the runqueue.

`amdgpu_gfx_enforce_isolation_ring_end_use` is called when a ring ends
its use. This function schedules `enforce_isolation_work` to be run
after a delay.

These functions are part of the Enforce Isolation Handler, which
enforces shader isolation on AMD GPUs to prevent data leakage between
different processes.

Cc: Christian König <[email protected]>
Cc: Alex Deucher <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: fix hibernate entry for DCN35+
Hamza Mahfooz [Fri, 4 Oct 2024 19:22:57 +0000 (15:22 -0400)]
drm/amd/display: fix hibernate entry for DCN35+

Since, two suspend-resume cycles are required to enter hibernate and,
since we only need to enable idle optimizations in the first cycle
(which is pretty much equivalent to s2idle). We can check in_s0ix, to
prevent the system from entering idle optimizations before it actually
enters hibernate (from display's perspective). Also, call
dc_set_power_state() before dc_allow_idle_optimizations(), since it's
safer to do so because dc_set_power_state() writes to DMUB.

Acked-by: Alex Deucher <[email protected]>
Signed-off-by: Hamza Mahfooz <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Fetch the EDID from _DDC if available for eDP
Mario Limonciello [Fri, 27 Sep 2024 23:06:00 +0000 (18:06 -0500)]
drm/amd/display: Fetch the EDID from _DDC if available for eDP

Some manufacturers have intentionally put an EDID that differs from
the EDID on the internal panel on laptops.

Attempt to fetch this EDID if it exists and prefer it over the EDID
that is provided by the panel. If a user prefers to use the EDID from
the panel, offer a DC debugging parameter that would disable this.

Signed-off-by: Mario Limonciello <[email protected]>
Reviewed-by: Alex Hung <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: remove redundant freesync parser for DP
Melissa Wen [Fri, 27 Sep 2024 23:05:59 +0000 (18:05 -0500)]
drm/amd/display: remove redundant freesync parser for DP

When updating connector under drm_edid infrastructure, many calculations
and validations are already done and become redundant inside AMD driver.
Remove those driver-specific code in favor of the DRM common code.

Signed-off-by: Melissa Wen <[email protected]>
Co-developed-by: Mario Limonciello <[email protected]>
Signed-off-by: Mario Limonciello <[email protected]>
Reviewed-by: Alex Hung <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: always call connector_update when parsing freesync_caps
Melissa Wen [Fri, 27 Sep 2024 23:05:58 +0000 (18:05 -0500)]
drm/amd/display: always call connector_update when parsing freesync_caps

Update connector caps with drm_edid data before parsing info for
freesync.

Signed-off-by: Melissa Wen <[email protected]>
Signed-off-by: Mario Limonciello <[email protected]>
Reviewed-by: Alex Hung <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: switch to setting physical address directly
Melissa Wen [Fri, 27 Sep 2024 23:05:57 +0000 (18:05 -0500)]
drm/amd/display: switch to setting physical address directly

Connectors have source physical address available in display
info. Use drm_dp_cec_attach() to use it instead of parsing the EDID
again.

Signed-off-by: Melissa Wen <[email protected]>
Signed-off-by: Mario Limonciello <[email protected]>
Reviewed-by: Alex Hung <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: switch amdgpu_dm_connector to use struct drm_edid
Melissa Wen [Fri, 27 Sep 2024 23:05:56 +0000 (18:05 -0500)]
drm/amd/display: switch amdgpu_dm_connector to use struct drm_edid

Replace raw edid handling (struct edid) with the opaque EDID type
(struct drm_edid) on amdgpu_dm_connector for consistency. It may also
prevent mismatch of approaches in different parts of the driver code.

Signed-off-by: Melissa Wen <[email protected]>
Co-developed-by: Mario Limonciello <[email protected]>
Signed-off-by: Mario Limonciello <[email protected]>
Reviewed-by: Alex Hung <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: Add PSP interface for NPS switch
Rajneesh Bhardwaj [Thu, 19 Sep 2024 11:52:50 +0000 (17:22 +0530)]
drm/amdgpu: Add PSP interface for NPS switch

Implement PSP ring command interface for memory partitioning on the fly
on the supported asics.

Signed-off-by: Rajneesh Bhardwaj <[email protected]>
Reviewed-by: Feifei Xu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: 3.2.304
Aric Cyr [Mon, 30 Sep 2024 13:05:49 +0000 (09:05 -0400)]
drm/amd/display: 3.2.304

This DC patchset brings improvements in multiple areas. In summary, we
highlight:

- Improvements to seemless boot.
- Adjustments for DSC dock.
- DML improvements
- DMCUB fixes for D0/D3 and new register offset.
- Code cleanup.

Signed-off-by: Aric Cyr <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Acked-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Initialize new backlight_level_params structure
Kaitlyn Tse [Wed, 4 Sep 2024 15:54:15 +0000 (11:54 -0400)]
drm/amd/display: Initialize new backlight_level_params structure

[Why]
Initialize the new backlight_level_params structure as part of the ABC
framework, the information in this structure is needed to be passed down
to the DMCUB to identify the backlight control type, to adjust the
backlight of the panel and to perform any required conversions from PWM
to nits or vice versa.

[How]
Created initial framework of the backlight_level_params struct and
modified existing functions to include the new structure.

Reviewed-by: Harry Vanzylldejong <[email protected]>
Reviewed-by: Iswara Nagulendran <[email protected]>
Reviewed-by: Anthony Koo <[email protected]>
Signed-off-by: Kaitlyn Tse <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Initialize replay_config var
Kaitlyn Tse [Mon, 23 Sep 2024 16:29:12 +0000 (12:29 -0400)]
drm/amd/display: Initialize replay_config var

[Why]
Uninitialized variables could cause some bits to be set, thus enabling
features unintentionally.

[How]
Initialize replay_config variable to avoid future issues.

Reviewed-by: Harry Vanzylldejong <[email protected]>
Reviewed-by: Iswara Nagulendran <[email protected]>
Reviewed-by: Anthony Koo <[email protected]>
Signed-off-by: Kaitlyn Tse <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Remove redundant assignments
Alex Hung [Mon, 23 Sep 2024 23:48:47 +0000 (17:48 -0600)]
drm/amd/display: Remove redundant assignments

[WHAT & HOW]
log2_blk_height and log2_blk_width are assigned to 0 and then
immediately are updated to other values. The assignments to zero are
redudant and removed.

This fixes 18 UNUSED_VALUE issues reported by Coverity.

Reviewed-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Remove unnecessary assignments
Alex Hung [Mon, 23 Sep 2024 20:24:49 +0000 (14:24 -0600)]
drm/amd/display: Remove unnecessary assignments

[WHAT & HOW]
TimeForFetchingMetaPTE, TimeForFetchingRowInVBlank and
LinesToRequestPrefetchPixelData are local variables. They
are freed when CalculatePrefetchSchedule() ends and need
not clearing explicitly.

This fixes 21 UNUSED_VALUE issues reported by Coverity.

Reviewed-by: Nevenko Stupar <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Add DMUB debug offset
Taimur Hassan [Sun, 29 Sep 2024 04:21:23 +0000 (00:21 -0400)]
drm/amd/display: Add DMUB debug offset

Add DMUB offset for future use.

Signed-off-by: Taimur Hassan <[email protected]>
Acked-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Update Interface to Check UCLK DPM
Austin Zheng [Tue, 10 Sep 2024 20:41:20 +0000 (16:41 -0400)]
drm/amd/display: Update Interface to Check UCLK DPM

[Why]
Videos using YUV420 format may result in high power being used.
Disabling MPO may result in lower power usage.
Update interface that can be used to check power profile of a dc_state.

[How]
Add helper functions that can be used to determine power level:
- get power profile after a dc_state has undergone full validation

Reviewed-by: Alvin Lee <[email protected]>
Signed-off-by: Austin Zheng <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Move Link Encoder Assignment Out Of dc_global_validate
Austin Zheng [Thu, 26 Sep 2024 20:53:17 +0000 (16:53 -0400)]
drm/amd/display: Move Link Encoder Assignment Out Of dc_global_validate

Assigning link encoder is not relevant to validating bandwidth so move
the logic outside of dc_global_validate.

Reviewed-by: Alvin Lee <[email protected]>
Signed-off-by: Austin Zheng <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Allow Latency Increase For Last Strategy
Austin Zheng [Thu, 26 Sep 2024 20:18:10 +0000 (16:18 -0400)]
drm/amd/display: Allow Latency Increase For Last Strategy

[Why]
Playing 1080p video on 4k60 timing uses UCLK DPM5 and mode support
determines that p-state switching is not supported.

[How]
Allow DML to increase latency as the last strategy so strategies such
as VBlank p-state switching may become possible

Reviewed-by: Alvin Lee <[email protected]>
Signed-off-by: Austin Zheng <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Skip Invalid Streams from DSC Policy
Fangzhi Zuo [Mon, 23 Sep 2024 20:20:40 +0000 (16:20 -0400)]
drm/amd/display: Skip Invalid Streams from DSC Policy

Streams with invalid new connector state should be elimiated from
dsc policy.

Reviewed-by: Aurabindo Pillai <[email protected]>
Signed-off-by: Fangzhi Zuo <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Align static screen idle worker with IPX mode
Roman Li [Thu, 26 Sep 2024 20:36:15 +0000 (16:36 -0400)]
drm/amd/display: Align static screen idle worker with IPX mode

[Why]
Idle worker thread serves for periodic detection of HPD while system is in IPS2.
Currently it is used in headless and static screen scenarios.
IPX can be configured not to execute IPS2 for static screen.
In this case idle worker is redundant.

[How]
Only use periodic detection for static screen if IPS is fully enabled.

Reviewed-by: Sun peng Li <[email protected]>
Signed-off-by: Roman Li <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: calculate final viewport before TAP optimization
Yihan Zhu [Thu, 26 Sep 2024 13:49:25 +0000 (09:49 -0400)]
drm/amd/display: calculate final viewport before TAP optimization

Viewport size excess surface size observed sometime with some timings or
resizing the MPO video window to cause MPO unsupported. Calculate final
viewport size first with a 100x100 dummy viewport to get the max TAP
support and then re-run final viewport calculation if TAP value changed.
Removed obsolete preliminary viewport calculation for TAP validation.

Reviewed-by: Dmytro Laktyushkin <[email protected]>
Signed-off-by: Yihan Zhu <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: fix a memleak issue when driver is removed
Aurabindo Pillai [Mon, 23 Sep 2024 20:07:25 +0000 (20:07 +0000)]
drm/amd/display: fix a memleak issue when driver is removed

Running "modprobe amdgpu" the second time (followed by a modprobe -r
amdgpu) causes a call trace like:

[  845.212163] Memory manager not clean during takedown.
[  845.212170] WARNING: CPU: 4 PID: 2481 at drivers/gpu/drm/drm_mm.c:999 drm_mm_takedown+0x2b/0x40
[  845.212177] Modules linked in: amdgpu(OE-) amddrm_ttm_helper(OE) amddrm_buddy(OE) amdxcp(OE) amd_sched(OE) drm_exec drm_suballoc_helper drm_display_helper i2c_algo_bit amdttm(OE) amdkcl(OE) cec rc_core sunrpc qrtr intel_rapl_msr intel_rapl_common snd_hda_codec_hdmi edac_mce_amd snd_hda_intel snd_intel_dspcfg snd_intel_sdw_acpi snd_usb_audio snd_hda_codec snd_usbmidi_lib kvm_amd snd_hda_core snd_ump mc snd_hwdep kvm snd_pcm snd_seq_midi snd_seq_midi_event irqbypass crct10dif_pclmul snd_rawmidi polyval_clmulni polyval_generic ghash_clmulni_intel sha256_ssse3 sha1_ssse3 snd_seq aesni_intel crypto_simd snd_seq_device cryptd snd_timer mfd_aaeon asus_nb_wmi eeepc_wmi joydev asus_wmi snd ledtrig_audio sparse_keymap ccp wmi_bmof input_leds k10temp i2c_piix4 platform_profile rapl soundcore gpio_amdpt mac_hid binfmt_misc msr parport_pc ppdev lp parport efi_pstore nfnetlink dmi_sysfs ip_tables x_tables autofs4 hid_logitech_hidpp hid_logitech_dj hid_generic usbhid hid ahci xhci_pci igc crc32_pclmul libahci xhci_pci_renesas video
[  845.212284]  wmi [last unloaded: amddrm_ttm_helper(OE)]
[  845.212290] CPU: 4 PID: 2481 Comm: modprobe Tainted: G        W  OE      6.8.0-31-generic #31-Ubuntu
[  845.212296] RIP: 0010:drm_mm_takedown+0x2b/0x40
[  845.212300] Code: 1f 44 00 00 48 8b 47 38 48 83 c7 38 48 39 f8 75 09 31 c0 31 ff e9 90 2e 86 00 55 48 c7 c7 d0 f6 8e 8a 48 89 e5 e8 f5 db 45 ff <0f> 0b 5d 31 c0 31 ff e9 74 2e 86 00 66 0f 1f 84 00 00 00 00 00 90
[  845.212302] RSP: 0018:ffffb11302127ae0 EFLAGS: 00010246
[  845.212305] RAX: 0000000000000000 RBX: ffff92aa5020fc08 RCX: 0000000000000000
[  845.212307] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[  845.212309] RBP: ffffb11302127ae0 R08: 0000000000000000 R09: 0000000000000000
[  845.212310] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000004
[  845.212312] R13: ffff92aa50200000 R14: ffff92aa5020fb10 R15: ffff92aa5020faa0
[  845.212313] FS:  0000707dd7c7c080(0000) GS:ffff92b93de00000(0000) knlGS:0000000000000000
[  845.212316] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  845.212318] CR2: 00007d48b0aee200 CR3: 0000000115a58000 CR4: 0000000000f50ef0
[  845.212320] PKRU: 55555554
[  845.212321] Call Trace:
[  845.212323]  <TASK>
[  845.212328]  ? show_regs+0x6d/0x80
[  845.212333]  ? __warn+0x89/0x160
[  845.212339]  ? drm_mm_takedown+0x2b/0x40
[  845.212344]  ? report_bug+0x17e/0x1b0
[  845.212350]  ? handle_bug+0x51/0xa0
[  845.212355]  ? exc_invalid_op+0x18/0x80
[  845.212359]  ? asm_exc_invalid_op+0x1b/0x20
[  845.212366]  ? drm_mm_takedown+0x2b/0x40
[  845.212371]  amdgpu_gtt_mgr_fini+0xa9/0x130 [amdgpu]
[  845.212645]  amdgpu_ttm_fini+0x264/0x340 [amdgpu]
[  845.212770]  amdgpu_bo_fini+0x2e/0xc0 [amdgpu]
[  845.212894]  gmc_v12_0_sw_fini+0x2a/0x40 [amdgpu]
[  845.213036]  amdgpu_device_fini_sw+0x11a/0x590 [amdgpu]
[  845.213159]  amdgpu_driver_release_kms+0x16/0x40 [amdgpu]
[  845.213302]  devm_drm_dev_init_release+0x5e/0x90
[  845.213305]  devm_action_release+0x12/0x30
[  845.213308]  release_nodes+0x42/0xd0
[  845.213311]  devres_release_all+0x97/0xe0
[  845.213314]  device_unbind_cleanup+0x12/0x80
[  845.213317]  device_release_driver_internal+0x230/0x270
[  845.213319]  ? srso_alias_return_thunk+0x5/0xfbef5

This is caused by lost memory during early init phase. First time driver
is removed, memory is freed but when second time the driver is inserted,
VBIOS dmub is not active, since the PSP policy is to retain the driver
loaded version on subsequent warm boots. Hence, communication with VBIOS
DMUB fails.

Fix this by aborting further communication with vbios dmub and release
the memory immediately.

Fixes: f59549c7e705 ("drm/amd/display: free bo used for dmub bounding box")
Reviewed-by: Rodrigo Siqueira <[email protected]>
Signed-off-by: Aurabindo Pillai <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Clear update flags after update has been applied
Josip Pavic [Tue, 24 Sep 2024 21:25:54 +0000 (17:25 -0400)]
drm/amd/display: Clear update flags after update has been applied

[Why]
Since the surface/stream update flags aren't cleared after applying
updates, those same updates may be applied again in a future call to
update surfaces/streams for surfaces/streams that aren't actually part
of that update (i.e. applying an update for one surface/stream can
trigger unintended programming on a different surface/stream).

For example, when an update results in a call to
program_front_end_for_ctx, that function may call program_pipe on all
pipes. If there are surface update flags that were never cleared on the
surface some pipe is attached to, then the same update will be
programmed again.

[How]
Clear the surface and stream update flags after applying the updates.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3441
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3616
Cc: Melissa Wen <[email protected]>
Reviewed-by: Aric Cyr <[email protected]>
Signed-off-by: Josip Pavic <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: update sr_exit latency for z8
Charlene Liu [Thu, 26 Sep 2024 00:57:00 +0000 (20:57 -0400)]
drm/amd/display: update sr_exit latency for z8

This is based on real asic performance result.

Reviewed-by: Alvin Lee <[email protected]>
Signed-off-by: Charlene Liu <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Remove programming outstanding updates for dcn35
Dillon Varone [Thu, 26 Sep 2024 16:45:41 +0000 (12:45 -0400)]
drm/amd/display: Remove programming outstanding updates for dcn35

[WHY&HOW]
Programming outstanding updates is causing hangs on dcn35, so remove
for now.

Reviewed-by: Martin Leung <[email protected]>
Signed-off-by: Dillon Varone <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Fix low black values by increasing error
Peterson [Mon, 23 Sep 2024 14:30:50 +0000 (10:30 -0400)]
drm/amd/display: Fix low black values by increasing error

[WHY]
Regamma resolution for the first few black levels can have problems for
calibration.

[HOW]
HW LUT is divided into N power-of-2 regions each with K segments.  For
SDR mode we set min point at 2^-10 and increments of 2^-13. It's
generally more than 8-bit SDR needs, but some calibration tools and API
use 12-bit curves.
The fix shifts starting point to 2^-12 and starting increments at 2^-16.

Reviewed-by: Krunoslav Kovac <[email protected]>
Signed-off-by: Peterson <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Noitfy DMCUB of D0/D3 state in hardware init
JinZe.Xu [Thu, 26 Sep 2024 08:31:21 +0000 (16:31 +0800)]
drm/amd/display: Noitfy DMCUB of D0/D3 state in hardware init

[Why]
Missing a dc_dmub_srv_notify_fw_dc_power_state in driver init.

[How]
Notify DMCUB of D0 state in hardware_init.

Reviewed-by: Nicholas Kazlauskas <[email protected]>
Signed-off-by: JinZe.Xu <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Display lost signal on playing video
po-tchen [Fri, 20 Sep 2024 07:41:55 +0000 (15:41 +0800)]
drm/amd/display: Display lost signal on playing video

[Why]
When Source extend the vblank to reach the minimum panel
refresh rate, the vtotal length could have 1 line longer
than the maximum supported vtotal.
The reason is we optimized the vtotal/refresh-rate calculation
to get more accurate vtotal number by rounding the calculation
result. But when the target refresh rate is the minimum
refresh rate, the vtotal result could be round up and over
the maximum supported vtotal.

Reviewed-by: Anthony Koo <[email protected]>
Signed-off-by: po-tchen <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Fix garbage or black screen when resetting otg
Zhongwei [Wed, 18 Sep 2024 06:43:49 +0000 (14:43 +0800)]
drm/amd/display: Fix garbage or black screen when resetting otg

[Why]
For some EDP to MIPI panel, disabling OTG when link is alive like boot
case, the converter might output garbage or show no display because our
GPU is not sending required pixel data.
Alos Dig fifo underflow was found which might cause garbage, when
resetting otg for other types of EDP panels.

[How]
Skipping resetting OTG if the dig fifo is on. Make sure that the otg for
the pipe is the one that the dig fifo is selecting via the FE mask.

Reviewed-by: Nicholas Kazlauskas <[email protected]>
Signed-off-by: Zhongwei <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Assign socclk in dml
Sridevi Arvindekar [Fri, 20 Sep 2024 18:43:09 +0000 (14:43 -0400)]
drm/amd/display: Assign socclk in dml

Assign socclk_khz value from dcn4x.

Reviewed-by: Ariel Bernstein <[email protected]>
Signed-off-by: Sridevi Arvindekar <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: force TBT4 dock dsc on
Fudongwang [Sat, 14 Sep 2024 09:57:06 +0000 (17:57 +0800)]
drm/amd/display: force TBT4 dock dsc on

[why]
TBT4 dock have bandwidth limitation, need dsc always on to support all
modes.

[how]
force dsc always on when detect TBT4 dock.

Reviewed-by: Aric Cyr <[email protected]>
Signed-off-by: Fudongwang <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Revert commit Update Interface to Check UCLK DPM
Austin Zheng [Mon, 23 Sep 2024 14:07:32 +0000 (10:07 -0400)]
drm/amd/display: Revert commit Update Interface to Check UCLK DPM

This reverts commit b8d046985c2dc41a0e264a391da4606099f8d44f.

Reverting as regression discovered on certain systems and golden values
need to updated.

Reviewed-by: Alvin Lee <[email protected]>
Signed-off-by: Austin Zheng <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Flip All Planes Under OTG Master When Flip Immediate
Austin Zheng [Fri, 20 Sep 2024 18:22:38 +0000 (14:22 -0400)]
drm/amd/display: Flip All Planes Under OTG Master When Flip Immediate

[Why]
The MPO plane will receive a flip but
desktop plane may not receive a flip when GSL is enabled.
As a result, system will be stuck waiting for a flip that was never sent.

[How]
Set update address update flag of all flip_immediate planes
if there are multiple planes.

Reviewed-by: Dillon Varone <[email protected]>
Signed-off-by: Austin Zheng <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: skip disable CRTC in seemless bootup case
Fudongwang [Sat, 14 Sep 2024 01:33:44 +0000 (09:33 +0800)]
drm/amd/display: skip disable CRTC in seemless bootup case

Resync FIFO is a workaround to write the same value to
DENTIST_DISPCLK_CNTL register after programming OTG_PIXEL_RATE_DIV
register, in case seemless boot, there is no OTG_PIXEL_RATE_DIV register
update, so skip CRTC disable when resync FIFO to avoid random FIFO error
and garbage.

Reviewed-by: Nicholas Kazlauskas <[email protected]>
Signed-off-by: Fudongwang <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/display: Unify blank_phantom and blank_pixel_data
Austin Zheng [Mon, 16 Sep 2024 17:09:19 +0000 (13:09 -0400)]
drm/amd/display: Unify blank_phantom and blank_pixel_data

[Why]
dcn32_blank_phantom() does not consider the subVP+ODM case when blanking.
Only one of the pipes will get blanked. Remaining pipes are not blanked.
Will cause underflow in the phantom pipe when enabling the CRTC.

[How]
Use blank_pixel_data() instead of blank_phantom().
remove dcn32_blank_phantom() since logic is identical.
Different DPG dimensions get programmed when blanking phantom pipes.
Previously had phantom pipes use DPG dimensions of the main stream.
Now use DPG dimensions of the phantom streams

Reviewed-by: Alvin Lee <[email protected]>
Signed-off-by: Austin Zheng <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/radeon: add late_register for connector
Wu Hoi Pok [Fri, 4 Oct 2024 01:05:59 +0000 (09:05 +0800)]
drm/radeon: add late_register for connector

The patch is to solve null dereference in 'aux.dev', which is
introduced in recent radeon rework. By having 'late_register',
the connector should be registered after 'drm_dev_register'
automatically, where in before it is the opposite.

Fixes: 90985660ba48 ("drm/radeon: remove load callback from kms_driver")
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3665
Tested-by: Hans de Goede <[email protected]>
Suggested-by: Christophe Leroy <[email protected]>
Signed-off-by: Wu Hoi Pok <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu/gfx11: Apply Isolation Enforcement to GFX & Compute rings
Srinivasan Shanmugam [Wed, 2 Oct 2024 04:22:39 +0000 (09:52 +0530)]
drm/amdgpu/gfx11: Apply Isolation Enforcement to GFX & Compute rings

This commit applies isolation enforcement to the GFX and Compute rings
in the gfx_v11_0 module.

The commit sets `amdgpu_gfx_enforce_isolation_ring_begin_use` and
`amdgpu_gfx_enforce_isolation_ring_end_use` as the functions to be
called when a ring begins and ends its use, respectively.

`amdgpu_gfx_enforce_isolation_ring_begin_use` is called when a ring
begins its use. This function cancels any scheduled
`enforce_isolation_work` and, if necessary, signals the Kernel Fusion
Driver (KFD) to stop the runqueue.

`amdgpu_gfx_enforce_isolation_ring_end_use` is called when a ring ends
its use. This function schedules `enforce_isolation_work` to be run
after a delay.

These functions are part of the Enforce Isolation Handler, which
enforces shader isolation on AMD GPUs to prevent data leakage between
different processes.

Cc: Christian König <[email protected]>
Cc: Alex Deucher <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu/gfx12: Implement cleaner shader support for GFX12 hardware
Srinivasan Shanmugam [Wed, 2 Oct 2024 04:28:15 +0000 (09:58 +0530)]
drm/amdgpu/gfx12: Implement cleaner shader support for GFX12 hardware

This patch adds support for the PACKET3_RUN_CLEANER_SHADER packet in the
gfx_v12_0 module. This packet is used to emit the cleaner shader, which
is used to clear GPU memory before it's reused, helping to prevent data
leakage between different processes.

Finally, the patch updates the ring function structures to include the
new gfx_v12_0_ring_emit_cleaner_shader function. This allows the
cleaner shader to be emitted as part of the ring's operations.

Cc: Christian König <[email protected]>
Cc: Alex Deucher <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdkfd: Copy wave state only for compute queue
Philip Yang [Thu, 3 Oct 2024 15:53:51 +0000 (11:53 -0400)]
drm/amdkfd: Copy wave state only for compute queue

get_wave_state is not defined for sdma queue, copy_context_work_handler
calls it for sdma queue will crash.

Signed-off-by: Philip Yang <[email protected]>
Reviewed-by: Jonathan Kim <[email protected]>
Tested-by: Jonathan Kim <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdkfd: Increase SMI event fifo size
Philip Yang [Mon, 29 Jul 2024 18:42:18 +0000 (14:42 -0400)]
drm/amdkfd: Increase SMI event fifo size

SMI event fifo size 1KB was enough to report GPU vm fault or reset
event, but could drop the more frequent SVM migration events. Increase
kfifo size to 8KB to store about 100 migrate events, less chance to drop
the migrate events if lots of migration happened in the short period of
time. Add KFD prefix to the macro name.

Signed-off-by: Philip Yang <[email protected]>
Reviewed-by: James Zhu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: Fix spelling mistake "initializtion" -> "initialization"
Colin Ian King [Wed, 2 Oct 2024 07:51:24 +0000 (08:51 +0100)]
drm/amdgpu: Fix spelling mistake "initializtion" -> "initialization"

There is a spelling mistake in a dev_err message. Fix it.

Signed-off-by: Colin Ian King <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdkfd: Output migrate end event if migrate failed
Philip Yang [Fri, 16 Feb 2024 16:41:16 +0000 (11:41 -0500)]
drm/amdkfd: Output migrate end event if migrate failed

If page migration failed, also output migrate end event to match with
migrate start event, with failure error_code added to the end of the
migrate message macro. This will not break uAPI because application uses
old message macro sscanf drop and ignore the error_code.

Output GPU page fault restore end event if migration failed.

Signed-off-by: Philip Yang <[email protected]>
Reviewed-by: James Zhu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu/gfx11: Implement cleaner shader support for GFX11 hardware
Srinivasan Shanmugam [Thu, 3 Oct 2024 10:13:14 +0000 (15:43 +0530)]
drm/amdgpu/gfx11: Implement cleaner shader support for GFX11 hardware

The patch modifies the gfx_v11_0_kiq_set_resources function to write
the cleaner shader's memory controller address to the ring buffer. It
also adds a new function, gfx_v11_0_ring_emit_cleaner_shader, which
emits the PACKET3_RUN_CLEANER_SHADER packet to the ring buffer.

This patch adds support for the PACKET3_RUN_CLEANER_SHADER packet in the
gfx_v11_0 module. This packet is used to emit the cleaner shader, which
is used to clear GPU memory before it's reused, helping to prevent data
leakage between different processes.

Finally, the patch updates the ring function structures to include the
new gfx_v11_0_ring_emit_cleaner_shader function. This allows the
cleaner shader to be emitted as part of the ring's operations.

Cc: Christian König <[email protected]>
Cc: Alex Deucher <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/pm: use pm_runtime_get_if_active for debugfs getters
Pierre-Eric Pelloux-Prayer [Mon, 16 Sep 2024 14:49:15 +0000 (16:49 +0200)]
drm/amd/pm: use pm_runtime_get_if_active for debugfs getters

Don't wake up the GPU for reading pm values. Instead, take a runtime
powermanagement ref when trying to read it if and only if the GPU is
already awake.

This avoids spurious wake ups (eg: from applets).

We use pm_runtime_get_if_in_active because we care about "is the GPU awake?"
not about "is the GPU awake and something else prevents suspend?".

Tested-by: Mario Limonciello <[email protected]>
Reviewed-by: Kenneth Feng <[email protected]>
Signed-off-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: change the comment from handle to ip_block
Sunil Khatri [Wed, 2 Oct 2024 13:54:25 +0000 (19:24 +0530)]
drm/amdgpu: change the comment from handle to ip_block

htmldoc generation depend upon the input arguments etc
to generate the document. After update of handle to
ip_block then update needs in comments too to fix the
warnings.

Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]
Signed-off-by: Sunil Khatri <[email protected]>
Acked-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu/gfx10: Implement cleaner shader support for GFX10 hardware
Srinivasan Shanmugam [Wed, 2 Oct 2024 03:55:10 +0000 (09:25 +0530)]
drm/amdgpu/gfx10: Implement cleaner shader support for GFX10 hardware

The patch modifies the gfx_v10_0_kiq_set_resources function to write
the cleaner shader's memory controller address to the ring buffer. It
also adds a new function, gfx_v10_0_ring_emit_cleaner_shader, which
emits the PACKET3_RUN_CLEANER_SHADER packet to the ring buffer.

This patch adds support for the PACKET3_RUN_CLEANER_SHADER packet in the
gfx_v10_0 module. This packet is used to emit the cleaner shader, which
is used to clear GPU memory before it's reused, helping to prevent data
leakage between different processes.

Finally, the patch updates the ring function structures to include the
new gfx_v10_0_ring_emit_cleaner_shader function. This allows the
cleaner shader to be emitted as part of the ring's operations.

Cc: Christian König <[email protected]>
Cc: Alex Deucher <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdkfd: Fix an eviction fence leak
Lang Yu [Fri, 27 Sep 2024 10:27:46 +0000 (18:27 +0800)]
drm/amdkfd: Fix an eviction fence leak

Only creating a new reference for each process instead of each VM.

Fixes: 9a1c1339abf9 ("drm/amdkfd: Run restore_workers on freezable WQs")
Suggested-by: Felix Kuehling <[email protected]>
Signed-off-by: Lang Yu <[email protected]>
Reviewed-by: Felix Kuehling <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amd/pm: don't update runpm last_usage on debugfs getter
Pierre-Eric Pelloux-Prayer [Mon, 16 Sep 2024 14:35:15 +0000 (16:35 +0200)]
drm/amd/pm: don't update runpm last_usage on debugfs getter

Reading pm values from the GPU shouldn't prevent it to be suspended
by resetting the last active timestamp (eg: if an background app
monitors GPU sensors every second, it would prevent the autosuspend
sequence to trigger).

Tested-by: Mario Limonciello <[email protected]>
Reviewed-by: Kenneth Feng <[email protected]>
Signed-off-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: fix html doc generation warning
Sunil Khatri [Wed, 2 Oct 2024 09:22:52 +0000 (14:52 +0530)]
drm/amdgpu: fix html doc generation warning

Fix the html doc warning due to mix up of the
forward declaration of struct amdgpu_ip_block.

Signed-off-by: Sunil Khatri <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: update the handle ptr in hw_fini
Sunil Khatri [Wed, 2 Oct 2024 05:50:58 +0000 (11:20 +0530)]
drm/amdgpu: update the handle ptr in hw_fini

Update the *handle to amdgpu_ip_block ptr for all
functions pointers of hw_fini.

Also update the ip_block ptr where ever needed as
there were cyclic dependency of hw_fini on suspend
and some followed clean up.

Signed-off-by: Sunil Khatri <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: update the handle ptr in hw_init
Sunil Khatri [Tue, 1 Oct 2024 06:05:14 +0000 (11:35 +0530)]
drm/amdgpu: update the handle ptr in hw_init

Update the *handle to amdgpu_ip_block ptr for all
functions pointers of hw_init.

Also update the ip_block ptr where ever needed as
there were cyclic dependency of hw_init on resume.

v2: squash in isp fix

Signed-off-by: Sunil Khatri <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: update the handle ptr in resume
Sunil Khatri [Mon, 30 Sep 2024 12:12:01 +0000 (17:42 +0530)]
drm/amdgpu: update the handle ptr in resume

Update the *handle to amdgpu_ip_block ptr for all
functions pointers of resume.

Signed-off-by: Sunil Khatri <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: update the handle ptr in suspend
Sunil Khatri [Mon, 30 Sep 2024 11:30:38 +0000 (17:00 +0530)]
drm/amdgpu: update the handle ptr in suspend

Update the *handle to amdgpu_ip_block ptr for all
functions pointers of suspend.

Signed-off-by: Sunil Khatri <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
5 months agodrm/amdgpu: update the handle ptr in wait_for_idle
Sunil Khatri [Mon, 30 Sep 2024 10:59:15 +0000 (16:29 +0530)]
drm/amdgpu: update the handle ptr in wait_for_idle

Update the *handle to amdgpu_ip_block ptr for all
functions pointers of wait_for_idle.

Signed-off-by: Sunil Khatri <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
This page took 0.116981 seconds and 4 git commands to generate.