arch/arm64/include/asm/kvm_emulate.h
Source file repositories/reference/linux-study-clean/arch/arm64/include/asm/kvm_emulate.h
File Facts
- System
- Linux kernel
- Corpus path
arch/arm64/include/asm/kvm_emulate.h- Extension
.h- Size
- 17969 bytes
- Lines
- 692
- Domain
- Architecture Layer
- Bucket
- arch/arm64
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/kvm_host.hasm/debug-monitors.hasm/esr.hasm/kvm_arm.hasm/kvm_hyp.hasm/kvm_nested.hasm/ptrace.hasm/cputype.hasm/virt.h
Detected Declarations
enum exception_typefunction kvm_inject_sea_dabtfunction kvm_inject_sea_iabtfunction kvm_inject_serrorfunction kvm_inject_nested_sve_trapfunction vcpu_el1_is_32bitfunction vcpu_el1_is_32bitfunction vcpu_reset_hcrfunction vcpu_get_vsesrfunction vcpu_set_vsesrfunction vcpu_mode_is_32bitfunction kvm_condition_validfunction vcpu_set_thumbfunction vcpu_get_regfunction vcpu_set_regfunction vcpu_is_el2_ctxtfunction vcpu_is_el2function vcpu_el2_e2h_is_setfunction vcpu_el2_tge_is_setfunction vcpu_el2_amo_is_setfunction is_hyp_ctxtfunction vcpu_is_host_el0function is_nested_ctxtfunction vserror_state_is_nestedfunction host_spsr_to_spsr32function vcpu_mode_privfunction kvm_vcpu_get_esrfunction guest_hyp_wfx_traps_enabledfunction kvm_vcpu_get_conditionfunction kvm_vcpu_get_hfarfunction kvm_vcpu_get_fault_ipafunction kvm_vcpu_get_disrfunction kvm_vcpu_hvc_get_immfunction kvm_vcpu_dabt_isvalidfunction kvm_vcpu_dabt_iss_nisv_sanitizedfunction kvm_vcpu_dabt_issextfunction kvm_vcpu_dabt_issffunction kvm_vcpu_dabt_get_rdfunction kvm_vcpu_abt_iss1twfunction kvm_vcpu_dabt_iswritefunction kvm_vcpu_dabt_is_cmfunction kvm_vcpu_dabt_get_asfunction kvm_vcpu_trap_il_is32bitfunction kvm_vcpu_trap_get_classfunction kvm_vcpu_trap_is_iabtfunction kvm_vcpu_trap_is_exec_faultfunction kvm_vcpu_trap_get_faultfunction kvm_vcpu_trap_is_permission_fault
Annotated Snippet
switch (len) {
case 1:
return data & 0xff;
case 2:
return be16_to_cpu(data & 0xffff);
case 4:
return be32_to_cpu(data & 0xffffffff);
default:
return be64_to_cpu(data);
}
} else {
switch (len) {
case 1:
return data & 0xff;
case 2:
return le16_to_cpu(data & 0xffff);
case 4:
return le32_to_cpu(data & 0xffffffff);
default:
return le64_to_cpu(data);
}
}
return data; /* Leave LE untouched */
}
static inline unsigned long vcpu_data_host_to_guest(struct kvm_vcpu *vcpu,
unsigned long data,
unsigned int len)
{
if (kvm_vcpu_is_be(vcpu)) {
switch (len) {
case 1:
return data & 0xff;
case 2:
return cpu_to_be16(data & 0xffff);
case 4:
return cpu_to_be32(data & 0xffffffff);
default:
return cpu_to_be64(data);
}
} else {
switch (len) {
case 1:
return data & 0xff;
case 2:
return cpu_to_le16(data & 0xffff);
case 4:
return cpu_to_le32(data & 0xffffffff);
default:
return cpu_to_le64(data);
}
}
return data; /* Leave LE untouched */
}
static __always_inline void kvm_incr_pc(struct kvm_vcpu *vcpu)
{
WARN_ON(vcpu_get_flag(vcpu, PENDING_EXCEPTION));
vcpu_set_flag(vcpu, INCREMENT_PC);
}
#define kvm_pend_exception(v, e) \
do { \
WARN_ON(vcpu_get_flag((v), INCREMENT_PC)); \
vcpu_set_flag((v), PENDING_EXCEPTION); \
vcpu_set_flag((v), e); \
} while (0)
/*
* Returns a 'sanitised' view of CPTR_EL2, translating from nVHE to the VHE
* format if E2H isn't set.
*/
static inline u64 vcpu_sanitised_cptr_el2(const struct kvm_vcpu *vcpu)
{
u64 cptr = __vcpu_sys_reg(vcpu, CPTR_EL2);
if (!vcpu_el2_e2h_is_set(vcpu))
cptr = translate_cptr_el2_to_cpacr_el1(cptr);
return cptr;
}
static inline bool ____cptr_xen_trap_enabled(const struct kvm_vcpu *vcpu,
unsigned int xen)
{
switch (xen) {
case 0b00:
case 0b10:
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/kvm_host.h`, `asm/debug-monitors.h`, `asm/esr.h`, `asm/kvm_arm.h`, `asm/kvm_hyp.h`, `asm/kvm_nested.h`, `asm/ptrace.h`.
- Detected declarations: `enum exception_type`, `function kvm_inject_sea_dabt`, `function kvm_inject_sea_iabt`, `function kvm_inject_serror`, `function kvm_inject_nested_sve_trap`, `function vcpu_el1_is_32bit`, `function vcpu_el1_is_32bit`, `function vcpu_reset_hcr`, `function vcpu_get_vsesr`, `function vcpu_set_vsesr`.
- Atlas domain: Architecture Layer / arch/arm64.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.