Skip to content

Commit 68ad07d

Browse files
committed
Merge tag 'amd-drm-fixes-6.17-2025-08-13' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-6.17-2025-08-13: amdgpu: - PSP fix - VRAM reservation fix - CSA fix - Process kill fix Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2 parents f858f63 + aa5fc43 commit 68ad07d

File tree

5 files changed

+33
-11
lines changed

5 files changed

+33
-11
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,9 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)
11391139
}
11401140
}
11411141

1142+
if (!amdgpu_vm_ready(vm))
1143+
return -EINVAL;
1144+
11421145
r = amdgpu_vm_clear_freed(adev, vm, NULL);
11431146
if (r)
11441147
return r;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
8888
}
8989

9090
r = amdgpu_vm_bo_map(adev, *bo_va, csa_addr, 0, size,
91-
AMDGPU_PTE_READABLE | AMDGPU_PTE_WRITEABLE |
92-
AMDGPU_PTE_EXECUTABLE);
91+
AMDGPU_VM_PAGE_READABLE | AMDGPU_VM_PAGE_WRITEABLE |
92+
AMDGPU_VM_PAGE_EXECUTABLE);
9393

9494
if (r) {
9595
DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r);

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,15 +1039,28 @@ int psp_update_fw_reservation(struct psp_context *psp)
10391039
{
10401040
int ret;
10411041
uint64_t reserv_addr, reserv_addr_ext;
1042-
uint32_t reserv_size, reserv_size_ext;
1042+
uint32_t reserv_size, reserv_size_ext, mp0_ip_ver;
10431043
struct amdgpu_device *adev = psp->adev;
10441044

1045+
mp0_ip_ver = amdgpu_ip_version(adev, MP0_HWIP, 0);
1046+
10451047
if (amdgpu_sriov_vf(psp->adev))
10461048
return 0;
10471049

1048-
if ((amdgpu_ip_version(adev, MP0_HWIP, 0) != IP_VERSION(14, 0, 2)) &&
1049-
(amdgpu_ip_version(adev, MP0_HWIP, 0) != IP_VERSION(14, 0, 3)))
1050+
switch (mp0_ip_ver) {
1051+
case IP_VERSION(14, 0, 2):
1052+
if (adev->psp.sos.fw_version < 0x3b0e0d)
1053+
return 0;
1054+
break;
1055+
1056+
case IP_VERSION(14, 0, 3):
1057+
if (adev->psp.sos.fw_version < 0x3a0e14)
1058+
return 0;
1059+
break;
1060+
1061+
default:
10501062
return 0;
1063+
}
10511064

10521065
ret = psp_get_fw_reservation_info(psp, GFX_CMD_ID_FB_FW_RESERV_ADDR, &reserv_addr, &reserv_size);
10531066
if (ret)

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,22 +654,29 @@ int amdgpu_vm_validate(struct amdgpu_device *adev, struct amdgpu_vm *vm,
654654
* Check if all VM PDs/PTs are ready for updates
655655
*
656656
* Returns:
657-
* True if VM is not evicting.
657+
* True if VM is not evicting and all VM entities are not stopped
658658
*/
659659
bool amdgpu_vm_ready(struct amdgpu_vm *vm)
660660
{
661-
bool empty;
662661
bool ret;
663662

664663
amdgpu_vm_eviction_lock(vm);
665664
ret = !vm->evicting;
666665
amdgpu_vm_eviction_unlock(vm);
667666

668667
spin_lock(&vm->status_lock);
669-
empty = list_empty(&vm->evicted);
668+
ret &= list_empty(&vm->evicted);
670669
spin_unlock(&vm->status_lock);
671670

672-
return ret && empty;
671+
spin_lock(&vm->immediate.lock);
672+
ret &= !vm->immediate.stopped;
673+
spin_unlock(&vm->immediate.lock);
674+
675+
spin_lock(&vm->delayed.lock);
676+
ret &= !vm->delayed.stopped;
677+
spin_unlock(&vm->delayed.lock);
678+
679+
return ret;
673680
}
674681

675682
/**

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,8 @@ static void amdgpu_vram_mgr_del(struct ttm_resource_manager *man,
648648
list_for_each_entry(block, &vres->blocks, link)
649649
vis_usage += amdgpu_vram_mgr_vis_size(adev, block);
650650

651-
amdgpu_vram_mgr_do_reserve(man);
652-
653651
drm_buddy_free_list(mm, &vres->blocks, vres->flags);
652+
amdgpu_vram_mgr_do_reserve(man);
654653
mutex_unlock(&mgr->lock);
655654

656655
atomic64_sub(vis_usage, &mgr->vis_usage);

0 commit comments

Comments
 (0)