	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function init_kfd_vm
_init_kfd_vm:                           ## @init_kfd_vm
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r12
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	(%rsi), %rax
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	xorl	%r13d, %r13d
LBB0_7:
	movq	%rax, (%r14)
	movq	8(%r14), %rdi
	movl	$1, %esi
	callq	_amdgpu_bo_reserve
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_11
## %bb.8:
	movq	%r14, %rdi
	callq	_vm_validate_pt_pd_bos
	testl	%eax, %eax
	je	LBB0_14
## %bb.9:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_err
	jmp	LBB0_10
LBB0_2:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$40, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_mutex_init
	leaq	36(%r13), %rdi
	callq	_INIT_LIST_HEAD
	leaq	32(%r13), %rdi
	callq	_INIT_LIST_HEAD
	leaq	28(%r13), %rdi
	callq	_INIT_LIST_HEAD
	leaq	24(%r13), %rdi
	callq	_INIT_LIST_HEAD
	movl	$1, %edi
	callq	_dma_fence_context_alloc
	movq	_current@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rcx
	movl	4(%rcx), %esi
	movl	%eax, %edi
	callq	_amdgpu_amdkfd_fence_create
	movq	%rax, 8(%r13)
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	(%rbx), %rax
	movl	(%rax), %edi
	movq	_PIDTYPE_PID@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_get_task_pid
	movl	%eax, 4(%r13)
	leaq	20(%r13), %rdi
	xorl	%esi, %esi
	callq	_atomic_set
	movq	%r13, %rdi
	addq	$16, %rdi
	movq	_amdgpu_amdkfd_restore_userptr_worker@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_INIT_DELAYED_WORK
	movq	%r13, (%r15)
	movq	8(%r13), %rdi
	callq	_dma_fence_get
	movq	%rax, (%r12)
	movq	(%r15), %rax
	jmp	LBB0_7
LBB0_3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_17
LBB0_14:
	movq	8(%r14), %rdi
	movq	_AMDGPU_FENCE_OWNER_KFD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_amdgpu_bo_sync_wait
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_10
## %bb.15:
	movq	8(%r14), %rax
	movl	(%rax), %edi
	movl	$1, %esi
	callq	_dma_resv_reserve_shared
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_16
LBB0_10:
	movq	8(%r14), %rdi
	callq	_amdgpu_bo_unreserve
LBB0_11:
	movq	$0, (%r14)
	testq	%r13, %r13
	je	LBB0_17
## %bb.12:
	movq	8(%r13), %rdi
	callq	_dma_fence_put
	movq	(%r12), %rdi
	callq	_dma_fence_put
	movq	$0, (%r12)
	movq	$0, (%r15)
	movl	4(%r13), %edi
	callq	_put_pid
LBB0_13:
	movq	%r13, %rdi
	callq	_mutex_destroy
	movq	%r13, %rdi
	callq	_kfree
LBB0_17:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_13
LBB0_16:
	movq	(%r14), %rax
	movq	8(%r14), %rdi
	movq	16(%rax), %rsi
	movl	$1, %edx
	callq	_amdgpu_bo_fence
	movq	8(%r14), %rdi
	callq	_amdgpu_bo_unreserve
	movq	(%r14), %rdi
	callq	_mutex_lock
	leaq	16(%r14), %rdi
	movq	(%r14), %rsi
	addq	$8, %rsi
	callq	_list_add_tail
	movq	(%r14), %rdi
	incl	4(%rdi)
	callq	_mutex_unlock
	xorl	%ebx, %ebx
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_current,8,3                    ## @current
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to create eviction fence\n"

	.comm	_PIDTYPE_PID,4,2                ## @PIDTYPE_PID
	.comm	_amdgpu_amdkfd_restore_userptr_worker,4,2 ## @amdgpu_amdkfd_restore_userptr_worker
L_.str.1:                               ## @.str.1
	.asciz	"validate_pt_pd_bos() failed\n"

	.comm	_AMDGPU_FENCE_OWNER_KFD,4,2     ## @AMDGPU_FENCE_OWNER_KFD
	.no_dead_strip	_init_kfd_vm
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function init_kfd_vm
_init_kfd_vm:                           ; @init_kfd_vm
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x22, x2
	mov	x21, x1
	mov	x19, x0
	ldr	x8, [x1]
	cbz	x8, LBB0_4
; %bb.1:
	mov	x20, #0
