arch/powerpc/kvm/book3s_hv_interrupts.S

Source file repositories/reference/linux-study-clean/arch/powerpc/kvm/book3s_hv_interrupts.S

File Facts

System
Linux kernel
Corpus path
arch/powerpc/kvm/book3s_hv_interrupts.S
Extension
.S
Size
3826 bytes
Lines
159
Domain
Architecture Layer
Bucket
arch/powerpc
Inferred role
Architecture Layer: arch/powerpc
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/linkage.h>
#include <asm/ppc_asm.h>
#include <asm/kvm_asm.h>
#include <asm/reg.h>
#include <asm/page.h>
#include <asm/asm-offsets.h>
#include <asm/exception-64s.h>
#include <asm/ppc-opcode.h>
#include <asm/asm-compat.h>
#include <asm/feature-fixups.h>

/*****************************************************************************
 *                                                                           *
 *     Guest entry / exit code that is in kernel module memory (vmalloc)     *
 *                                                                           *
 ****************************************************************************/

/* Registers:
 *  none
 */
_GLOBAL(__kvmppc_vcore_entry)

	/* Write correct stack frame */
	mflr	r0
	std	r0,PPC_LR_STKOFF(r1)

	/* Save host state to the stack */
	stdu	r1, -SWITCH_FRAME_SIZE(r1)

	/* Save non-volatile registers (r14 - r31) and CR */
	SAVE_NVGPRS(r1)
	mfcr	r3
	std	r3, _CCR(r1)

	/* Save host DSCR */
	mfspr	r3, SPRN_DSCR
	std	r3, HSTATE_DSCR(r13)

BEGIN_FTR_SECTION
	/* Save host DABR */
	mfspr	r3, SPRN_DABR
	std	r3, HSTATE_DABR(r13)
END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)

	/* Save host PMU registers */
	bl	kvmhv_save_host_pmu

	/*
	 * Put whatever is in the decrementer into the
	 * hypervisor decrementer.
	 * Because of a hardware deviation in P8,
	 * we need to set LPCR[HDICE] before writing HDEC.
	 */
	ld	r5, HSTATE_KVM_VCORE(r13)
	ld	r6, VCORE_KVM(r5)
	ld	r9, KVM_HOST_LPCR(r6)
	ori	r8, r9, LPCR_HDICE
	mtspr	SPRN_LPCR, r8
	isync
	mfspr	r8,SPRN_DEC
	mftb	r7
	extsw	r8,r8
	mtspr	SPRN_HDEC,r8
	add	r8,r8,r7
	std	r8,HSTATE_DECEXP(r13)

	/* Jump to partition switch code */
	bl	kvmppc_hv_entry_trampoline
	nop

Annotation

Implementation Notes