arch/arm64/include/asm/kvm_nested.h
Source file repositories/reference/linux-study-clean/arch/arm64/include/asm/kvm_nested.h
File Facts
- System
- Linux kernel
- Corpus path
arch/arm64/include/asm/kvm_nested.h- Extension
.h- Size
- 9517 bytes
- Lines
- 413
- 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/kvm_emulate.hasm/kvm_pgtable.h
Detected Declarations
struct kvm_s2_transstruct s1_walk_infostruct s1_walk_contextstruct s1_walk_filterstruct s1_walk_infostruct s1_walk_resultenum trans_regimefunction vcpu_has_nvfunction tcr_el2_ps_to_tcr_el1_ipsfunction translate_tcr_el2_to_tcr_el1function translate_cptr_el2_to_cpacr_el1function translate_sctlr_el2_to_sctlr_el1function translate_ttbr0_el2_to_ttbr0_el1function kvm_s2_trans_outputfunction kvm_s2_trans_sizefunction kvm_s2_trans_esrfunction kvm_s2_trans_readablefunction kvm_s2_trans_writablefunction kvm_has_xnxfunction kvm_s2_trans_exec_el0function kvm_s2_trans_exec_el1function kvm_supported_tlbi_s1e1_opfunction kvm_supported_tlbi_s1e2_opfunction kvm_auth_eretaxfunction kvm_encode_nested_levelfunction decode_range_tlbifunction ps_to_output_size
Annotated Snippet
struct kvm_s2_trans {
phys_addr_t output;
unsigned long block_size;
bool writable;
bool readable;
int level;
u32 esr;
u64 desc;
};
static inline phys_addr_t kvm_s2_trans_output(struct kvm_s2_trans *trans)
{
return trans->output;
}
static inline unsigned long kvm_s2_trans_size(struct kvm_s2_trans *trans)
{
return trans->block_size;
}
static inline u32 kvm_s2_trans_esr(struct kvm_s2_trans *trans)
{
return trans->esr;
}
static inline bool kvm_s2_trans_readable(struct kvm_s2_trans *trans)
{
return trans->readable;
}
static inline bool kvm_s2_trans_writable(struct kvm_s2_trans *trans)
{
return trans->writable;
}
static inline bool kvm_has_xnx(struct kvm *kvm)
{
return cpus_have_final_cap(ARM64_HAS_XNX) &&
kvm_has_feat(kvm, ID_AA64MMFR1_EL1, XNX, IMP);
}
static inline bool kvm_s2_trans_exec_el0(struct kvm *kvm, struct kvm_s2_trans *trans)
{
u8 xn = FIELD_GET(KVM_PTE_LEAF_ATTR_HI_S2_XN, trans->desc);
if (!kvm_has_xnx(kvm))
xn &= 0b10;
switch (xn) {
case 0b00:
case 0b01:
return true;
default:
return false;
}
}
static inline bool kvm_s2_trans_exec_el1(struct kvm *kvm, struct kvm_s2_trans *trans)
{
u8 xn = FIELD_GET(KVM_PTE_LEAF_ATTR_HI_S2_XN, trans->desc);
if (!kvm_has_xnx(kvm))
xn &= 0b10;
switch (xn) {
case 0b00:
case 0b11:
return true;
default:
return false;
}
}
extern int kvm_walk_nested_s2(struct kvm_vcpu *vcpu, phys_addr_t gipa,
struct kvm_s2_trans *result);
extern int kvm_s2_handle_perm_fault(struct kvm_vcpu *vcpu,
struct kvm_s2_trans *trans);
extern int kvm_inject_s2_fault(struct kvm_vcpu *vcpu, u64 esr_el2);
extern void kvm_nested_s2_wp(struct kvm *kvm);
extern void kvm_nested_s2_unmap(struct kvm *kvm, bool may_block);
extern void kvm_nested_s2_flush(struct kvm *kvm);
unsigned long compute_tlb_inval_range(struct kvm_s2_mmu *mmu, u64 val);
static inline bool kvm_supported_tlbi_s1e1_op(struct kvm_vcpu *vpcu, u32 instr)
{
struct kvm *kvm = vpcu->kvm;
u8 CRm = sys_reg_CRm(instr);
if (!(sys_reg_Op0(instr) == TLBI_Op0 &&
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/kvm_host.h`, `asm/kvm_emulate.h`, `asm/kvm_pgtable.h`.
- Detected declarations: `struct kvm_s2_trans`, `struct s1_walk_info`, `struct s1_walk_context`, `struct s1_walk_filter`, `struct s1_walk_info`, `struct s1_walk_result`, `enum trans_regime`, `function vcpu_has_nv`, `function tcr_el2_ps_to_tcr_el1_ips`, `function translate_tcr_el2_to_tcr_el1`.
- 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.