]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
amdkfd: record kfd context id into kfd process_info
authorZhu Lingshan <lingshan.zhu@amd.com>
Mon, 3 Mar 2025 10:42:50 +0000 (18:42 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 8 Dec 2025 18:56:43 +0000 (13:56 -0500)
This commit records the context id of the owner
kfd_process into a kfd process_info when
create it.

Signed-off-by: Zhu Lingshan <lingshan.zhu@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

index 335d733751cbfd454ddb11086f531c1c016725da..2fa5f1925f5a38a031bdf7e9180799d6b8ff5ebb 100644 (file)
@@ -148,6 +148,8 @@ struct amdkfd_process_info {
        /* MMU-notifier related fields */
        struct mutex notifier_lock;
        uint32_t evicted_bos;
+       /* kfd context id */
+       u16 context_id;
        struct delayed_work restore_userptr_work;
        struct pid *pid;
        bool block_mmu_notifications;
index b1c24c8fa6862330920de902e903807ecfefabe7..9f04e449093a3a0a610f5910edd530118282b52d 100644 (file)
@@ -1397,8 +1397,10 @@ static int init_kfd_vm(struct amdgpu_vm *vm, void **process_info,
                       struct dma_fence **ef)
 {
        struct amdkfd_process_info *info = NULL;
+       struct kfd_process *process = NULL;
        int ret;
 
+       process = container_of(process_info, struct kfd_process, kgd_process_info);
        if (!*process_info) {
                info = kzalloc(sizeof(*info), GFP_KERNEL);
                if (!info)
@@ -1425,6 +1427,8 @@ static int init_kfd_vm(struct amdgpu_vm *vm, void **process_info,
                INIT_DELAYED_WORK(&info->restore_userptr_work,
                                  amdgpu_amdkfd_restore_userptr_worker);
 
+               info->context_id = process->context_id;
+
                *process_info = info;
        }