Skip to content

Commit a60f627

Browse files
committed
Merge tag 'amd-drm-next-6.20-2026-01-30' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.20-2026-01-30: amdgpu: - Misc cleanups - SMU 13 fixes - SMU 14 fixes - GPUVM fault filter fix - USB4 fixes - DC FP guard fixes - Powergating fix - JPEG ring reset fix - RAS fixes - Xclk fix for soc21 APUs - Fix COND_EXEC handling for GC 11 - UserQ fixes - MQD size alignment fixes - SMU feature interface cleanup - GC 10-12 KGQ init fixes - GC 11-12 KGQ reset fixes amdkfd: - Fix device snapshot reporting - GC 12.1 trap handler fixes - MQD size alignment fixes Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patch.msgid.link/[email protected]
2 parents 502d2d8 + 0a6d6ed commit a60f627

75 files changed

Lines changed: 743 additions & 576 deletions

Some content is hidden

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

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,14 @@ struct amdgpu_device {
12391239
struct amdgpu_kfd_dev kfd;
12401240
};
12411241

1242+
/*
1243+
* MES FW uses address(mqd_addr + sizeof(struct mqd) + 3*sizeof(uint32_t))
1244+
* as fence address and writes a 32 bit fence value to this address.
1245+
* Driver needs to allocate at least 4 DWs extra memory in addition to
1246+
* sizeof(struct mqd). Add 8 DWs and align to AMDGPU_GPU_PAGE_SIZE for safety.
1247+
*/
1248+
#define AMDGPU_MQD_SIZE_ALIGN(mqd_size) AMDGPU_GPU_PAGE_ALIGN(((mqd_size) + 32))
1249+
12421250
static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
12431251
uint8_t ip, uint8_t inst)
12441252
{

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,9 @@ static int amdgpu_bo_list_entry_cmp(const void *_a, const void *_b)
6060
{
6161
const struct amdgpu_bo_list_entry *a = _a, *b = _b;
6262

63-
if (a->priority > b->priority)
64-
return 1;
65-
if (a->priority < b->priority)
66-
return -1;
67-
return 0;
63+
BUILD_BUG_ON(AMDGPU_BO_LIST_MAX_PRIORITY >= INT_MAX);
64+
65+
return (int)a->priority - (int)b->priority;
6866
}
6967

7068
int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
385385
struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];
386386
struct amdgpu_ring *ring = &kiq->ring;
387387
u32 domain = AMDGPU_GEM_DOMAIN_GTT;
388+
u32 gfx_mqd_size = max(adev->mqds[AMDGPU_HW_IP_GFX].mqd_size, mqd_size);
389+
u32 compute_mqd_size = max(adev->mqds[AMDGPU_HW_IP_COMPUTE].mqd_size, mqd_size);
388390

