Skip to content

Commit b006ef5

Browse files
committed
Merge tag 'amd-drm-fixes-7.1-2026-04-30' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-7.1-2026-04-30: amdgpu: - GFX12 fix for CONFIG_DRM_DEBUG_MM configs - Fix DC analog support - Userq fixes - GART placement fix - Aldebaran SMU fixes - AMDGPU_INFO_READ_MMR_REG fix - UVD 3.1 fix - GC 6 TCC fix - Fix root reservation in amdgpu_vm_handle_fault() - RAS fix - Module reload fix for APUs - Fix build for CONFIG_DRM_FBDEV_EMULATION=n - IGT DWB regression fix - GC 11.5.4 fix - VCN user fence fixes - JPEG user fence fixes - SMU 13.0.6 fix - VCN 3/4 IB parser fixes - NV3x+ dGPU vblank fix - DCE6/8 fixes for LVDS/eDP panels without an EDID amdkfd: - Fix for when CONFIG_HSA_AMD is not set - SVM fixes Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patch.msgid.link/20260430135619.3929877-1-alexander.deucher@amd.com
2 parents 39436e1 + 019155e commit b006ef5

56 files changed

Lines changed: 447 additions & 152 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_device.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2839,8 +2839,12 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
28392839
* that checks whether the PSP is running. A solution for those issues
28402840
* in the APU is to trigger a GPU reset, but this should be done during
28412841
* the unload phase to avoid adding boot latency and screen flicker.
2842+
* GFX V11 has GC block as default off IP. Every time AMDGPU driver sends
2843+
* a request to PMFW to unload MP1, PMFW will put GC in reset and power down
2844+
* the voltage. Hence, skipping reset for APUs with GFX V11 or later.
28422845
*/
2843-
if ((adev->flags & AMD_IS_APU) && !adev->gmc.is_app_apu) {
2846+
if ((adev->flags & AMD_IS_APU) && !adev->gmc.is_app_apu &&
2847+
amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(11, 0, 0)) {
28442848
r = amdgpu_asic_reset(adev);
28452849
if (r)
28462850
dev_err(adev->dev, "asic reset on %s failed\n", __func__);

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3090,10 +3090,8 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
30903090
case IP_VERSION(11, 5, 1):
30913091
case IP_VERSION(11, 5, 2):
30923092
case IP_VERSION(11, 5, 3):
3093-
adev->family = AMDGPU_FAMILY_GC_11_5_0;
3094-
break;
30953093
case IP_VERSION(11, 5, 4):
3096-
adev->family = AMDGPU_FAMILY_GC_11_5_4;
3094+
adev->family = AMDGPU_FAMILY_GC_11_5_0;
30973095
break;
30983096
case IP_VERSION(12, 0, 0):
30993097
case IP_VERSION(12, 0, 1):

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3158,8 +3158,10 @@ static int __init amdgpu_init(void)
31583158
amdgpu_register_atpx_handler();
31593159
amdgpu_acpi_detect();
31603160

3161-
/* Ignore KFD init failures. Normal when CONFIG_HSA_AMD is not set. */
3162-
amdgpu_amdkfd_init();
3161+
/* Ignore KFD init failures when CONFIG_HSA_AMD is not set. */
3162+
r = amdgpu_amdkfd_init();
3163+
if (r && r != -ENOENT)
3164+
goto error_fence;
31633165

31643166
if (amdgpu_pp_feature_mask & PP_OVERDRIVE_MASK) {
31653167
add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,10 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc,
314314
mc->gart_start = max_mc_address - mc->gart_size + 1;
315315
break;
316316
case AMDGPU_GART_PLACEMENT_LOW:
317-
mc->gart_start = 0;
317+
if (size_bf >= mc->gart_size)
318+
mc->gart_start = 0;
319+
else
320+
mc->gart_start = ALIGN(mc->fb_end, four_gb);
318321
break;
319322
case AMDGPU_GART_PLACEMENT_BEST_FIT:
320323
default:

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

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -873,68 +873,59 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
873873
? -EFAULT : 0;
874874
}
875875
case AMDGPU_INFO_READ_MMR_REG: {
876-
int ret = 0;
877-
unsigned int n, alloc_size;
878-
uint32_t *regs;
879876
unsigned int se_num = (info->read_mmr_reg.instance >>
880877
AMDGPU_INFO_MMR_SE_INDEX_SHIFT) &
881878
AMDGPU_INFO_MMR_SE_INDEX_MASK;
882879
unsigned int sh_num = (info->read_mmr_reg.instance >>
883880
AMDGPU_INFO_MMR_SH_INDEX_SHIFT) &
884881
AMDGPU_INFO_MMR_SH_INDEX_MASK;
885-
886-
if (!down_read_trylock(&adev->reset_domain->sem))
887-
return -ENOENT;
882+
unsigned int alloc_size;
883+
uint32_t *regs;
884+
int ret;
888885

889886
/* set full masks if the userspace set all bits
890887
* in the bitfields
891888
*/
892-
if (se_num == AMDGPU_INFO_MMR_SE_INDEX_MASK) {
889+
if (se_num == AMDGPU_INFO_MMR_SE_INDEX_MASK)
893890
se_num = 0xffffffff;
894-
} else if (se_num >= AMDGPU_GFX_MAX_SE) {
895-
ret = -EINVAL;
896-
goto out;
897-
}
891+
else if (se_num >= AMDGPU_GFX_MAX_SE)
892+
return -EINVAL;
898893

899-
if (sh_num == AMDGPU_INFO_MMR_SH_INDEX_MASK) {
894+
if (sh_num == AMDGPU_INFO_MMR_SH_INDEX_MASK)
900895
sh_num = 0xffffffff;
901-
} else if (sh_num >= AMDGPU_GFX_MAX_SH_PER_SE) {
902-
ret = -EINVAL;
903-
goto out;
904-
}
896+
else if (sh_num >= AMDGPU_GFX_MAX_SH_PER_SE)
897+
return -EINVAL;
905898

906-
if (info->read_mmr_reg.count > 128) {
907-
ret = -EINVAL;
908-
goto out;
909-
}
899+
if (info->read_mmr_reg.count > 128)
900+
return -EINVAL;
910901

911-
regs = kmalloc_array(info->read_mmr_reg.count, sizeof(*regs), GFP_KERNEL);
912-
if (!regs) {
913-
ret = -ENOMEM;
914-
goto out;
915-
}
902+
regs = kmalloc_array(info->read_mmr_reg.count, sizeof(*regs),
903+
GFP_KERNEL);
904+
if (!regs)
905+
return -ENOMEM;
916906

907+
down_read(&adev->reset_domain->sem);
917908
alloc_size = info->read_mmr_reg.count * sizeof(*regs);
918-
919909
amdgpu_gfx_off_ctrl(adev, false);
910+
ret = 0;
920911
for (i = 0; i < info->read_mmr_reg.count; i++) {
921912
if (amdgpu_asic_read_register(adev, se_num, sh_num,
922913
info->read_mmr_reg.dword_offset + i,
923914
&regs[i])) {
924915
DRM_DEBUG_KMS("unallowed offset %#x\n",
925916
info->read_mmr_reg.dword_offset + i);
926-
kfree(regs);
927-
amdgpu_gfx_off_ctrl(adev, true);
928917
ret = -EFAULT;
929-
goto out;
918+
break;
930919
}
931920
}
932921
amdgpu_gfx_off_ctrl(adev, true);
933-
n = copy_to_user(out, regs, min(size, alloc_size));
934-
kfree(regs);
935-
ret = (n ? -EFAULT : 0);
936-
out:
937922
up_read(&adev->reset_domain->sem);
923+
924+
if (!ret) {
925+
ret = copy_to_user(out, regs, min(size, alloc_size))
926+
? -EFAULT : 0;
927+
}
928+
kfree(regs);
938929
return ret;
939930
}
940931
case AMDGPU_INFO_DEV_INFO: {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1950,7 +1950,7 @@ void amdgpu_ras_check_bad_page_status(struct amdgpu_device *adev)
19501950
if (!control || amdgpu_bad_page_threshold == 0)
19511951
return;
19521952

1953-
if (control->ras_num_bad_pages >= ras->bad_page_cnt_threshold) {
1953+
if (control->ras_num_bad_pages > ras->bad_page_cnt_threshold) {
19541954
if (amdgpu_dpm_send_rma_reason(adev))
19551955
dev_warn(adev->dev, "Unable to send out-of-band RMA CPER");
19561956
else

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ static int amdgpu_ttm_init_on_chip(struct amdgpu_device *adev,
7575
unsigned int type,
7676
uint64_t size_in_page)
7777
{
78+
if (!size_in_page)
79+
return 0;
80+
7881
return ttm_range_man_init(&adev->mman.bdev, type,
7982
false, size_in_page);
8083
}

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,19 @@ void amdgpu_userq_start_hang_detect_work(struct amdgpu_usermode_queue *queue)
205205
msecs_to_jiffies(timeout_ms));
206206
}
207207

208+
void amdgpu_userq_process_fence_irq(struct amdgpu_device *adev, u32 doorbell)
209+
{
210+
struct xarray *xa = &adev->userq_doorbell_xa;
211+
struct amdgpu_usermode_queue *queue;
212+
unsigned long flags;
213+
214+
xa_lock_irqsave(xa, flags);
215+
queue = xa_load(xa, doorbell);
216+
if (queue)
217+
amdgpu_userq_fence_driver_process(queue->fence_drv);
218+
xa_unlock_irqrestore(xa, flags);
219+
}
220+
208221
static void amdgpu_userq_init_hang_detect_work(struct amdgpu_usermode_queue *queue)
209222
{
210223
INIT_DELAYED_WORK(&queue->hang_detect_work, amdgpu_userq_hang_detect_work);
@@ -643,12 +656,6 @@ amdgpu_userq_destroy(struct amdgpu_userq_mgr *uq_mgr, struct amdgpu_usermode_que
643656
#endif
644657
amdgpu_userq_detect_and_reset_queues(uq_mgr);
645658
r = amdgpu_userq_unmap_helper(queue);
646-
/*TODO: It requires a reset for userq hw unmap error*/
647-
if (r) {
648-
drm_warn(adev_to_drm(uq_mgr->adev), "trying to destroy a HW mapping userq\n");
649-
queue->state = AMDGPU_USERQ_STATE_HUNG;
650-
}
651-
652659
atomic_dec(&uq_mgr->userq_count[queue->queue_type]);
653660
amdgpu_userq_cleanup(queue);
654661
mutex_unlock(&uq_mgr->userq_mutex);
@@ -1187,7 +1194,7 @@ amdgpu_userq_vm_validate(struct amdgpu_userq_mgr *uq_mgr)
11871194
bo = range->bo;
11881195
ret = amdgpu_ttm_tt_get_user_pages(bo, range);
11891196
if (ret)
1190-
goto unlock_all;
1197+
goto free_ranges;
11911198
}
11921199

11931200
invalidated = true;
@@ -1214,6 +1221,7 @@ amdgpu_userq_vm_validate(struct amdgpu_userq_mgr *uq_mgr)
12141221

12151222
unlock_all:
12161223
drm_exec_fini(&exec);
1224+
free_ranges:
12171225
xa_for_each(&xa, tmp_key, range) {
12181226
if (!range)
12191227
continue;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ void amdgpu_userq_reset_work(struct work_struct *work);
156156
void amdgpu_userq_pre_reset(struct amdgpu_device *adev);
157157
int amdgpu_userq_post_reset(struct amdgpu_device *adev, bool vram_lost);
158158
void amdgpu_userq_start_hang_detect_work(struct amdgpu_usermode_queue *queue);
159+
void amdgpu_userq_process_fence_irq(struct amdgpu_device *adev, u32 doorbell);
159160

160161
int amdgpu_userq_input_va_validate(struct amdgpu_device *adev,
161162
struct amdgpu_usermode_queue *queue,

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3023,11 +3023,22 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid,
30233023

30243024
is_compute_context = vm->is_compute_context;
30253025

3026-
if (is_compute_context && !svm_range_restore_pages(adev, pasid, vmid,
3027-
node_id, addr >> PAGE_SHIFT, ts, write_fault)) {
3026+
if (is_compute_context) {
3027+
/* Unreserve root since svm_range_restore_pages might try to reserve it. */
3028+
/* TODO: rework svm_range_restore_pages so that this isn't necessary. */
30283029
amdgpu_bo_unreserve(root);
3030+
3031+
if (!svm_range_restore_pages(adev, pasid, vmid,
3032+
node_id, addr >> PAGE_SHIFT, ts, write_fault)) {
3033+
amdgpu_bo_unref(&root);
3034+
return true;
3035+
}
30293036
amdgpu_bo_unref(&root);
3030-
return true;
3037+
3038+
/* Re-acquire the VM lock, could be that the VM was freed in between. */
3039+
vm = amdgpu_vm_lock_by_pasid(adev, &root, pasid);
3040+
if (!vm)
3041+
return false;
30313042
}
30323043

30333044
addr /= AMDGPU_GPU_PAGE_SIZE;

0 commit comments

Comments
 (0)