	.file	"extr_kfd_chardev.c_kfd_ioctl_alloc_memory_of_gpu.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"Alloc host visible vram on small bar is not allowed\n"
	.text
	.p2align 4
	.type	kfd_ioctl_alloc_memory_of_gpu, @function
kfd_ioctl_alloc_memory_of_gpu:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	mov	eax, DWORD PTR [rdx]
	cmp	QWORD PTR 8[rdx], 0
	mov	DWORD PTR 12[rsp], eax
	jne	.L2
.L29:
	mov	eax, DWORD PTR EINVAL[rip]
	neg	eax
.L1:
	mov	rcx, QWORD PTR 24[rsp]
	xor	rcx, QWORD PTR fs:40
	jne	.L31
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	mov	edi, DWORD PTR 16[rdx]
	mov	r14d, DWORD PTR 4[rdx]
	mov	r12, rsi
	mov	rbx, rdx
	call	kfd_device_by_id@PLT
	mov	r13, rax
	test	rax, rax
	je	.L29
	test	DWORD PTR KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC[rip], r14d
	je	.L5
	test	DWORD PTR KFD_IOC_ALLOC_MEM_FLAGS_VRAM[rip], r14d
	jne	.L32
.L5:
	test	DWORD PTR KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL[rip], r14d
	jne	.L33
	test	DWORD PTR KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP[rip], r14d
	je	.L8
	mov	rax, QWORD PTR PAGE_SIZE[rip]
	cmp	QWORD PTR 8[rbx], rax
	jne	.L29
	mov	edi, DWORD PTR 0[r13]
	call	amdgpu_amdkfd_get_mmio_remap_phys_addr@PLT
	mov	DWORD PTR 12[rsp], eax
	test	eax, eax
	jne	.L8
	mov	eax, DWORD PTR ENOMEM[rip]
	neg	eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L33:
	mov	rbp, QWORD PTR 8[rbx]
	mov	rdi, r13
	call	kfd_doorbell_process_slice@PLT
	cmp	rbp, rax
	jne	.L29
	mov	rsi, r12
	mov	rdi, r13
	call	kfd_get_process_doorbells@PLT
	mov	DWORD PTR 12[rsp], eax
.L8:
	mov	rdi, r12
	call	mutex_lock@PLT
	mov	rdi, r13
	mov	rsi, r12
	call	kfd_bind_process_to_device@PLT
	mov	rdi, rax
	mov	r15, rax
	call	IS_ERR@PLT
	test	rax, rax
	jne	.L34
	sub	rsp, 8
	.cfi_def_cfa_offset 104
	mov	rdx, QWORD PTR 8[rbx]
	mov	esi, DWORD PTR 24[rbx]
	push	r14
	.cfi_def_cfa_offset 112
	mov	ecx, DWORD PTR [r15]
	mov	edi, DWORD PTR 0[r13]
	lea	r9, 28[rsp]
	lea	r8, 32[rsp]
	call	amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu@PLT
	mov	rbp, rax
	pop	rax
	.cfi_def_cfa_offset 104
	pop	rdx
	.cfi_def_cfa_offset 96
	test	rbp, rbp
	jne	.L12
	mov	rsi, QWORD PTR 16[rsp]
	mov	rdi, r15
	call	kfd_process_device_create_obj_handle@PLT
	mov	ebp, eax
	test	eax, eax
	js	.L35
	mov	rdi, r12
	call	mutex_unlock@PLT
	mov	edi, DWORD PTR 16[rbx]
	mov	esi, ebp
	call	MAKE_HANDLE@PLT
	mov	DWORD PTR 20[rbx], eax
	mov	eax, DWORD PTR 12[rsp]
	mov	DWORD PTR [rbx], eax
	mov	eax, r14d
	and	eax, DWORD PTR KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP[rip]
	je	.L1
	mov	edi, DWORD PTR 16[rbx]
	call	KFD_MMAP_GPU_ID@PLT
	mov	ecx, DWORD PTR PAGE_SHIFT[rip]
	or	eax, DWORD PTR KFD_MMAP_TYPE_MMIO[rip]
	sal	eax, cl
	mov	DWORD PTR [rbx], eax
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L34:
	mov	rdi, r15
	call	PTR_ERR@PLT
	mov	rbp, rax
.L12:
	mov	rdi, r12
	call	mutex_unlock@PLT
	mov	eax, ebp
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L32:
	mov	rdi, rax
	call	kfd_dev_is_large_bar@PLT
	test	eax, eax
	jne	.L5
	lea	rdi, .LC0[rip]
	call	pr_err@PLT
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L35:
	mov	rbp, QWORD PTR EFAULT[rip]
	mov	rsi, QWORD PTR 16[rsp]
	mov	edi, DWORD PTR 0[r13]
	neg	rbp
	call	amdgpu_amdkfd_gpuvm_free_memory_of_gpu@PLT
	jmp	.L12
.L31:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	kfd_ioctl_alloc_memory_of_gpu, .-kfd_ioctl_alloc_memory_of_gpu
	.comm	PAGE_SIZE,8,8
	.comm	PAGE_SHIFT,4,4
	.comm	KFD_MMAP_TYPE_MMIO,4,4
	.comm	KFD_IOC_ALLOC_MEM_FLAGS_VRAM,4,4
	.comm	KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC,4,4
	.comm	KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP,4,4
	.comm	KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL,4,4
	.comm	ENOMEM,4,4
	.comm	EINVAL,4,4
	.comm	EFAULT,8,8
	.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_chardev.c_kfd_ioctl_alloc_memory_of_gpu.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Alloc host visible vram on small bar is not allowed"
	.ascii	"\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	kfd_ioctl_alloc_memory_of_gpu, %function
