	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hisi_qm_create_qp              ## -- Begin function hisi_qm_create_qp
	.p2align	4, 0x90
_hisi_qm_create_qp:                     ## @hisi_qm_create_qp
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r13d
	movq	%rdi, %r12
	movq	32(%rdi), %rbx
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movl	$40, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r14
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	leaq	8(%r12), %rbx
	movq	%rbx, %rdi
	callq	_write_lock
	movl	(%r12), %esi
	movl	12(%r12), %edi
	callq	_find_first_zero_bit
	cmpl	(%r12), %eax
	jge	LBB0_3
## %bb.4:
	movl	%eax, %r13d
	movl	12(%r12), %esi
	movl	%eax, %edi
	callq	_set_bit
	movq	16(%r12), %rax
	movslq	%r13d, %rcx
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movq	%r14, (%rax,%rcx,8)
	movq	%rbx, %rdi
	callq	_write_unlock
	movq	%r12, 32(%r14)
	cmpq	$0, 24(%r12)
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	je	LBB0_8
## %bb.5:
	movl	4(%r12), %esi
	movq	_QM_Q_DEPTH@GOTPCREL(%rip), %rax
	addl	$4, %esi
	imull	(%rax), %esi
	movl	%esi, 4(%r14)
	leaq	8(%r14), %rax
	movl	(%r15), %ecx
	movq	%rax, %r15
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movq	%rax, %rdx
	callq	_dma_alloc_coherent
	movl	%eax, 12(%r14)
	testl	%eax, %eax
	je	LBB0_6
## %bb.7:
	movl	4(%r14), %r8d
	leaq	L_.str.1(%rip), %rsi
	movq	%rbx, %rdi
	movl	%eax, %edx
	movq	%r15, %rcx
	callq	_dev_dbg
LBB0_8:
	movl	%r13d, (%r14)
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, 24(%r14)
	movq	%r14, %rdi
	addq	$20, %rdi
	movq	_qm_qp_work_func@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_INIT_WORK
	movq	_WQ_UNBOUND@GOTPCREL(%rip), %rax
	movq	_WQ_HIGHPRI@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movq	_WQ_CPU_INTENSIVE@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	_WQ_MEM_RECLAIM@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	leaq	L_.str.2(%rip), %rdi
	xorl	%edx, %edx
	callq	_alloc_workqueue
	movl	%eax, 16(%r14)
	testl	%eax, %eax
	je	LBB0_9
## %bb.14:
	movq	%r14, %rax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_13
LBB0_3:
	movq	%rbx, %rdi
	callq	_write_unlock
	movq	32(%r12), %rdi
	leaq	L_.str(%rip), %rsi
	callq	_dev_info
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_12
LBB0_9:
	movq	_EFAULT@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	cmpq	$0, 24(%r12)
	je	LBB0_11
## %bb.10:
	movl	12(%r14), %edx
	movl	4(%r14), %esi
	movl	8(%r14), %ecx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_dma_free_coherent
	jmp	LBB0_11
LBB0_6:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_11:
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	callq	_write_lock
	movq	16(%r12), %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	$0, (%rax,%rcx,8)
	movl	12(%r12), %esi
	movl	%r13d, %edi
	callq	_clear_bit
	movq	%r15, %rdi
	callq	_write_unlock
LBB0_12:
	movq	%r14, %rdi
	callq	_kfree
LBB0_13:
	negl	%ebx
	movl	%ebx, %edi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"QM all queues are busy!\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_QM_Q_DEPTH,4,2                 ## @QM_Q_DEPTH
L_.str.1:                               ## @.str.1
	.asciz	"allocate qp dma buf(va=%pK, dma=%pad, size=%zx)\n"

	.comm	_qm_qp_work_func,4,2            ## @qm_qp_work_func
L_.str.2:                               ## @.str.2
	.asciz	"hisi_qm"

	.comm	_WQ_UNBOUND,4,2                 ## @WQ_UNBOUND
	.comm	_WQ_HIGHPRI,4,2                 ## @WQ_HIGHPRI
	.comm	_WQ_CPU_INTENSIVE,4,2           ## @WQ_CPU_INTENSIVE
	.comm	_WQ_MEM_RECLAIM,4,2             ## @WQ_MEM_RECLAIM
	.comm	_EFAULT,4,2                     ## @EFAULT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hisi_qm_create_qp              ; -- Begin function hisi_qm_create_qp
	.p2align	2
