	.file	"extr_kfd_device_queue_manager.c_create_queue_cpsch.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"Can't create new usermode queue because %d queues were already created\n"
	.align 8
.LC1:
	.string	"Total of %d queues are accountable so far\n"
	.text
	.p2align 4
	.type	create_queue_cpsch, @function
create_queue_cpsch:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	mov	rbp, rsi
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	mov	rsi, QWORD PTR [rdi]
	cmp	rsi, QWORD PTR max_num_of_queues_per_device[rip]
	jge	.L18
	mov	rax, QWORD PTR 0[rbp]
	cmp	rax, QWORD PTR KFD_QUEUE_TYPE_SDMA[rip]
	mov	r13, rdi
	mov	r14, rdx
	je	.L4
	cmp	rax, QWORD PTR KFD_QUEUE_TYPE_SDMA_XGMI[rip]
	je	.L4
.L7:
	mov	rsi, rbp
	mov	rdi, r14
	call	allocate_doorbell@PLT
	mov	r12d, eax
	test	eax, eax
	je	.L19
.L5:
	mov	rax, QWORD PTR 0[rbp]
	cmp	rax, QWORD PTR KFD_QUEUE_TYPE_SDMA[rip]
	je	.L14
	cmp	rax, QWORD PTR KFD_QUEUE_TYPE_SDMA_XGMI[rip]
	je	.L14
.L1:
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r12d
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	.cfi_restore_state
	mov	rdi, QWORD PTR 0[rbp]
	mov	rbx, QWORD PTR 32[r13]
	call	get_mqd_type_from_queue_type@PLT
	mov	rbx, QWORD PTR [rbx+rax*8]
	mov	rax, QWORD PTR 0[rbp]
	cmp	rax, QWORD PTR KFD_QUEUE_TYPE_SDMA[rip]
	je	.L8
	cmp	rax, QWORD PTR KFD_QUEUE_TYPE_SDMA_XGMI[rip]
	je	.L8
.L9:
	mov	eax, DWORD PTR 16[r14]
	mov	edi, DWORD PTR 8[rbx]
	mov	rsi, rbp
	mov	DWORD PTR 28[rbp], eax
	mov	eax, DWORD PTR 12[r14]
	mov	DWORD PTR 24[rbp], eax
	call	[QWORD PTR 16[rbx]]
	mov	DWORD PTR 40[rbp], eax
	test	eax, eax
	je	.L20
	mov	rdi, r13
	call	dqm_lock@PLT
	mov	edx, DWORD PTR 8[r14]
	xor	eax, eax
	lea	rcx, 36[rbp]
	lea	rsi, 44[rbp]
	mov	r8, rbp
	mov	rdi, rbx
	test	edx, edx
	mov	edx, DWORD PTR 40[rbp]
	setne	al
	mov	DWORD PTR 8[rbp], eax
	call	[QWORD PTR [rbx]]
	lea	rsi, 4[r14]
	lea	rdi, 32[rbp]
	call	list_add@PLT
	add	DWORD PTR [r14], 1
	cmp	QWORD PTR 16[rbp], 0
	jne	.L21
.L11:
	mov	rax, QWORD PTR 0[rbp]
	cmp	rax, QWORD PTR KFD_QUEUE_TYPE_SDMA[rip]
	je	.L22
	cmp	rax, QWORD PTR KFD_QUEUE_TYPE_SDMA_XGMI[rip]
	jne	.L13
	add	DWORD PTR 8[r13], 1
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L4:
	mov	rdi, r13
	call	dqm_lock@PLT
	mov	rdi, r13
	mov	rsi, rbp
	call	allocate_sdma_queue@PLT
	mov	rdi, r13
	mov	r12d, eax
	call	dqm_unlock@PLT
	test	r12d, r12d
	je	.L7
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L14:
	mov	rdi, r13
	call	dqm_lock@PLT
	mov	rsi, rbp
	mov	rdi, r13
	call	deallocate_sdma_queue@PLT
	mov	rdi, r13
	call	dqm_unlock@PLT
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r12d
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	lea	rdi, .LC0[rip]
	call	pr_warn@PLT
	mov	r12d, DWORD PTR EPERM[rip]
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbp
	.cfi_def_cfa_offset 32
	neg	r12d
	mov	eax, r12d
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	mov	rdx, r14
	mov	rsi, rbp
	mov	rdi, r13
	call	[QWORD PTR 24[r13]]
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L22:
	add	DWORD PTR 12[r13], 1
.L13:
	mov	rax, QWORD PTR 0[r13]
	lea	rdi, .LC1[rip]
	lea	rsi, 1[rax]
	mov	QWORD PTR 0[r13], rsi
	call	pr_debug@PLT
	mov	rdi, r13
	call	dqm_unlock@PLT
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r12d
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L21:
	.cfi_restore_state
	add	DWORD PTR 16[r13], 1
	mov	esi, DWORD PTR KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES[rip]
	xor	edx, edx
	mov	rdi, r13
	call	execute_queues_cpsch@PLT
	mov	r12d, eax
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L20:
	mov	r12d, DWORD PTR ENOMEM[rip]
	mov	rsi, rbp
	mov	rdi, r14
	neg	r12d
	call	deallocate_doorbell@PLT
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	create_queue_cpsch, .-create_queue_cpsch
	.comm	max_num_of_queues_per_device,8,8
	.comm	KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES,4,4
	.comm	KFD_QUEUE_TYPE_SDMA_XGMI,8,8
	.comm	KFD_QUEUE_TYPE_SDMA,8,8
	.comm	EPERM,4,4
	.comm	ENOMEM,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_kfd_device_queue_manager.c_create_queue_cpsch.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Can't create new usermode queue because %d queues w"
	.ascii	"ere already created\012\000"
	.align	2