kfd_ioctl_alloc_memory_of_gpu:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, lr}
	mov	r4, r2
	ldr	r2, [r2, #8]
	ldr	r3, [r4]
	cmp	r2, #0
	ldr	r2, .L36
	sub	sp, sp, #36
	ldr	r2, [r2]
	str	r2, [sp, #28]
	mov	r2,#0
	str	r3, [sp, #24]
	bne	.L2
.L29:
	ldr	r3, .L36+4
	ldr	r5, [r3]
	rsb	r5, r5, #0
.L1:
	ldr	r3, .L36
	ldr	r2, [r3]
	ldr	r3, [sp, #28]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L31
	mov	r0, r5
	add	sp, sp, #36
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L2:
	ldr	r0, [r4, #12]
	mov	r6, r1
	ldr	r8, [r4, #4]
	bl	kfd_device_by_id
	subs	r7, r0, #0
	beq	.L29
	ldr	r3, .L36+8
	ldr	r3, [r3]
	tst	r8, r3
	beq	.L5
	ldr	r3, .L36+12
	ldr	r3, [r3]
	tst	r8, r3
	bne	.L32
.L5:
	ldr	r3, .L36+16
	ldr	r3, [r3]
	tst	r8, r3
	bne	.L33
	ldr	r3, .L36+20
	ldr	r3, [r3]
	tst	r8, r3
	beq	.L8
	ldr	r3, .L36+24
	ldr	r2, [r4, #8]
	ldr	r3, [r3]
	cmp	r2, r3
	bne	.L29
	ldr	r0, [r7]
	bl	amdgpu_amdkfd_get_mmio_remap_phys_addr
	cmp	r0, #0
	str	r0, [sp, #24]
	bne	.L8
	ldr	r3, .L36+28
	ldr	r5, [r3]
	rsb	r5, r5, #0
	b	.L1
.L33:
	mov	r0, r7
	ldr	r5, [r4, #8]
	bl	kfd_doorbell_process_slice
	cmp	r5, r0
	bne	.L29
	mov	r1, r6
	mov	r0, r7
	bl	kfd_get_process_doorbells
	str	r0, [sp, #24]
.L8:
	mov	r0, r6
	bl	mutex_lock
	mov	r1, r6
	mov	r0, r7
	bl	kfd_bind_process_to_device
	mov	r9, r0
	bl	IS_ERR
	cmp	r0, #0
	bne	.L34
	add	r1, sp, #24
	ldr	r3, [r9]
	ldr	r0, [r7]
	stmib	sp, {r1, r8}
	add	r2, sp, #20
	str	r2, [sp]
	ldr	r2, [r4, #8]
	ldr	r1, [r4, #20]
	bl	amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu
	subs	r5, r0, #0
	bne	.L12
	mov	r0, r9
	ldr	r1, [sp, #20]
	bl	kfd_process_device_create_obj_handle
	subs	r9, r0, #0
	blt	.L35
	mov	r0, r6
	bl	mutex_unlock
	mov	r1, r9
	ldr	r0, [r4, #12]
	bl	MAKE_HANDLE
	ldr	r3, .L36+20
	str	r0, [r4, #16]
	ldr	r2, [r3]
	ldr	r3, [sp, #24]
	tst	r8, r2
	str	r3, [r4]
	beq	.L1
	ldr	r0, [r4, #12]
	bl	KFD_MMAP_GPU_ID
	ldr	r3, .L36+32
	ldr	r2, .L36+36
	ldr	r3, [r3]
	ldr	r2, [r2]
	orr	r3, r0, r3
	lsl	r3, r3, r2
	str	r3, [r4]
	b	.L1
.L34:
	mov	r0, r9
	bl	PTR_ERR
	mov	r5, r0
.L12:
	mov	r0, r6
	bl	mutex_unlock
	b	.L1
.L32:
	bl	kfd_dev_is_large_bar
	cmp	r0, #0
	bne	.L5
	ldr	r0, .L36+40
	bl	pr_err
	b	.L29
.L35:
	ldr	r3, .L36+44
	ldr	r0, [r7]
	ldr	r5, [r3]
	ldr	r1, [sp, #20]
	rsb	r5, r5, #0
	bl	amdgpu_amdkfd_gpuvm_free_memory_of_gpu
	b	.L12
.L31:
	bl	__stack_chk_fail
.L37:
	.align	2
.L36:
	.word	.LC1
	.word	EINVAL
	.word	KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC
	.word	KFD_IOC_ALLOC_MEM_FLAGS_VRAM
	.word	KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL
	.word	KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP
	.word	PAGE_SIZE
	.word	ENOMEM
	.word	KFD_MMAP_TYPE_MMIO
	.word	PAGE_SHIFT
	.word	.LC0
	.word	EFAULT
	.size	kfd_ioctl_alloc_memory_of_gpu, .-kfd_ioctl_alloc_memory_of_gpu
	.comm	PAGE_SIZE,4,4
	.comm	PAGE_SHIFT,4,4
	.comm	KFD_MMAP_TYPE_MMIO,4,4
	.comm	KFD_IOC_ALLOC_MEM_FLAGS_VRAM,4,4
	.comm	KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC,4,4
	.comm	KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP,4,4
	.comm	KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL,4,4
	.comm	ENOMEM,4,4
	.comm	EINVAL,4,4
	.comm	EFAULT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
