Skip to content

Commit c098b1a

Browse files
committed
Merge tag 'amd-drm-next-6.20-2026-01-16' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.20-2026-01-16: amdgpu: - SR-IOV fixes - Rework SMU mailbox handling - Drop MMIO_REMAP domain - UserQ fixes - MES cleanups - Panel Replay updates - HDMI fixes - Backlight fixes - SMU 14.x fixes - SMU 15 updates amdkfd: - Fix a memory leak - Fixes for systems with non-4K pages - LDS/Scratch cleanup - MES process eviction fix Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patch.msgid.link/[email protected]
2 parents 971c2b6 + 6a681cd commit c098b1a

101 files changed

Lines changed: 1951 additions & 1239 deletions

File tree

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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ extern int amdgpu_rebar;
269269
extern int amdgpu_wbrf;
270270
extern int amdgpu_user_queue;
271271

272+
extern uint amdgpu_hdmi_hpd_debounce_delay_ms;
273+
272274
#define AMDGPU_VM_MAX_NUM_CTX 4096
273275
#define AMDGPU_SG_THRESHOLD (256*1024*1024)
274276
#define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ void amdgpu_amdkfd_interrupt(struct amdgpu_device *adev,
248248
kgd2kfd_interrupt(adev->kfd.dev, ih_ring_entry);
249249
}
250250

251+
void amdgpu_amdkfd_teardown_processes(struct amdgpu_device *adev)
252+
{
253+
kgd2kfd_teardown_processes(adev);
254+
}
255+
251256
void amdgpu_amdkfd_suspend(struct amdgpu_device *adev, bool suspend_proc)
252257
{
253258
if (adev->kfd.dev) {
@@ -316,8 +321,8 @@ void amdgpu_amdkfd_gpu_reset(struct amdgpu_device *adev)
316321
&adev->kfd.reset_work);
317322
}
318323

319-
int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size,
320-
void **mem_obj, uint64_t *gpu_addr,
324+
int amdgpu_amdkfd_alloc_kernel_mem(struct amdgpu_device *adev, size_t size,
325+
u32 domain, void **mem_obj, uint64_t *gpu_addr,
321326
void **cpu_ptr, bool cp_mqd_gfx9)
322327
{
323328
struct amdgpu_bo *bo = NULL;
@@ -328,7 +333,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size,
328333
memset(&bp, 0, sizeof(bp));
329334
bp.size = size;
330335
bp.byte_align = PAGE_SIZE;
331-
bp.domain = AMDGPU_GEM_DOMAIN_GTT;
336+
bp.domain = domain;
332337
bp.flags = AMDGPU_GEM_CREATE_CPU_GTT_USWC;
333338
bp.type = ttm_bo_type_kernel;
334339
bp.resv = NULL;
@@ -351,7 +356,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size,
351356
goto allocate_mem_reserve_bo_failed;
352357
}
353358

354-
r = amdgpu_bo_pin(bo, AMDGPU_GEM_DOMAIN_GTT);
359+
r = amdgpu_bo_pin(bo, domain);
355360
if (r) {
356361
dev_err(adev->dev, "(%d) failed to pin bo for amdkfd\n", r);
357362
goto allocate_mem_pin_bo_failed;
@@ -388,7 +393,7 @@ int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size,
388393
return r;
389394
}
390395

