	.file	"extr_context.c_ocxl_context_detach.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"Couldn't remove PE entry cleanly: %d\n"
	.text
	.p2align 4
	.globl	ocxl_context_detach
	.type	ocxl_context_detach, @function
ocxl_context_detach:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	lea	r12, 16[rdi]
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	mov	rbx, rdi
	mov	rdi, r12
	call	mutex_lock@PLT
	mov	eax, DWORD PTR CLOSED[rip]
	mov	ebp, DWORD PTR [rbx]
	mov	rdi, r12
	mov	DWORD PTR [rbx], eax
	call	mutex_unlock@PLT
	cmp	ebp, DWORD PTR ATTACHED[rip]
	je	.L2
.L13:
	xor	r12d, r12d
.L1:
	mov	eax, r12d
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	mov	rax, QWORD PTR 8[rbx]
	mov	rax, QWORD PTR [rax]
	mov	edi, DWORD PTR 4[rax]
	call	to_pci_dev@PLT
	mov	rdi, QWORD PTR 8[rbx]
	mov	rbp, rax
	mov	r12d, DWORD PTR 12[rdi]
	add	rdi, 8
	call	mutex_lock@PLT
	mov	edx, DWORD PTR 4[rbx]
	mov	rdi, rbp
	mov	esi, r12d
	call	ocxl_config_terminate_pasid@PLT
	mov	r12d, eax
	mov	rax, QWORD PTR 8[rbx]
	lea	rdi, 8[rax]
	call	mutex_unlock@PLT
	mov	edi, DWORD PTR 4[rbx]
	mov	esi, r12d
	call	trace_ocxl_terminate_pasid@PLT
	test	r12d, r12d
	je	.L4
	mov	eax, r12d
	add	eax, DWORD PTR EBUSY[rip]
	je	.L1
.L4:
	mov	rax, QWORD PTR 8[rbx]
	mov	esi, DWORD PTR 4[rbx]
	mov	rax, QWORD PTR [rax]
	mov	edi, DWORD PTR [rax]
	call	ocxl_link_remove_pe@PLT
	test	eax, eax
	je	.L13
	mov	edx, eax
	lea	rsi, .LC0[rip]
	mov	rdi, rbp
	call	dev_warn@PLT
	jmp	.L13
	.cfi_endproc
.LFE0:
	.size	ocxl_context_detach, .-ocxl_context_detach
	.comm	EBUSY,4,4
	.comm	CLOSED,4,4
	.comm	ATTACHED,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_context.c_ocxl_context_detach.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Couldn't remove PE entry cleanly: %d\012\000"
	.text
	.align	2
	.global	ocxl_context_detach
	.syntax unified
	.arm
	.fpu softvfp
	.type	ocxl_context_detach, %function
ocxl_context_detach:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	mov	r4, r0
	add	r5, r0, #12
	mov	r0, r5
	bl	mutex_lock
	ldr	r3, .L15
	mov	r0, r5
	ldr	r3, [r3]
	ldr	r5, [r4]
	str	r3, [r4]
	bl	mutex_unlock
	ldr	r3, .L15+4
	ldr	r3, [r3]
	cmp	r5, r3
	beq	.L2
.L13:
	mov	r5, #0
.L1:
	mov	r0, r5
	pop	{r4, r5, r6, pc}
.L2:
	ldr	r3, [r4, #8]
	ldr	r3, [r3]
	ldr	r0, [r3, #4]
	bl	to_pci_dev
	mov	r6, r0
	ldr	r0, [r4, #8]
	ldr	r5, [r0, #8]
	add	r0, r0, #4
	bl	mutex_lock
	mov	r1, r5
	ldr	r2, [r4, #4]
	mov	r0, r6
	bl	ocxl_config_terminate_pasid
	mov	r5, r0
	ldr	r0, [r4, #8]
	add	r0, r0, #4
	bl	mutex_unlock
	mov	r1, r5
	ldr	r0, [r4, #4]
	bl	trace_ocxl_terminate_pasid
	cmp	r5, #0
	beq	.L4
	ldr	r3, .L15+8
	ldr	r3, [r3]
	cmn	r5, r3
	beq	.L1
.L4:
	ldmib	r4, {r1, r3}
	ldr	r3, [r3]
	ldr	r0, [r3]
	bl	ocxl_link_remove_pe
	subs	r2, r0, #0
	beq	.L13
	mov	r0, r6
	ldr	r1, .L15+12
	bl	dev_warn
	b	.L13
.L16:
	.align	2
.L15:
	.word	CLOSED
	.word	ATTACHED
	.word	EBUSY
	.word	.LC0
	.size	ocxl_context_detach, .-ocxl_context_detach
	.comm	EBUSY,4,4
	.comm	CLOSED,4,4
	.comm	ATTACHED,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
