	.file	"extr_book3s_hv.c_kvmppc_hv_setup_htab_rma.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"KVM: Couldn't alloc HPT\n"
	.text
	.p2align 4
	.type	kvmppc_hv_setup_htab_rma, @function
kvmppc_hv_setup_htab_rma:
.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
	mov	r14, rdi
	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	r13, QWORD PTR [rdi]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	mov	eax, DWORD PTR 16[r13]
	test	eax, eax
	jne	.L2
	mov	ebx, DWORD PTR KVM_DEFAULT_HPT_ORDER[rip]
	lea	rbp, 20[rsp]
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L25:
	sub	ebx, 1
	cmp	DWORD PTR PPC_MIN_HPT_ORDER[rip], ebx
	jg	.L4
.L5:
	mov	esi, ebx
	mov	rdi, rbp
	call	kvmppc_allocate_hpt@PLT
	mov	r12d, eax
	add	eax, DWORD PTR ENOMEM[rip]
	je	.L25
.L4:
	test	r12d, r12d
	js	.L26
	mov	rsi, rbp
	mov	rdi, r13
	call	kvmppc_set_hpt@PLT
.L2:
	mov	rdi, r13
	call	srcu_read_lock@PLT
	xor	esi, esi
	mov	rdi, r13
	mov	ebp, eax
	call	gfn_to_memslot@PLT
	mov	r12d, DWORD PTR EINVAL[rip]
	mov	r15, rax
	neg	r12d
	test	rax, rax
	je	.L8
	mov	eax, DWORD PTR [rax]
	test	DWORD PTR KVM_MEMSLOT_INVALID[rip], eax
	je	.L27
.L8:
	mov	esi, ebp
	mov	rdi, r13
	call	srcu_read_unlock@PLT
.L7:
	endbr64
