Skip to content

Commit acab5fb

Browse files
committed
Merge tag 'amd-drm-next-6.17-2025-07-17' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.17-2025-07-17: amdgpu: - Partition fixes - Reset fixes - RAS fixes - i2c fix - MPC updates - DSC cleanup - EDID fixes - Display idle D3 update - IPS updates - DMUB updates - Retimer fix - Replay fixes - Fix DC memory leak - Initial support for smartmux - DCN 4.0.1 degamma LUT fix - Per queue reset cleanups - Track ring state associated with a fence - SR-IOV fixes - SMU fixes - Per queue reset improvements for GC 9+ compute - Per queue reset improvements for GC 10+ gfx - Per queue reset improvements for SDMA 5+ - Per queue reset improvements for JPEG 2+ - Per queue reset improvements for VCN 2+ - GC 8 fix - ISP updates amdkfd: - Enable KFD on LoongArch radeon: - Drop console lock during suspend/resume UAPI: - Add userq slot info to INFO IOCTL Used for IGT userq validation tests (https://lists.freedesktop.org/archives/igt-dev/2025-July/093228.html) From: Alex Deucher <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dave Airlie <[email protected]>
2 parents be3cd66 + 6ac55ea commit acab5fb

File tree

128 files changed

+2016
-547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+2016
-547
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,7 @@ static inline bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return
17231723
#endif
17241724

17251725
#if defined(CONFIG_DRM_AMD_ISP)
1726-
int amdgpu_acpi_get_isp4_dev_hid(u8 (*hid)[ACPI_ID_LEN]);
1726+
int amdgpu_acpi_get_isp4_dev(struct acpi_device **dev);
17271727
#endif
17281728

17291729
void amdgpu_register_gpu_instance(struct amdgpu_device *adev);

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,7 @@ static int isp_match_acpi_device_ids(struct device *dev, const void *data)
15451545
return acpi_match_device(data, dev) ? 1 : 0;
15461546
}
15471547

1548-
int amdgpu_acpi_get_isp4_dev_hid(u8 (*hid)[ACPI_ID_LEN])
1548+
int amdgpu_acpi_get_isp4_dev(struct acpi_device **dev)
15491549
{
15501550
struct device *pdev __free(put_device) = NULL;
15511551
struct acpi_device *acpi_pdev;
@@ -1559,7 +1559,7 @@ int amdgpu_acpi_get_isp4_dev_hid(u8 (*hid)[ACPI_ID_LEN])
15591559
if (!acpi_pdev)
15601560
return -ENODEV;
15611561

1562-
strscpy(*hid, acpi_device_hid(acpi_pdev));
1562+
*dev = acpi_pdev;
15631563

15641564
return 0;
15651565
}

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4220,18 +4220,10 @@ static int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
42204220
int ret = 0;
42214221

42224222
/*
4223-
* By default timeout for non compute jobs is 10000
4224-
* and 60000 for compute jobs.
4225-
* In SR-IOV or passthrough mode, timeout for compute
4226-
* jobs are 60000 by default.
4223+
* By default timeout for jobs is 10 sec
42274224
*/
4228-
adev->gfx_timeout = msecs_to_jiffies(10000);
4225+
adev->compute_timeout = adev->gfx_timeout = msecs_to_jiffies(10000);
42294226
adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
4230-
if (amdgpu_sriov_vf(adev))
4231-
adev->compute_timeout = amdgpu_sriov_is_pp_one_vf(adev) ?
4232-
msecs_to_jiffies(60000) : msecs_to_jiffies(10000);
4233-
else
4234-
adev->compute_timeout = msecs_to_jiffies(60000);
42354227

