Lines Matching full:attachment
552 struct kfd_mem_attachment *attachment) in kfd_mem_dmamap_userptr() argument
558 struct amdgpu_bo *bo = attachment->bo_va->base.bo; in kfd_mem_dmamap_userptr()
559 struct amdgpu_device *adev = attachment->adev; in kfd_mem_dmamap_userptr()
602 kfd_mem_dmamap_dmabuf(struct kfd_mem_attachment *attachment) in kfd_mem_dmamap_dmabuf() argument
605 struct amdgpu_bo *bo = attachment->bo_va->base.bo; in kfd_mem_dmamap_dmabuf()
620 * @attachment: Virtual address attachment of the BO on accessing device
645 struct kfd_mem_attachment *attachment) in kfd_mem_dmamap_sg_bo() argument
648 struct amdgpu_bo *bo = attachment->bo_va->base.bo; in kfd_mem_dmamap_sg_bo()
649 struct amdgpu_device *adev = attachment->adev; in kfd_mem_dmamap_sg_bo()
700 struct kfd_mem_attachment *attachment) in kfd_mem_dmamap_attachment() argument
702 switch (attachment->type) { in kfd_mem_dmamap_attachment()
706 return kfd_mem_dmamap_userptr(mem, attachment); in kfd_mem_dmamap_attachment()
708 return kfd_mem_dmamap_dmabuf(attachment); in kfd_mem_dmamap_attachment()
710 return kfd_mem_dmamap_sg_bo(mem, attachment); in kfd_mem_dmamap_attachment()
719 struct kfd_mem_attachment *attachment) in kfd_mem_dmaunmap_userptr() argument
725 struct amdgpu_bo *bo = attachment->bo_va->base.bo; in kfd_mem_dmaunmap_userptr()
726 struct amdgpu_device *adev = attachment->adev; in kfd_mem_dmaunmap_userptr()
742 kfd_mem_dmaunmap_dmabuf(struct kfd_mem_attachment *attachment) in kfd_mem_dmaunmap_dmabuf() argument
753 * @attachment: Virtual address attachment of the BO on accessing device
768 struct kfd_mem_attachment *attachment) in kfd_mem_dmaunmap_sg_bo() argument
771 struct amdgpu_bo *bo = attachment->bo_va->base.bo; in kfd_mem_dmaunmap_sg_bo()
772 struct amdgpu_device *adev = attachment->adev; in kfd_mem_dmaunmap_sg_bo()
796 struct kfd_mem_attachment *attachment) in kfd_mem_dmaunmap_attachment() argument
798 switch (attachment->type) { in kfd_mem_dmaunmap_attachment()
802 kfd_mem_dmaunmap_userptr(mem, attachment); in kfd_mem_dmaunmap_attachment()
805 kfd_mem_dmaunmap_dmabuf(attachment); in kfd_mem_dmaunmap_attachment()
808 kfd_mem_dmaunmap_sg_bo(mem, attachment); in kfd_mem_dmaunmap_attachment()
874 struct kfd_mem_attachment *attachment[2] = {NULL, NULL}; in kfd_mem_attach() local
904 attachment[i] = kzalloc(sizeof(*attachment[i]), GFP_KERNEL); in kfd_mem_attach()
905 if (unlikely(!attachment[i])) { in kfd_mem_attach()
921 attachment[i]->type = KFD_MEM_ATT_SHARED; in kfd_mem_attach()
926 attachment[i]->type = KFD_MEM_ATT_SHARED; in kfd_mem_attach()
931 attachment[i]->type = KFD_MEM_ATT_USERPTR; in kfd_mem_attach()
940 attachment[i]->type = KFD_MEM_ATT_SG; in kfd_mem_attach()
947 attachment[i]->type = KFD_MEM_ATT_DMABUF; in kfd_mem_attach()
969 attachment[i]->bo_va = bo_va; in kfd_mem_attach()
971 if (unlikely(!attachment[i]->bo_va)) { in kfd_mem_attach()
977 attachment[i]->va = va; in kfd_mem_attach()
978 attachment[i]->pte_flags = get_pte_flags(adev, mem); in kfd_mem_attach()
979 attachment[i]->adev = adev; in kfd_mem_attach()
980 list_add(&attachment[i]->list, &mem->attachments); in kfd_mem_attach()
989 if (!attachment[i]) in kfd_mem_attach()
991 if (attachment[i]->bo_va) { in kfd_mem_attach()
993 if (--attachment[i]->bo_va->ref_count == 0) in kfd_mem_attach()
994 amdgpu_vm_bo_del(adev, attachment[i]->bo_va); in kfd_mem_attach()
996 list_del(&attachment[i]->list); in kfd_mem_attach()
1000 kfree(attachment[i]); in kfd_mem_attach()
1005 static void kfd_mem_detach(struct kfd_mem_attachment *attachment) in kfd_mem_detach() argument
1007 struct amdgpu_bo *bo = attachment->bo_va->base.bo; in kfd_mem_detach()
1010 attachment->va, attachment); in kfd_mem_detach()
1011 if (--attachment->bo_va->ref_count == 0) in kfd_mem_detach()
1012 amdgpu_vm_bo_del(attachment->adev, attachment->bo_va); in kfd_mem_detach()
1014 list_del(&attachment->list); in kfd_mem_detach()
1015 kfree(attachment); in kfd_mem_detach()
2689 struct kfd_mem_attachment *attachment; in validate_invalid_user_pages() local
2709 list_for_each_entry(attachment, &mem->attachments, list) { in validate_invalid_user_pages()
2710 if (!attachment->is_mapped) in validate_invalid_user_pages()
2713 kfd_mem_dmaunmap_attachment(mem, attachment); in validate_invalid_user_pages()
2714 ret = update_gpuvm_pte(mem, attachment, &sync); in validate_invalid_user_pages()
2992 struct kfd_mem_attachment *attachment; in amdgpu_amdkfd_gpuvm_restore_process_bos() local
2994 list_for_each_entry(attachment, &mem->attachments, list) { in amdgpu_amdkfd_gpuvm_restore_process_bos()
2995 if (!attachment->is_mapped) in amdgpu_amdkfd_gpuvm_restore_process_bos()
2998 kfd_mem_dmaunmap_attachment(mem, attachment); in amdgpu_amdkfd_gpuvm_restore_process_bos()
2999 ret = update_gpuvm_pte(mem, attachment, &sync_obj); in amdgpu_amdkfd_gpuvm_restore_process_bos()