.L1:
	mov	rax, QWORD PTR 24[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L28
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r12d
	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
.L27:
	.cfi_restore_state
	mov	rax, QWORD PTR current[rip]
	mov	rbx, QWORD PTR 8[r15]
	mov	rdi, QWORD PTR [rax]
	call	down_read@PLT
	mov	rax, QWORD PTR current[rip]
	mov	rsi, rbx
	mov	rdi, QWORD PTR [rax]
	call	find_vma@PLT
	test	rax, rax
	je	.L9
	cmp	QWORD PTR [rax], rbx
	ja	.L9
	mov	edx, DWORD PTR 8[rax]
	test	DWORD PTR VM_IO[rip], edx
	je	.L10
.L9:
	mov	rax, QWORD PTR current[rip]
	mov	rdi, QWORD PTR [rax]
	call	up_read@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L26:
	lea	rdi, .LC0[rip]
	call	pr_err@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L10:
	mov	rdi, rax
	mov	r12d, 16777216
	call	vma_kernel_pagesize@PLT
	mov	rbx, rax
	mov	rax, QWORD PTR current[rip]
	mov	rdi, QWORD PTR [rax]
	call	up_read@PLT
	cmp	rbx, 16777215
	ja	.L11
	cmp	rbx, 65536
	sbb	r12, r12
	and	r12, -61440
	add	r12, 65536
.L11:
	mov	rdi, r12
	call	__ilog2@PLT
	mov	rdi, r12
	mov	QWORD PTR 8[rsp], rax
	call	slb_pgsize_encoding@PLT
	mov	rdx, QWORD PTR 8[rsp]
	mov	rdi, r14
	mov	rsi, r15
	mov	rcx, QWORD PTR SLB_VSID_SHIFT_1T[rip]
	mov	rbx, rax
	mov	rax, QWORD PTR VRMA_VSID[rip]
	sal	rax, cl
	or	rax, QWORD PTR SLB_VSID_B_1T[rip]
	or	rax, rbx
	mov	QWORD PTR 8[r13], rax
	call	kvmppc_map_vrma@PLT
	mov	edi, DWORD PTR CPU_FTR_ARCH_300[rip]
	call	cpu_has_feature@PLT
	test	eax, eax
	je	.L29
.L12:
	xor	eax, eax
	xor	r12d, r12d
	call	smp_wmb@PLT
	jmp	.L8
.L29:
	mov	eax, DWORD PTR LPCR_VRMASD_SH[rip]
	mov	rsi, rbx
	mov	edx, DWORD PTR LPCR_VRMASD[rip]
	mov	rdi, r13
	lea	ecx, -4[rax]
	sal	rsi, cl
	call	kvmppc_update_lpcr@PLT
	jmp	.L12
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	kvmppc_hv_setup_htab_rma, .-kvmppc_hv_setup_htab_rma
	.comm	current,8,8
	.comm	VRMA_VSID,8,8
	.comm	VM_IO,4,4
	.comm	SLB_VSID_SHIFT_1T,8,8
	.comm	SLB_VSID_B_1T,8,8
	.comm	PPC_MIN_HPT_ORDER,4,4
	.comm	LPCR_VRMASD_SH,4,4
	.comm	LPCR_VRMASD,4,4
	.comm	KVM_MEMSLOT_INVALID,4,4
	.comm	KVM_DEFAULT_HPT_ORDER,4,4
	.comm	ENOMEM,4,4
	.comm	EINVAL,4,4
	.comm	CPU_FTR_ARCH_300,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_book3s_hv.c_kvmppc_hv_setup_htab_rma.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"KVM: Couldn't alloc HPT\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	kvmppc_hv_setup_htab_rma, %function
kvmppc_hv_setup_htab_rma:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	ldr	r3, .L29
	ldr	r7, [r0]
	sub	sp, sp, #8
	ldr	r3, [r3]
	str	r3, [sp, #4]
	mov	r3,#0
	ldr	r3, [r7, #8]
	mov	r8, r0
	cmp	r3, #0
	bne	.L2
	ldr	r3, .L29+4
	mov	r0, sp
	ldr	r5, [r3]
	ldr	r6, .L29+8
	mov	r1, r5
	bl	kvmppc_allocate_hpt
	ldr	r3, [r6]
	mov	r4, r0
	cmn	r0, r3
	bne	.L4
	ldr	r9, .L29+12
	b	.L3
.L5:
	mov	r1, r5
	mov	r0, sp
	bl	kvmppc_allocate_hpt
	ldr	r3, [r6]
	mov	r4, r0
	cmn	r0, r3
	bne	.L4
.L3:
	ldr	r3, [r9]
	sub	r5, r5, #1
	cmp	r3, r5
	ble	.L5
.L4:
	cmp	r4, #0
	blt	.L25
	mov	r1, sp
	mov	r0, r7
	bl	kvmppc_set_hpt
.L2:
	mov	r0, r7
	bl	srcu_read_lock
	mov	r1, #0
	mov	r6, r0
	mov	r0, r7
	bl	gfn_to_memslot
	ldr	r3, .L29+16
	subs	r5, r0, #0
	ldr	r4, [r3]
	rsb	r4, r4, #0
	beq	.L8
	ldr	r3, .L29+20
	ldr	r2, [r5]
	ldr	r3, [r3]
	tst	r2, r3
	beq	.L26
.L8:
	mov	r1, r6
	mov	r0, r7
	bl	srcu_read_unlock
.L7:
.L1:
	ldr	r3, .L29
	ldr	r2, [r3]
	ldr	r3, [sp, #4]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L27
	mov	r0, r4
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L26:
	ldr	r10, .L29+24
	ldr	r9, [r5, #4]
	ldr	r3, [r10]
	ldr	r0, [r3]
	bl	down_read
	ldr	r3, [r10]
	mov	r1, r9
	ldr	r0, [r3]
	bl	find_vma
	subs	r3, r0, #0
	beq	.L9
	ldr	r2, [r3]
	cmp	r2, r9
	bhi	.L9
	ldr	r1, .L29+28
	ldr	r2, [r3, #4]
	ldr	r3, [r1]
	tst	r2, r3
	beq	.L10
.L9:
	ldr	r3, [r10]
	ldr	r0, [r3]
	bl	up_read
	b	.L8
.L25:
	ldr	r0, .L29+32
	bl	pr_err
	b	.L1
.L10:
	bl	vma_kernel_pagesize
	mov	r4, r0
	ldr	r3, [r10]
	ldr	r0, [r3]
	bl	up_read
	cmp	r4, #16777216
	movcs	r4, #16777216
	bcs	.L11
	cmp	r4, #65536
	movcs	r4, #65536
	movcc	r4, #4096
.L11:
	mov	r0, r4
	bl	__ilog2
	mov	r9, r0
	mov	r0, r4
	bl	slb_pgsize_encoding
	mov	r4, r0
	ldr	r1, .L29+36
	ldr	r2, .L29+40
	ldr	r3, .L29+44
	ldr	r0, [r1]
	ldr	r3, [r3]
	ldr	r1, [r2]
	mov	r2, r9
	orr	r3, r3, r0, lsl r1
	orr	r3, r3, r4
	mov	r1, r5
	str	r3, [r7, #4]
	mov	r0, r8
	bl	kvmppc_map_vrma
	ldr	r3, .L29+48
	ldr	r0, [r3]
	bl	cpu_has_feature
	cmp	r0, #0
	beq	.L28
.L12:
	bl	smp_wmb
	mov	r4, #0
	b	.L8
.L28:
	ldr	r2, .L29+52
	ldr	r3, .L29+56
	ldr	r1, [r2]
	mov	r0, r7
	sub	r1, r1, #4
	ldr	r2, [r3]
	lsl	r1, r4, r1
	bl	kvmppc_update_lpcr
	b	.L12
.L27:
	bl	__stack_chk_fail
.L30:
	.align	2
.L29:
	.word	.LC1
	.word	KVM_DEFAULT_HPT_ORDER
	.word	ENOMEM
	.word	PPC_MIN_HPT_ORDER
	.word	EINVAL
	.word	KVM_MEMSLOT_INVALID
	.word	current
	.word	VM_IO
	.word	.LC0
	.word	VRMA_VSID
	.word	SLB_VSID_SHIFT_1T
	.word	SLB_VSID_B_1T
	.word	CPU_FTR_ARCH_300
	.word	LPCR_VRMASD_SH
	.word	LPCR_VRMASD
	.size	kvmppc_hv_setup_htab_rma, .-kvmppc_hv_setup_htab_rma
	.comm	current,4,4
	.comm	VRMA_VSID,4,4
	.comm	VM_IO,4,4
	.comm	SLB_VSID_SHIFT_1T,4,4
	.comm	SLB_VSID_B_1T,4,4
	.comm	PPC_MIN_HPT_ORDER,4,4
	.comm	LPCR_VRMASD_SH,4,4
	.comm	LPCR_VRMASD,4,4
	.comm	KVM_MEMSLOT_INVALID,4,4
	.comm	KVM_DEFAULT_HPT_ORDER,4,4
	.comm	ENOMEM,4,4
	.comm	EINVAL,4,4
	.comm	CPU_FTR_ARCH_300,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