42364228
if (strnlen(input, AMDGPU_MAX_TIMEOUT_PARAM_LENGTH)) {
42374229
while ((timeout_setting = strsep(&input, ",")) &&

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,12 @@ module_param_named(svm_default_granularity, amdgpu_svm_default_granularity, uint
362362
* The second one is for Compute. The third and fourth ones are
363363
* for SDMA and Video.
364364
*
365-
* By default(with no lockup_timeout settings), the timeout for all non-compute(GFX, SDMA and Video)
366-
* jobs is 10000. The timeout for compute is 60000.
365+
* By default(with no lockup_timeout settings), the timeout for all jobs is 10000.
367366
*/
368-
MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default: for bare metal 10000 for non-compute jobs and 60000 for compute jobs; "
369-
"for passthrough or sriov, 10000 for all jobs. 0: keep default value. negative: infinity timeout), format: for bare metal [Non-Compute] or [GFX,Compute,SDMA,Video]; "
370-
"for passthrough or sriov [all jobs] or [GFX,Compute,SDMA,Video].");
367+
MODULE_PARM_DESC(lockup_timeout,
368+
"GPU lockup timeout in ms (default: 10000 for all jobs. "
369+
"0: keep default value. negative: infinity timeout), format: for bare metal [Non-Compute] or [GFX,Compute,SDMA,Video]; "
370+
"for passthrough or sriov [all jobs] or [GFX,Compute,SDMA,Video].");
371371
module_param_string(lockup_timeout, amdgpu_lockup_timeout, sizeof(amdgpu_lockup_timeout), 0444);
372372

373373
/**
@@ -2512,6 +2512,7 @@ amdgpu_pci_remove(struct pci_dev *pdev)
25122512
struct drm_device *dev = pci_get_drvdata(pdev);
25132513
struct amdgpu_device *adev = drm_to_adev(dev);
25142514

2515+
amdgpu_ras_eeprom_check_and_recover(adev);
25152516
amdgpu_xcp_dev_unplug(adev);
25162517
amdgpu_gmc_prepare_nps_mode_change(adev);
25172518
drm_dev_unplug(dev);

drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,15 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f,
120120
am_fence = kzalloc(sizeof(*am_fence), GFP_KERNEL);
121121
if (!am_fence)
122122
return -ENOMEM;
123+
am_fence->context = 0;
123124
} else {
124125
am_fence = af;
125126
}
126127
fence = &am_fence->base;
127128
am_fence->ring = ring;
128129

129130
seq = ++ring->fence_drv.sync_seq;
131+
am_fence->seq = seq;
130132
if (af) {
131133
dma_fence_init(fence, &amdgpu_job_fence_ops,
132134
&ring->fence_drv.lock,
@@ -141,6 +143,7 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f,
141143

142144
amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr,
143145
seq, flags | AMDGPU_FENCE_FLAG_INT);
146+
amdgpu_fence_save_wptr(fence);
144147
pm_runtime_get_noresume(adev_to_drm(adev)->dev);
145148
ptr = &ring->fence_drv.fences[seq & ring->fence_drv.num_fences_mask];
146149
if (unlikely(rcu_dereference_protected(*ptr, 1))) {
@@ -253,6 +256,7 @@ bool amdgpu_fence_process(struct amdgpu_ring *ring)
253256

254257
do {
255258
struct dma_fence *fence, **ptr;
259+
struct amdgpu_fence *am_fence;
256260

257261
++last_seq;
258262
last_seq &= drv->num_fences_mask;
@@ -265,6 +269,12 @@ bool amdgpu_fence_process(struct amdgpu_ring *ring)
265269
if (!fence)
266270
continue;
267271

272+
/* Save the wptr in the fence driver so we know what the last processed
273+
* wptr was. This is required for re-emitting the ring state for
274+
* queues that are reset but are not guilty and thus have no guilty fence.
275+
*/
276+
am_fence = container_of(fence, struct amdgpu_fence, base);
277+
drv->signalled_wptr = am_fence->wptr;
268278
dma_fence_signal(fence);
269279
dma_fence_put(fence);
270280
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
@@ -727,6 +737,86 @@ void amdgpu_fence_driver_force_completion(struct amdgpu_ring *ring)
727737
amdgpu_fence_process(ring);
728738
}
729739

740+
741+
/**
742+
* Kernel queue reset handling
743+
*
744+
* The driver can reset individual queues for most engines, but those queues
745+
* may contain work from multiple contexts. Resetting the queue will reset
746+
* lose all of that state. In order to minimize the collateral damage, the
747+
* driver will save the ring contents which are not associated with the guilty
748+
* context prior to resetting the queue. After resetting the queue the queue
749+
* contents from the other contexts is re-emitted to the rings so that it can
750+
* be processed by the engine. To handle this, we save the queue's write
751+
* pointer (wptr) in the fences associated with each context. If we get a
752+
* queue timeout, we can then use the wptrs from the fences to determine
753+
* which data needs to be saved out of the queue's ring buffer.
754+
*/
755+
756+
/**
757+
* amdgpu_fence_driver_guilty_force_completion - force signal of specified sequence
758+
*
759+
* @fence: fence of the ring to signal
760+
*
761+
*/
762+
void amdgpu_fence_driver_guilty_force_completion(struct amdgpu_fence *fence)
763+
{
764+
dma_fence_set_error(&fence->base, -ETIME);
765+
amdgpu_fence_write(fence->ring, fence->seq);
766+
amdgpu_fence_process(fence->ring);
767+
}
768+
769+
void amdgpu_fence_save_wptr(struct dma_fence *fence)
770+
{
771+
struct amdgpu_fence *am_fence = container_of(fence, struct amdgpu_fence, base);
772+
773+
am_fence->wptr = am_fence->ring->wptr;
774+
}
775+
776+
static void amdgpu_ring_backup_unprocessed_command(struct amdgpu_ring *ring,
777+
u64 start_wptr, u32 end_wptr)
778+
{
779+
unsigned int first_idx = start_wptr & ring->buf_mask;
780+
unsigned int last_idx = end_wptr & ring->buf_mask;
781+
unsigned int i;
782+
783+
/* Backup the contents of the ring buffer. */
784+
for (i = first_idx; i != last_idx; ++i, i &= ring->buf_mask)
785+
ring->ring_backup[ring->ring_backup_entries_to_copy++] = ring->ring[i];
786+
}
787+
788+
void amdgpu_ring_backup_unprocessed_commands(struct amdgpu_ring *ring,
789+
struct amdgpu_fence *guilty_fence)
790+
{
791+
struct dma_fence *unprocessed;
792+
struct dma_fence __rcu **ptr;
793+
struct amdgpu_fence *fence;
794+
u64 wptr, i, seqno;
795+
796+
seqno = amdgpu_fence_read(ring);
797+
wptr = ring->fence_drv.signalled_wptr;
798+
ring->ring_backup_entries_to_copy = 0;
799+
800+
for (i = seqno + 1; i <= ring->fence_drv.sync_seq; ++i) {
801+
ptr = &ring->fence_drv.fences[i & ring->fence_drv.num_fences_mask];
802+
rcu_read_lock();
803+
unprocessed = rcu_dereference(*ptr);
804+
805+
if (unprocessed && !dma_fence_is_signaled(unprocessed)) {
806+
fence = container_of(unprocessed, struct amdgpu_fence, base);
807+
808+
/* save everything if the ring is not guilty, otherwise
809+
* just save the content from other contexts.
810+
*/
811+
if (!guilty_fence || (fence->context != guilty_fence->context))
812+
amdgpu_ring_backup_unprocessed_command(ring, wptr,
813+
fence->wptr);
814+
wptr = fence->wptr;
815+
}
816+
rcu_read_unlock();
817+
}
818+
}
819+
730820
/*
731821
* Common fence implementation
732822
*/

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
139139
int vmid = AMDGPU_JOB_GET_VMID(job);
140140
bool need_pipe_sync = false;
141141
unsigned int cond_exec;
142-
143142
unsigned int i;
144143
int r = 0;
145144

@@ -156,6 +155,11 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
156155
gds_va = job->gds_va;
157156
init_shadow = job->init_shadow;
158157
af = &job->hw_fence;
158+
/* Save the context of the job for reset handling.
159+
* The driver needs this so it can skip the ring
160+
* contents for guilty contexts.
161+
*/
162+
af->context = job->base.s_fence ? job->base.s_fence->finished.context : 0;
159163
} else {
160164
vm = NULL;
161165
fence_ctx = 0;
@@ -307,8 +311,17 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
307311
ring->hw_prio == AMDGPU_GFX_PIPE_PRIO_HIGH)
308312
ring->funcs->emit_wave_limit(ring, false);
309313

314+
/* Save the wptr associated with this fence.
315+
* This must be last for resets to work properly
316+
* as we need to save the wptr associated with this
317+
* fence so we know what rings contents to backup
318+
* after we reset the queue.
319+
*/
320+
amdgpu_fence_save_wptr(*f);
321+
310322
amdgpu_ring_ib_end(ring);
311323
amdgpu_ring_commit(ring);
324+
312325
return 0;
313326
}
314327

drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ int amdgpu_irq_put(struct amdgpu_device *adev, struct amdgpu_irq_src *src,
624624
unsigned int type)
625625
{
626626
/* When the threshold is reached,the interrupt source may not be enabled.return -EINVAL */
627-
if (amdgpu_ras_is_rma(adev))
627+
if (amdgpu_ras_is_rma(adev) && !amdgpu_irq_enabled(adev, src, type))
628628
return -EINVAL;
629629

630630
if (!adev->irq.installed)

0 commit comments

Comments
 (0)