	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kgd_gfx_v9_set_pasid_vmid_mapping ## -- Begin function kgd_gfx_v9_set_pasid_vmid_mapping
	.p2align	4, 0x90
_kgd_gfx_v9_set_pasid_vmid_mapping:     ## @kgd_gfx_v9_set_pasid_vmid_mapping
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r12d
	movl	%esi, %r14d
	callq	_get_amdgpu_device
	movq	_ATC_VMID0_PASID_MAPPING__VALID_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	orl	%r14d, %ebx
	testl	%r14d, %r14d
	cmovel	%r14d, %ebx
	movq	_ATHUB@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	movq	_mmATC_VMID0_PASID_MAPPING@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%esi, %esi
	callq	_SOC15_REG_OFFSET
	movl	%r12d, %ecx
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	leaq	(%rax,%rcx), %rdi
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movl	%ebx, %esi
	callq	_WREG32
	movl	(%r14), %edi
	movq	_mmATC_VMID_PASID_MAPPING_UPDATE_STATUS@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	xorl	%esi, %esi
	callq	_SOC15_REG_OFFSET
	movq	%rax, %rdi
	callq	_RREG32
	movl	$1, %r13d
	movl	$1, %ebx
	movl	%r12d, %ecx
	shll	%cl, %ebx
	movl	%r12d, -48(%rbp)                ## 4-byte Spill
	btl	%r12d, %eax
	jb	LBB0_2
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_cpu_relax
	movl	(%r14), %edi
	movl	(%r15), %edx
	xorl	%esi, %esi
	callq	_SOC15_REG_OFFSET
	movq	%rax, %rdi
	callq	_RREG32
	testl	%ebx, %eax
	je	LBB0_1
LBB0_2:
	movl	(%r14), %edi
	movl	(%r15), %edx
	xorl	%esi, %esi
	callq	_SOC15_REG_OFFSET
	movq	%rax, %rdi
	movl	%ebx, %esi
	callq	_WREG32
	movq	_OSSSYS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_mmIH_VMID_0_LUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%esi, %esi
	callq	_SOC15_REG_OFFSET
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	leaq	(%rax,%r12), %rdi
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %esi
	callq	_WREG32
	movl	(%r14), %edi
	movq	_mmATC_VMID16_PASID_MAPPING@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%esi, %esi
	callq	_SOC15_REG_OFFSET
	leaq	(%rax,%r12), %rdi
	movl	%ebx, %esi
	callq	_WREG32
	movl	(%r14), %edi
	movl	(%r15), %edx
	xorl	%esi, %esi
	callq	_SOC15_REG_OFFSET
	movq	%rax, %rdi
	callq	_RREG32
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
	addb	$16, %cl
	shll	%cl, %r13d
	movzbl	%cl, %ecx
	btl	%ecx, %eax
	jb	LBB0_4
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_cpu_relax
	movl	(%r14), %edi
	movl	(%r15), %edx
	xorl	%esi, %esi
	callq	_SOC15_REG_OFFSET
	movq	%rax, %rdi
	callq	_RREG32
	testl	%r13d, %eax
	je	LBB0_3
LBB0_4:
	movl	(%r14), %edi
	movl	(%r15), %edx
	xorl	%esi, %esi
	callq	_SOC15_REG_OFFSET
	movq	%rax, %rdi
	movl	%r13d, %esi
	callq	_WREG32
	movq	_OSSSYS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_mmIH_VMID_0_LUT_MM@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%esi, %esi
	callq	_SOC15_REG_OFFSET
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	addq	%rax, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_WREG32
	xorl	%eax, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ATC_VMID0_PASID_MAPPING__VALID_MASK,4,2 ## @ATC_VMID0_PASID_MAPPING__VALID_MASK
	.comm	_ATHUB,4,2                      ## @ATHUB
	.comm	_mmATC_VMID0_PASID_MAPPING,4,2  ## @mmATC_VMID0_PASID_MAPPING
	.comm	_mmATC_VMID_PASID_MAPPING_UPDATE_STATUS,4,2 ## @mmATC_VMID_PASID_MAPPING_UPDATE_STATUS
	.comm	_OSSSYS,4,2                     ## @OSSSYS
	.comm	_mmIH_VMID_0_LUT,4,2            ## @mmIH_VMID_0_LUT
	.comm	_mmATC_VMID16_PASID_MAPPING,4,2 ## @mmATC_VMID16_PASID_MAPPING
	.comm	_mmIH_VMID_0_LUT_MM,4,2         ## @mmIH_VMID_0_LUT_MM
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kgd_gfx_v9_set_pasid_vmid_mapping ; -- Begin function kgd_gfx_v9_set_pasid_vmid_mapping
	.p2align	2
_kgd_gfx_v9_set_pasid_vmid_mapping:     ; @kgd_gfx_v9_set_pasid_vmid_mapping
	.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	x20, x2
	mov	x19, x1
	bl	_get_amdgpu_device