.LC1:
	.ascii	"Total of %d queues are accountable so far\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	create_queue_cpsch, %function
create_queue_cpsch:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, lr}
	mov	r5, r0
	ldr	r0, .L26
	ldr	r3, [r5]
	ldr	r0, [r0]
	sub	sp, sp, #12
	cmp	r3, r0
	bge	.L21
	ldr	r8, .L26+4
	mov	r7, r2
	ldr	r3, [r1]
	ldr	r2, [r8]
	mov	r4, r1
	cmp	r3, r2
	beq	.L4
	ldr	r2, .L26+8
	ldr	r2, [r2]
	cmp	r3, r2
	beq	.L4
.L7:
	mov	r1, r4
	mov	r0, r7
	bl	allocate_doorbell
	subs	r6, r0, #0
	beq	.L22
.L5:
	ldr	r2, [r8]
	ldr	r3, [r4]
	cmp	r3, r2
	beq	.L14
	ldr	r2, .L26+8
	ldr	r2, [r2]
	cmp	r3, r2
	beq	.L14
.L1:
	mov	r0, r6
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L22:
	ldr	r0, [r4]
	ldr	r6, [r5, #20]
	bl	get_mqd_type_from_queue_type
	ldr	r3, [r4]
	ldr	r2, [r8]
	ldr	r6, [r6, r0, lsl #2]
	cmp	r3, r2
	beq	.L8
	ldr	r2, .L26+8
	ldr	r2, [r2]
	cmp	r3, r2
	beq	.L8
.L9:
	ldr	r3, [r7, #12]
	ldr	r2, [r7, #16]
	mov	r1, r4
	str	r3, [r4, #12]
	ldr	r0, [r6, #4]
	ldr	r3, [r6, #8]
	str	r2, [r4, #16]
	blx	r3
	cmp	r0, #0
	str	r0, [r4, #28]
	beq	.L23
	mov	r0, r5
	bl	dqm_lock
	ldr	r3, [r7, #8]
	str	r4, [sp]
	subs	r3, r3, #0
	movne	r3, #1
	ldr	r9, [r6]
	mov	r0, r6
	ldr	r2, [r4, #28]
	str	r3, [r4, #4]
	add	r1, r4, #32
	add	r3, r4, #24
	blx	r9
	add	r1, r7, #4
	add	r0, r4, #20
	bl	list_add
	ldr	r3, [r7]
	ldr	r6, [r4, #8]
	add	r3, r3, #1
	cmp	r6, #0
	str	r3, [r7]
	bne	.L24
.L11:
	ldr	r3, [r4]
	ldr	r2, [r8]
	cmp	r3, r2
	beq	.L25
	ldr	r2, .L26+8
	ldr	r2, [r2]
	cmp	r3, r2
	ldreq	r3, [r5, #4]
	addeq	r3, r3, #1
	streq	r3, [r5, #4]
.L13:
	ldr	r1, [r5]
	ldr	r0, .L26+12
	add	r1, r1, #1
	str	r1, [r5]
	bl	pr_debug
	mov	r0, r5
	bl	dqm_unlock
	mov	r0, r6
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L4:
	mov	r0, r5
	bl	dqm_lock
	mov	r1, r4
	mov	r0, r5
	bl	allocate_sdma_queue
	mov	r6, r0
	mov	r0, r5
	bl	dqm_unlock
	cmp	r6, #0
	beq	.L7
	b	.L1
.L14:
	mov	r0, r5
	bl	dqm_lock
	mov	r1, r4
	mov	r0, r5
	bl	deallocate_sdma_queue
	mov	r0, r5
	bl	dqm_unlock
	mov	r0, r6
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L21:
	mov	r1, r3
	ldr	r0, .L26+16
	bl	pr_warn
	ldr	r3, .L26+20
	ldr	r6, [r3]
	rsb	r6, r6, #0
	mov	r0, r6
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L8:
	mov	r2, r7
	mov	r1, r4
	mov	r0, r5
	ldr	r3, [r5, #16]
	blx	r3
	b	.L9
.L25:
	ldr	r3, [r5, #8]
	add	r3, r3, #1
	str	r3, [r5, #8]
	b	.L13
.L24:
	ldr	r3, [r5, #12]
	ldr	r2, .L26+24
	add	r3, r3, #1
	ldr	r1, [r2]
	mov	r0, r5
	mov	r2, #0
	str	r3, [r5, #12]
	bl	execute_queues_cpsch
	mov	r6, r0
	b	.L11
.L23:
	ldr	r3, .L26+28
	mov	r0, r7
	ldr	r6, [r3]
	mov	r1, r4
	rsb	r6, r6, #0
	bl	deallocate_doorbell
	b	.L5
.L27:
	.align	2
.L26:
	.word	max_num_of_queues_per_device
	.word	KFD_QUEUE_TYPE_SDMA
	.word	KFD_QUEUE_TYPE_SDMA_XGMI
	.word	.LC1
	.word	.LC0
	.word	EPERM
	.word	KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES
	.word	ENOMEM
	.size	create_queue_cpsch, .-create_queue_cpsch
	.comm	max_num_of_queues_per_device,4,4
	.comm	KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES,4,4
	.comm	KFD_QUEUE_TYPE_SDMA_XGMI,4,4
	.comm	KFD_QUEUE_TYPE_SDMA,4,4
	.comm	EPERM,4,4
	.comm	ENOMEM,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