389391
#if !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
390392
/* Only enable on gfx10 and 11 for now to avoid changing behavior on older chips */
@@ -424,17 +426,17 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
424426
for (i = 0; i < adev->gfx.num_gfx_rings; i++) {
425427
ring = &adev->gfx.gfx_ring[i];
426428
if (!ring->mqd_obj) {
427-
r = amdgpu_bo_create_kernel(adev, mqd_size, PAGE_SIZE,
428-
domain, &ring->mqd_obj,
429+
r = amdgpu_bo_create_kernel(adev, AMDGPU_MQD_SIZE_ALIGN(gfx_mqd_size),
430+
PAGE_SIZE, domain, &ring->mqd_obj,
429431
&ring->mqd_gpu_addr, &ring->mqd_ptr);
430432
if (r) {
431433
dev_warn(adev->dev, "failed to create ring mqd bo (%d)", r);
432434
return r;
433435
}
434436

435-
ring->mqd_size = mqd_size;
437+
ring->mqd_size = gfx_mqd_size;
436438
/* prepare MQD backup */
437-
adev->gfx.me.mqd_backup[i] = kzalloc(mqd_size, GFP_KERNEL);
439+
adev->gfx.me.mqd_backup[i] = kzalloc(gfx_mqd_size, GFP_KERNEL);
438440
if (!adev->gfx.me.mqd_backup[i]) {
439441
dev_warn(adev->dev, "no memory to create MQD backup for ring %s\n", ring->name);
440442
return -ENOMEM;
@@ -448,17 +450,17 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
448450
j = i + xcc_id * adev->gfx.num_compute_rings;
449451
ring = &adev->gfx.compute_ring[j];
450452
if (!ring->mqd_obj) {
451-
r = amdgpu_bo_create_kernel(adev, mqd_size, PAGE_SIZE,
452-
domain, &ring->mqd_obj,
453+
r = amdgpu_bo_create_kernel(adev, AMDGPU_MQD_SIZE_ALIGN(compute_mqd_size),
454+
PAGE_SIZE, domain, &ring->mqd_obj,
453455
&ring->mqd_gpu_addr, &ring->mqd_ptr);
454456
if (r) {
455457
dev_warn(adev->dev, "failed to create ring mqd bo (%d)", r);
456458
return r;
457459
}
458460

459-
ring->mqd_size = mqd_size;
461+
ring->mqd_size = compute_mqd_size;
460462
/* prepare MQD backup */
461-
adev->gfx.mec.mqd_backup[j] = kzalloc(mqd_size, GFP_KERNEL);
463+
adev->gfx.mec.mqd_backup[j] = kzalloc(compute_mqd_size, GFP_KERNEL);
462464
if (!adev->gfx.mec.mqd_backup[j]) {
463465
dev_warn(adev->dev, "no memory to create MQD backup for ring %s\n", ring->name);
464466
return -ENOMEM;

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,13 @@ void amdgpu_gmc_filter_faults_remove(struct amdgpu_device *adev, uint64_t addr,
498498

499499
if (adev->irq.retry_cam_enabled)
500500
return;
501+
else if (adev->irq.ih1.ring_size)
502+
ih = &adev->irq.ih1;
503+
else if (adev->irq.ih_soft.enabled)
504+
ih = &adev->irq.ih_soft;
505+
else
506+
return;
501507

502-
ih = &adev->irq.ih1;
503508
/* Get the WPTR of the last entry in IH ring */
504509
last_wptr = amdgpu_ih_get_wptr(adev, ih);
505510
/* Order wptr with ring data. */

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
235235

236236
amdgpu_ring_ib_begin(ring);
237237

238-
if (ring->funcs->emit_gfx_shadow)
238+
if (ring->funcs->emit_gfx_shadow && adev->gfx.cp_gfx_shadow)
239239
amdgpu_ring_emit_gfx_shadow(ring, shadow_va, csa_va, gds_va,
240240
init_shadow, vmid);
241241

@@ -291,7 +291,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
291291
fence_flags | AMDGPU_FENCE_FLAG_64BIT);
292292
}
293293

294-
if (ring->funcs->emit_gfx_shadow && ring->funcs->init_cond_exec) {
294+
if (ring->funcs->emit_gfx_shadow && ring->funcs->init_cond_exec &&
295+
adev->gfx.cp_gfx_shadow) {
295296
amdgpu_ring_emit_gfx_shadow(ring, 0, 0, 0, false, 0);
296297
amdgpu_ring_init_cond_exec(ring, ring->cond_exe_gpu_addr);
297298
}

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ int amdgpu_mes_init(struct amdgpu_device *adev)
115115

116116
adev->mes.adev = adev;
117117

118-
idr_init(&adev->mes.pasid_idr);
119-
idr_init(&adev->mes.gang_id_idr);
120-
idr_init(&adev->mes.queue_id_idr);
121118
ida_init(&adev->mes.doorbell_ida);
122119
spin_lock_init(&adev->mes.queue_id_lock);
123120
mutex_init(&adev->mes.mutex_hidden);
@@ -252,9 +249,6 @@ int amdgpu_mes_init(struct amdgpu_device *adev)
252249
&adev->mes.hung_queue_db_array_cpu_addr[i]);
253250
}
254251

255-
idr_destroy(&adev->mes.pasid_idr);
256-
idr_destroy(&adev->mes.gang_id_idr);
257-
idr_destroy(&adev->mes.queue_id_idr);
258252
ida_destroy(&adev->mes.doorbell_ida);
259253
mutex_destroy(&adev->mes.mutex_hidden);
260254
return r;
@@ -283,9 +277,6 @@ void amdgpu_mes_fini(struct amdgpu_device *adev)
283277

284278
amdgpu_mes_doorbell_free(adev);
285279

286-
idr_destroy(&adev->mes.pasid_idr);
287-
idr_destroy(&adev->mes.gang_id_idr);
288-
idr_destroy(&adev->mes.queue_id_idr);
289280
ida_destroy(&adev->mes.doorbell_ida);
290281
mutex_destroy(&adev->mes.mutex_hidden);
291282
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ struct amdgpu_mes {
7777

7878
struct mutex mutex_hidden;
7979

80-
struct idr pasid_idr;
81-
struct idr gang_id_idr;
82-
struct idr queue_id_idr;
8380
struct ida doorbell_ida;
8481

8582
spinlock_t queue_id_lock;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,6 +1712,10 @@ int amdgpu_ras_eeprom_check(struct amdgpu_ras_eeprom_control *control)
17121712
dev_warn(adev->dev, "RAS records:%u exceeds 90%% of threshold:%d",
17131713
control->ras_num_bad_pages,
17141714
ras->bad_page_cnt_threshold);
1715+
if (amdgpu_bad_page_threshold != 0 &&
1716+
control->ras_num_bad_pages >= ras->bad_page_cnt_threshold)
1717+
amdgpu_dpm_send_rma_reason(adev);
1718+
17151719
} else if (hdr->header == RAS_TABLE_HDR_BAD &&
17161720
amdgpu_bad_page_threshold != 0) {
17171721
if (hdr->version >= RAS_TABLE_VER_V2_1) {

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,17 @@ static int amdgpu_userq_input_args_validate(struct drm_device *dev,
932932
drm_file_err(filp, "invalidate userq queue va or size\n");
933933
return -EINVAL;
934934
}
935+
936+
if (!is_power_of_2(args->in.queue_size)) {
937+
drm_file_err(filp, "Queue size must be a power of 2\n");
938+
return -EINVAL;
939+
}
940+
941+
if (args->in.queue_size < AMDGPU_GPU_PAGE_SIZE) {
942+
drm_file_err(filp, "Queue size smaller than AMDGPU_GPU_PAGE_SIZE\n");
943+
return -EINVAL;
944+
}
945+
935946
if (!args->in.wptr_va || !args->in.rptr_va) {
936947
drm_file_err(filp, "invalidate userq queue rptr or wptr\n");
937948
return -EINVAL;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6880,7 +6880,7 @@ static int gfx_v10_0_kgq_init_queue(struct amdgpu_ring *ring, bool reset)
68806880
memcpy_toio(mqd, adev->gfx.me.mqd_backup[mqd_idx], sizeof(*mqd));
68816881
/* reset the ring */
68826882
ring->wptr = 0;
6883-
*ring->wptr_cpu_addr = 0;
6883+
atomic64_set((atomic64_t *)ring->wptr_cpu_addr, 0);
68846884
amdgpu_ring_clear_ring(ring);
68856885
}
68866886

0 commit comments

Comments
 (0)