Lloh0:
	adrp	x8, _ATC_VMID0_PASID_MAPPING__VALID_MASK@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ATC_VMID0_PASID_MAPPING__VALID_MASK@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	orr	w8, w8, w19
	cmp	w19, #0
	csel	w19, wzr, w8, eq
Lloh3:
	adrp	x23, _ATHUB@GOTPAGE
Lloh4:
	ldr	x23, [x23, _ATHUB@GOTPAGEOFF]
	ldr	w0, [x23]
Lloh5:
	adrp	x8, _mmATC_VMID0_PASID_MAPPING@GOTPAGE
Lloh6:
	ldr	x8, [x8, _mmATC_VMID0_PASID_MAPPING@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	mov	w1, #0
	bl	_SOC15_REG_OFFSET
	mov	w22, w20
	add	x0, x0, x22
	mov	x1, x19
	bl	_WREG32
	ldr	w0, [x23]
Lloh8:
	adrp	x24, _mmATC_VMID_PASID_MAPPING_UPDATE_STATUS@GOTPAGE
Lloh9:
	ldr	x24, [x24, _mmATC_VMID_PASID_MAPPING_UPDATE_STATUS@GOTPAGEOFF]
	ldr	w2, [x24]
	mov	w1, #0
	bl	_SOC15_REG_OFFSET
	bl	_RREG32
	mov	w25, #1
	lsl	w21, w25, w20
	tst	w0, w21
	b.ne	LBB0_2
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	bl	_cpu_relax
	ldr	w0, [x23]
	ldr	w2, [x24]
	mov	w1, #0
	bl	_SOC15_REG_OFFSET
	bl	_RREG32
	tst	w0, w21
	b.eq	LBB0_1
LBB0_2:
	ldr	w0, [x23]
	ldr	w2, [x24]
	mov	w1, #0
	bl	_SOC15_REG_OFFSET
	mov	x1, x21
	bl	_WREG32
Lloh10:
	adrp	x21, _OSSSYS@GOTPAGE
Lloh11:
	ldr	x21, [x21, _OSSSYS@GOTPAGEOFF]
	ldr	w0, [x21]
Lloh12:
	adrp	x8, _mmIH_VMID_0_LUT@GOTPAGE
Lloh13:
	ldr	x8, [x8, _mmIH_VMID_0_LUT@GOTPAGEOFF]
Lloh14:
	ldr	w2, [x8]
	mov	w1, #0
	bl	_SOC15_REG_OFFSET
	add	x0, x0, x22
	mov	x1, x19
	bl	_WREG32
	ldr	w0, [x23]
Lloh15:
	adrp	x8, _mmATC_VMID16_PASID_MAPPING@GOTPAGE
Lloh16:
	ldr	x8, [x8, _mmATC_VMID16_PASID_MAPPING@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	mov	w1, #0
	bl	_SOC15_REG_OFFSET
	add	x0, x0, x22
	mov	x1, x19
	bl	_WREG32
	ldr	w0, [x23]
	ldr	w2, [x24]
	mov	w1, #0
	bl	_SOC15_REG_OFFSET
	bl	_RREG32
	add	w8, w20, #16
	lsl	w20, w25, w8
	tst	w0, w20
	b.ne	LBB0_4
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	bl	_cpu_relax
	ldr	w0, [x23]
	ldr	w2, [x24]
	mov	w1, #0
	bl	_SOC15_REG_OFFSET
	bl	_RREG32
	tst	w0, w20
	b.eq	LBB0_3
LBB0_4:
	ldr	w0, [x23]
	ldr	w2, [x24]
	mov	w1, #0
	bl	_SOC15_REG_OFFSET
	mov	x1, x20
	bl	_WREG32
	ldr	w0, [x21]
Lloh18:
	adrp	x8, _mmIH_VMID_0_LUT_MM@GOTPAGE
Lloh19:
	ldr	x8, [x8, _mmIH_VMID_0_LUT_MM@GOTPAGEOFF]
Lloh20:
	ldr	w2, [x8]
	mov	w1, #0
	bl	_SOC15_REG_OFFSET
	add	x0, x0, x22
	mov	x1, x19
	bl	_WREG32
	mov	w0, #0
	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
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_ATC_VMID0_PASID_MAPPING__VALID_MASK,4,2 ; @ATC_VMID0_PASID_MAPPING__VALID_MASK
	.comm	_ATHUB,4,2                      ; @ATHUB
	.comm	_mmATC_VMID0_PASID_MAPPING,4,2  ; @mmATC_VMID0_PASID_MAPPING
	.comm	_mmATC_VMID_PASID_MAPPING_UPDATE_STATUS,4,2 ; @mmATC_VMID_PASID_MAPPING_UPDATE_STATUS
	.comm	_OSSSYS,4,2                     ; @OSSSYS
	.comm	_mmIH_VMID_0_LUT,4,2            ; @mmIH_VMID_0_LUT
	.comm	_mmATC_VMID16_PASID_MAPPING,4,2 ; @mmATC_VMID16_PASID_MAPPING
	.comm	_mmIH_VMID_0_LUT_MM,4,2         ; @mmIH_VMID_0_LUT_MM
.subsections_via_symbols