_hisi_qm_create_qp:                     ; @hisi_qm_create_qp
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x24, x1
	mov	x20, x0
	ldr	x23, [x0, #32]
Lloh0:
	adrp	x26, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x26, [x26, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x26]
	mov	w0, #40
	bl	_kzalloc
	cbz	x0, LBB0_7
; %bb.1:
	mov	x19, x0
	add	x21, x20, #8
	mov	x0, x21
	bl	_write_lock
	ldr	w0, [x20, #12]
	ldr	w1, [x20]
	bl	_find_first_zero_bit
	ldr	w8, [x20]
	cmp	w0, w8
	b.ge	LBB0_8
; %bb.2:
	mov	x22, x0
	ldr	w1, [x20, #12]
	bl	_set_bit
	ldr	x8, [x20, #16]
	str	x19, [x8, w22, sxtw #3]
	mov	x0, x21
	bl	_write_unlock
	str	x20, [x19, #32]
	ldr	x8, [x20, #24]
	cbz	x8, LBB0_5
; %bb.3:
	ldr	w8, [x20, #4]
Lloh2:
	adrp	x9, _QM_Q_DEPTH@GOTPAGE
Lloh3:
	ldr	x9, [x9, _QM_Q_DEPTH@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	add	w8, w8, #4
	mul	w1, w9, w8
	str	w1, [x19, #4]
	add	x25, x19, #8
	ldr	w3, [x26]
	mov	x0, x23
	mov	x2, x25
	bl	_dma_alloc_coherent
	str	w0, [x19, #12]
	cbz	w0, LBB0_11
; %bb.4:
	mov	x2, x0
	ldr	w4, [x19, #4]
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x23
	mov	x3, x25
	bl	_dev_dbg
LBB0_5:
	str	w22, [x19]
	str	w24, [x19, #24]
	add	x0, x19, #20
Lloh7:
	adrp	x8, _qm_qp_work_func@GOTPAGE
Lloh8:
	ldr	x8, [x8, _qm_qp_work_func@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	bl	_INIT_WORK
Lloh10:
	adrp	x8, _WQ_UNBOUND@GOTPAGE
Lloh11:
	ldr	x8, [x8, _WQ_UNBOUND@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
Lloh13:
	adrp	x9, _WQ_HIGHPRI@GOTPAGE
Lloh14:
	ldr	x9, [x9, _WQ_HIGHPRI@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh16:
	adrp	x9, _WQ_CPU_INTENSIVE@GOTPAGE
Lloh17:
	ldr	x9, [x9, _WQ_CPU_INTENSIVE@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh19:
	adrp	x9, _WQ_MEM_RECLAIM@GOTPAGE
Lloh20:
	ldr	x9, [x9, _WQ_MEM_RECLAIM@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	orr	w1, w8, w9
Lloh22:
	adrp	x0, l_.str.2@PAGE
Lloh23:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	w2, #0
	bl	_alloc_workqueue
	str	w0, [x19, #16]
	cbz	w0, LBB0_9
; %bb.6:
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_7:
Lloh24:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh26:
	ldr	w24, [x8]
	b	LBB0_14
LBB0_8:
	mov	x0, x21
	bl	_write_unlock
	ldr	x0, [x20, #32]
Lloh27:
	adrp	x1, l_.str@PAGE
Lloh28:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_info
Lloh29:
	adrp	x8, _EBUSY@GOTPAGE
Lloh30:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh31:
	ldr	w24, [x8]
	b	LBB0_13
LBB0_9:
Lloh32:
	adrp	x8, _EFAULT@GOTPAGE
Lloh33:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
Lloh34:
	ldr	w24, [x8]
	ldr	x8, [x20, #24]
	cbz	x8, LBB0_12
; %bb.10:
	ldp	w3, w2, [x19, #8]
	ldr	w1, [x19, #4]
	mov	x0, x23
	bl	_dma_free_coherent
	b	LBB0_12
LBB0_11:
Lloh35:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh36:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh37:
	ldr	w24, [x8]
LBB0_12:
	sxtw	x23, w22
	mov	x0, x21
	bl	_write_lock
	ldr	x8, [x20, #16]
	str	xzr, [x8, x23, lsl #3]
	ldr	w1, [x20, #12]
	mov	x0, x22
	bl	_clear_bit
	mov	x0, x21
	bl	_write_unlock
LBB0_13:
	mov	x0, x19
	bl	_kfree
LBB0_14:
	neg	w0, w24
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_ERR_PTR
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"QM all queues are busy!\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_QM_Q_DEPTH,4,2                 ; @QM_Q_DEPTH
l_.str.1:                               ; @.str.1
	.asciz	"allocate qp dma buf(va=%pK, dma=%pad, size=%zx)\n"

	.comm	_qm_qp_work_func,4,2            ; @qm_qp_work_func
l_.str.2:                               ; @.str.2
	.asciz	"hisi_qm"

	.comm	_WQ_UNBOUND,4,2                 ; @WQ_UNBOUND
	.comm	_WQ_HIGHPRI,4,2                 ; @WQ_HIGHPRI
	.comm	_WQ_CPU_INTENSIVE,4,2           ; @WQ_CPU_INTENSIVE
	.comm	_WQ_MEM_RECLAIM,4,2             ; @WQ_MEM_RECLAIM
	.comm	_EFAULT,4,2                     ; @EFAULT
.subsections_via_symbols