391-
void amdgpu_amdkfd_free_gtt_mem(struct amdgpu_device *adev, void **mem_obj)
396+
void amdgpu_amdkfd_free_kernel_mem(struct amdgpu_device *adev, void **mem_obj)
392397
{
393398
struct amdgpu_bo **bo = (struct amdgpu_bo **) mem_obj;
394399

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ struct amdkfd_process_info {
158158

159159
int amdgpu_amdkfd_init(void);
160160
void amdgpu_amdkfd_fini(void);
161+
void amdgpu_amdkfd_teardown_processes(struct amdgpu_device *adev);
161162

162163
void amdgpu_amdkfd_suspend(struct amdgpu_device *adev, bool suspend_proc);
163164
int amdgpu_amdkfd_resume(struct amdgpu_device *adev, bool resume_proc);
@@ -240,10 +241,10 @@ int amdgpu_amdkfd_bo_validate_and_fence(struct amdgpu_bo *bo,
240241
}
241242
#endif
242243
/* Shared API */
243-
int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size,
244-
void **mem_obj, uint64_t *gpu_addr,
244+
int amdgpu_amdkfd_alloc_kernel_mem(struct amdgpu_device *adev, size_t size,
245+
u32 domain, void **mem_obj, uint64_t *gpu_addr,
245246
void **cpu_ptr, bool mqd_gfx9);
246-
void amdgpu_amdkfd_free_gtt_mem(struct amdgpu_device *adev, void **mem_obj);
247+
void amdgpu_amdkfd_free_kernel_mem(struct amdgpu_device *adev, void **mem_obj);
247248
int amdgpu_amdkfd_alloc_gws(struct amdgpu_device *adev, size_t size,
248249
void **mem_obj);
249250
void amdgpu_amdkfd_free_gws(struct amdgpu_device *adev, void *mem_obj);
@@ -438,6 +439,8 @@ int kgd2kfd_stop_sched_all_nodes(struct kfd_dev *kfd);
438439
bool kgd2kfd_compute_active(struct kfd_dev *kfd, uint32_t node_id);
439440
bool kgd2kfd_vmfault_fast_path(struct amdgpu_device *adev, struct amdgpu_iv_entry *entry,
440441
bool retry_fault);
442+
void kgd2kfd_lock_kfd(void);
443+
void kgd2kfd_teardown_processes(struct amdgpu_device *adev);
441444

442445
#else
443446
static inline int kgd2kfd_init(void)
@@ -550,5 +553,13 @@ static inline bool kgd2kfd_vmfault_fast_path(struct amdgpu_device *adev, struct
550553
return false;
551554
}
552555

556+
static inline void kgd2kfd_lock_kfd(void)
557+
{
558+
}
559+
560+
static inline void kgd2kfd_teardown_processes(struct amdgpu_device *adev)
561+
{
562+
}
563+
553564
#endif
554565
#endif /* AMDGPU_AMDKFD_H_INCLUDED */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,7 @@ int amdgpu_amdkfd_gpuvm_sync_memory(
22152215
* @bo_gart: Return bo reference
22162216
*
22172217
* Before return, bo reference count is incremented. To release the reference and unpin/
2218-
* unmap the BO, call amdgpu_amdkfd_free_gtt_mem.
2218+
* unmap the BO, call amdgpu_amdkfd_free_kernel_mem.
22192219
*/
22202220
int amdgpu_amdkfd_map_gtt_bo_to_gart(struct amdgpu_bo *bo, struct amdgpu_bo **bo_gart)
22212221
{

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3509,6 +3509,7 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
35093509
amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
35103510

35113511
amdgpu_amdkfd_suspend(adev, true);
3512+
amdgpu_amdkfd_teardown_processes(adev);
35123513
amdgpu_userq_suspend(adev);
35133514

35143515
/* Workaround for ASICs need to disable SMC first */

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -891,22 +891,19 @@ static ssize_t num_base_addresses_show(struct ip_hw_instance *ip_hw_instance, ch
891891

892892
static ssize_t base_addr_show(struct ip_hw_instance *ip_hw_instance, char *buf)
893893
{
894-
ssize_t res, at;
894+
ssize_t at;
895895
int ii;
896896

897-
for (res = at = ii = 0; ii < ip_hw_instance->num_base_addresses; ii++) {
897+
for (at = ii = 0; ii < ip_hw_instance->num_base_addresses; ii++) {
898898
/* Here we satisfy the condition that, at + size <= PAGE_SIZE.
899899
*/
900900
if (at + 12 > PAGE_SIZE)
901901
break;
902-
res = sysfs_emit_at(buf, at, "0x%08X\n",
902+
at += sysfs_emit_at(buf, at, "0x%08X\n",
903903
ip_hw_instance->base_addr[ii]);
904-
if (res <= 0)
905-
break;
906-
at += res;
907904
}
908905

909-
return res < 0 ? res : at;
906+
return at;
910907
}
911908

912909
static struct ip_hw_instance_attr ip_hw_attr[] = {

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ int amdgpu_damage_clips = -1; /* auto */
247247
int amdgpu_umsch_mm_fwlog;
248248
int amdgpu_rebar = -1; /* auto */
249249
int amdgpu_user_queue = -1;
250+
uint amdgpu_hdmi_hpd_debounce_delay_ms;
250251

251252
DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
252253
"DRM_UT_CORE",
@@ -1123,6 +1124,16 @@ module_param_named(rebar, amdgpu_rebar, int, 0444);
11231124
MODULE_PARM_DESC(user_queue, "Enable user queues (-1 = auto (default), 0 = disable, 1 = enable, 2 = enable UQs and disable KQs)");
11241125
module_param_named(user_queue, amdgpu_user_queue, int, 0444);
11251126

1127+
/*
1128+
* DOC: hdmi_hpd_debounce_delay_ms (uint)
1129+
* HDMI HPD disconnect debounce delay in milliseconds.
1130+
*
1131+
* Used to filter short disconnect->reconnect HPD toggles some HDMI sinks
1132+
* generate while entering/leaving power save. Set to 0 to disable by default.
1133+
*/
1134+
MODULE_PARM_DESC(hdmi_hpd_debounce_delay_ms, "HDMI HPD disconnect debounce delay in milliseconds (0 to disable (by default), 1500 is common)");
1135+
module_param_named(hdmi_hpd_debounce_delay_ms, amdgpu_hdmi_hpd_debounce_delay_ms, uint, 0644);
1136+
11261137
/* These devices are not supported by amdgpu.
11271138
* They are supported by the mach64, r128, radeon drivers
11281139
*/

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ void amdgpu_gart_map(struct amdgpu_device *adev, uint64_t offset,
375375
* @start_page: first page to map in the GART aperture
376376
* @num_pages: number of pages to be mapped
377377
* @flags: page table entry flags
378-
* @dst: CPU address of the GART table
378+
* @dst: valid CPU address of GART table, cannot be null
379379
*
380380
* Binds a BO that is allocated in VRAM to the GART page table
381381
* (all ASICs).
@@ -396,7 +396,7 @@ void amdgpu_gart_map_vram_range(struct amdgpu_device *adev, uint64_t pa,
396396
return;
397397

398398
for (i = 0; i < num_pages; ++i) {
399-
amdgpu_gmc_set_pte_pde(adev, adev->gart.ptr,
399+
amdgpu_gmc_set_pte_pde(adev, dst,
400400
start_page + i, pa + AMDGPU_GPU_PAGE_SIZE * i, flags);
401401
}
402402

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

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,6 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
417417
/* always clear VRAM */
418418
flags |= AMDGPU_GEM_CREATE_VRAM_CLEARED;
419419

420-
if (args->in.domains & AMDGPU_GEM_DOMAIN_MMIO_REMAP)
421-
return -EINVAL;
422-
423420
/* create a gem object to contain this object in */
424421
if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS |
425422
AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA)) {
@@ -732,15 +729,23 @@ amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
732729
struct amdgpu_bo_va *bo_va,
733730
uint32_t operation)
734731
{
735-
struct dma_fence *clear_fence = dma_fence_get_stub();
736-
struct dma_fence *last_update = NULL;
737-
int r;
732+
struct dma_fence *fence;
733+
int r = 0;
734+
735+
/* Always start from the VM's existing last update fence. */
736+
fence = dma_fence_get(vm->last_update);
738737

739738
if (!amdgpu_vm_ready(vm))
740-
return clear_fence;
739+
return fence;
741740

742-
/* First clear freed BOs and get a fence for that work, if any. */
743-
r = amdgpu_vm_clear_freed(adev, vm, &clear_fence);
741+
/*
742+
* First clean up any freed mappings in the VM.
743+
*
744+
* amdgpu_vm_clear_freed() may replace @fence with a new fence if it
745+
* schedules GPU work. If nothing needs clearing, @fence can remain as
746+
* the original vm->last_update.
747+
*/
748+
r = amdgpu_vm_clear_freed(adev, vm, &fence);
744749
if (r)
745750
goto error;
746751

@@ -758,53 +763,46 @@ amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
758763
goto error;
759764

760765
/*
761-
* Decide which fence represents the "last update" for this VM/BO:
766+
* Decide which fence best represents the last update:
767+
*
768+
* MAP/REPLACE:
769+
* - For always-valid mappings, use vm->last_update.
770+
* - Otherwise, export bo_va->last_pt_update.
762771
*
763-
* - For MAP/REPLACE we want the PT update fence, which is tracked as
764-
* either vm->last_update (for always-valid BOs) or bo_va->last_pt_update
765-
* (for per-BO updates).
772+
* UNMAP/CLEAR:
773+
* Keep the fence returned by amdgpu_vm_clear_freed(). If no work was
774+
* needed, it can remain as vm->last_pt_update.
766775
*
767-
* - For UNMAP/CLEAR we rely on the fence returned by
768-
* amdgpu_vm_clear_freed(), which already covers the page table work
769-
* for the removed mappings.
776+
* The VM and BO update fences are always initialized to a valid value.
777+
* vm->last_update and bo_va->last_pt_update always start as valid fences.
778+
* and are never expected to be NULL.
770779
*/
771780
switch (operation) {
772781
case AMDGPU_VA_OP_MAP:
773782
case AMDGPU_VA_OP_REPLACE:
774-
if (bo_va && bo_va->base.bo) {
775-
if (amdgpu_vm_is_bo_always_valid(vm, bo_va->base.bo)) {
776-
if (vm->last_update)
777-
last_update = dma_fence_get(vm->last_update);
778-
} else {
779-
if (bo_va->last_pt_update)
780-
last_update = dma_fence_get(bo_va->last_pt_update);
781-
}
782-
}
783+
/*
784+
* For MAP/REPLACE, return the page table update fence for the
785+
* mapping we just modified. bo_va is expected to be valid here.
786+
*/
787+
dma_fence_put(fence);
788+
789+
if (amdgpu_vm_is_bo_always_valid(vm, bo_va->base.bo))
790+
fence = dma_fence_get(vm->last_update);
791+
else
792+
fence = dma_fence_get(bo_va->last_pt_update);
783793
break;
784794
case AMDGPU_VA_OP_UNMAP:
785795
case AMDGPU_VA_OP_CLEAR:
786-
if (clear_fence)
787-
last_update = dma_fence_get(clear_fence);
788-
break;
789796
default:
797+
/* keep @fence as returned by amdgpu_vm_clear_freed() */
790798
break;
791799
}
792800

793801
error:
794802
if (r && r != -ERESTARTSYS)
795803
DRM_ERROR("Couldn't update BO_VA (%d)\n", r);
796804

797-
/*
798-
* If we managed to pick a more specific last-update fence, prefer it
799-
* over the generic clear_fence and drop the extra reference to the
800-
* latter.
801-
*/
802-
if (last_update) {
803-
dma_fence_put(clear_fence);
804-
return last_update;
805-
}
806-
807-
return clear_fence;
805+
return fence;
808806
}
809807

810808
int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,10 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid,
780780
return 0;
781781

782782
if (!adev->gmc.flush_pasid_uses_kiq || !ring->sched.ready) {
783+
784+
if (!adev->gmc.gmc_funcs->flush_gpu_tlb_pasid)
785+
return 0;
786+
783787
if (adev->gmc.flush_tlb_needs_extra_type_2)
784788
adev->gmc.gmc_funcs->flush_gpu_tlb_pasid(adev, pasid,
785789
2, all_hub,

0 commit comments

Comments
 (0)