arch/arm64/kvm/hyp/nvhe/hyp-init.S

Source file repositories/reference/linux-study-clean/arch/arm64/kvm/hyp/nvhe/hyp-init.S

File Facts

System
Linux kernel
Corpus path
arch/arm64/kvm/hyp/nvhe/hyp-init.S
Extension
.S
Size
6237 bytes
Lines
298
Domain
Architecture Layer
Bucket
arch/arm64
Inferred role
Architecture Layer: arch/arm64
Status
atlas-only

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

#include <linux/arm-smccc.h>
#include <linux/cfi_types.h>
#include <linux/linkage.h>

#include <asm/alternative.h>
#include <asm/assembler.h>
#include <asm/el2_setup.h>
#include <asm/kvm_arm.h>
#include <asm/kvm_asm.h>
#include <asm/kvm_mmu.h>
#include <asm/pgtable-hwdef.h>
#include <asm/sysreg.h>
#include <asm/virt.h>

	.text
	.pushsection	.idmap.text, "ax"

	.align	11

SYM_CODE_START(__kvm_hyp_init)
	ventry	.			// Synchronous EL2t
	ventry	.			// IRQ EL2t
	ventry	.			// FIQ EL2t
	ventry	.			// Error EL2t

	ventry	.			// Synchronous EL2h
	ventry	.			// IRQ EL2h
	ventry	.			// FIQ EL2h
	ventry	.			// Error EL2h

	ventry	__do_hyp_init		// Synchronous 64-bit EL1
	ventry	.			// IRQ 64-bit EL1
	ventry	.			// FIQ 64-bit EL1
	ventry	.			// Error 64-bit EL1

	ventry	.			// Synchronous 32-bit EL1
	ventry	.			// IRQ 32-bit EL1
	ventry	.			// FIQ 32-bit EL1
	ventry	.			// Error 32-bit EL1

	/*
	 * Only uses x0..x3 so as to not clobber callee-saved SMCCC registers.
	 *
	 * x0: SMCCC function ID
	 * x1: struct kvm_nvhe_init_params PA
	 */
__do_hyp_init:
	/* Check for a stub HVC call */
	cmp	x0, #HVC_STUB_HCALL_NR
	b.lo	__kvm_handle_stub_hvc

	bic	x0, x0, #ARM_SMCCC_CALL_HINTS
	mov	x3, #KVM_HOST_SMCCC_FUNC(__kvm_hyp_init)
	cmp	x0, x3
	b.eq	1f

	mov	x0, #SMCCC_RET_NOT_SUPPORTED
	eret

1:	mov	x0, x1
	mov	x3, lr
	bl	___kvm_hyp_init			// Clobbers x0..x2
	mov	lr, x3

	/* Hello, World! */
	mov	x0, #SMCCC_RET_SUCCESS
	eret
SYM_CODE_END(__kvm_hyp_init)

/*

Annotation

Implementation Notes