LBB0_2:
	str	x8, [x19]
	ldr	x0, [x19, #8]
	mov	w1, #1
	bl	_amdgpu_bo_reserve
	mov	x23, x0
	cbz	w0, LBB0_7
; %bb.3:
	str	xzr, [x19]
	cbnz	x20, LBB0_13
	b	LBB0_15
LBB0_4:
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #40
	bl	_kzalloc
	cbz	x0, LBB0_9
; %bb.5:
	mov	x20, x0
	bl	_mutex_init
	add	x0, x20, #36
	bl	_INIT_LIST_HEAD
	add	x0, x20, #32
	bl	_INIT_LIST_HEAD
	add	x0, x20, #28
	bl	_INIT_LIST_HEAD
	add	x0, x20, #24
	bl	_INIT_LIST_HEAD
	mov	w0, #1
	bl	_dma_fence_context_alloc
Lloh3:
	adrp	x23, _current@GOTPAGE
Lloh4:
	ldr	x23, [x23, _current@GOTPAGEOFF]
	ldr	x8, [x23]
	ldr	w1, [x8, #4]
	bl	_amdgpu_amdkfd_fence_create
	str	x0, [x20, #8]
	cbz	x0, LBB0_16
; %bb.6:
	ldr	x8, [x23]
	ldr	w0, [x8]
Lloh5:
	adrp	x8, _PIDTYPE_PID@GOTPAGE
Lloh6:
	ldr	x8, [x8, _PIDTYPE_PID@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	bl	_get_task_pid
	str	w0, [x20, #4]
	add	x0, x20, #20
	mov	w1, #0
	bl	_atomic_set
	add	x0, x20, #16
Lloh8:
	adrp	x8, _amdgpu_amdkfd_restore_userptr_worker@GOTPAGE
Lloh9:
	ldr	x8, [x8, _amdgpu_amdkfd_restore_userptr_worker@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	bl	_INIT_DELAYED_WORK
	str	x20, [x21]
	ldr	x0, [x20, #8]
	bl	_dma_fence_get
	str	x0, [x22]
	ldr	x8, [x21]
	b	LBB0_2
LBB0_7:
	mov	x0, x19
	bl	_vm_validate_pt_pd_bos
	cbz	w0, LBB0_10
; %bb.8:
	mov	x23, x0
Lloh11:
	adrp	x0, l_.str.1@PAGE
Lloh12:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_err
	b	LBB0_12
LBB0_9:
Lloh13:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_15
LBB0_10:
	ldr	x0, [x19, #8]
Lloh16:
	adrp	x8, _AMDGPU_FENCE_OWNER_KFD@GOTPAGE
Lloh17:
	ldr	x8, [x8, _AMDGPU_FENCE_OWNER_KFD@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_amdgpu_bo_sync_wait
	mov	x23, x0
	cbnz	w0, LBB0_12
; %bb.11:
	ldr	x8, [x19, #8]
	ldr	w0, [x8]
	mov	w1, #1
	bl	_dma_resv_reserve_shared
	mov	x23, x0
	cbz	w0, LBB0_17
LBB0_12:
	ldr	x0, [x19, #8]
	bl	_amdgpu_bo_unreserve
	str	xzr, [x19]
	cbz	x20, LBB0_15
LBB0_13:
	ldr	x0, [x20, #8]
	bl	_dma_fence_put
	ldr	x0, [x22]
	bl	_dma_fence_put
	str	xzr, [x22]
	str	xzr, [x21]
	ldr	w0, [x20, #4]
	bl	_put_pid
LBB0_14:
	mov	x0, x20
	bl	_mutex_destroy
	mov	x0, x20
	bl	_kfree
LBB0_15:
	mov	x0, x23
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_16:
Lloh19:
	adrp	x0, l_.str@PAGE
Lloh20:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
Lloh21:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_14
LBB0_17:
	ldp	x8, x0, [x19]
	ldr	x1, [x8, #16]
	mov	w2, #1
	bl	_amdgpu_bo_fence
	ldr	x0, [x19, #8]
	bl	_amdgpu_bo_unreserve
	ldr	x0, [x19]
	bl	_mutex_lock
	add	x0, x19, #16
	ldr	x8, [x19]
	add	x1, x8, #8
	bl	_list_add_tail
	ldr	x0, [x19]
	ldr	w8, [x0, #4]
	add	w8, w8, #1
	str	w8, [x0, #4]
	bl	_mutex_unlock
	b	LBB0_15
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_current,8,3                    ; @current
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to create eviction fence\n"

	.comm	_PIDTYPE_PID,4,2                ; @PIDTYPE_PID
	.comm	_amdgpu_amdkfd_restore_userptr_worker,4,2 ; @amdgpu_amdkfd_restore_userptr_worker
l_.str.1:                               ; @.str.1
	.asciz	"validate_pt_pd_bos() failed\n"

	.comm	_AMDGPU_FENCE_OWNER_KFD,4,2     ; @AMDGPU_FENCE_OWNER_KFD
	.no_dead_strip	_init_kfd_vm
.subsections_via_symbols
