arch/arm64/include/asm/kvm_host.h
Source file repositories/reference/linux-study-clean/arch/arm64/include/asm/kvm_host.h
File Facts
- System
- Linux kernel
- Corpus path
arch/arm64/include/asm/kvm_host.h- Extension
.h- Size
- 51640 bytes
- Lines
- 1715
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/arm-smccc.hlinux/bitmap.hlinux/types.hlinux/jump_label.hlinux/kvm_types.hlinux/maple_tree.hlinux/percpu.hlinux/psci.hasm/arch_gicv3.hasm/barrier.hasm/cpufeature.hasm/cputype.hasm/daifflags.hasm/fpsimd.hasm/kvm.hasm/kvm_asm.hasm/vncr_mapping.hkvm/arm_vgic.hkvm/arm_arch_timer.hkvm/arm_pmu.h
Detected Declarations
struct kvm_hyp_memcachestruct kvm_vmidstruct kvm_s2_mmustruct kvm_arch_memory_slotstruct kvm_smccc_featuresstruct kvm_protected_vmstruct kvm_mpidr_datastruct kvm_sysreg_masksstruct kvm_archstruct kvm_vcpu_fault_infostruct resxstruct kvm_sysreg_masksstruct fgt_masksstruct kvm_cpu_contextstruct kvm_host_datastruct kvm_host_psci_configstruct vcpu_reset_statestruct vncr_tlbstruct kvm_vcpu_archstruct kvm_vm_statstruct kvm_vcpu_statstruct sys_reg_descenum kvm_modeenum fgt_group_idenum vcpu_sysregfunction kvm_get_modefunction push_hyp_memcachefunction __topup_hyp_memcachefunction __free_hyp_memcachefunction kvm_mpidr_indexfunction __kvm_get_sysreg_resxfunction __kvm_set_sysreg_resxfunction test_bitfunction isbfunction Interruptfunction kvm_arm_pvtime_vcpu_initfunction kvm_arm_is_pvtime_enabledfunction guest_owns_fp_regsfunction host_owns_fp_regsfunction kvm_init_host_cpu_contextfunction kvm_system_needs_idmapped_vectorsfunction kvm_pmu_counter_deferredfunction kvm_set_pmu_eventsfunction kvm_enable_trbefunction test_bitfunction kvm_hyp_reservefunction kvm_has_featfunction __fgt_reg_to_group_id
Annotated Snippet
struct kvm_hyp_memcache {
phys_addr_t head;
unsigned long nr_pages;
struct pkvm_mapping *mapping; /* only used from EL1 */
#define HYP_MEMCACHE_ACCOUNT_STAGE2 BIT(1)
unsigned long flags;
};
static inline void push_hyp_memcache(struct kvm_hyp_memcache *mc,
phys_addr_t *p,
phys_addr_t (*to_pa)(void *virt))
{
*p = mc->head;
mc->head = to_pa(p);
mc->nr_pages++;
}
static inline void *pop_hyp_memcache(struct kvm_hyp_memcache *mc,
void *(*to_va)(phys_addr_t phys))
{
phys_addr_t *p = to_va(mc->head & PAGE_MASK);
if (!mc->nr_pages)
return NULL;
mc->head = *p;
mc->nr_pages--;
return p;
}
static inline int __topup_hyp_memcache(struct kvm_hyp_memcache *mc,
unsigned long min_pages,
void *(*alloc_fn)(void *arg),
phys_addr_t (*to_pa)(void *virt),
void *arg)
{
while (mc->nr_pages < min_pages) {
phys_addr_t *p = alloc_fn(arg);
if (!p)
return -ENOMEM;
push_hyp_memcache(mc, p, to_pa);
}
return 0;
}
static inline void __free_hyp_memcache(struct kvm_hyp_memcache *mc,
void (*free_fn)(void *virt, void *arg),
void *(*to_va)(phys_addr_t phys),
void *arg)
{
while (mc->nr_pages)
free_fn(pop_hyp_memcache(mc, to_va), arg);
}
void free_hyp_memcache(struct kvm_hyp_memcache *mc);
int topup_hyp_memcache(struct kvm_hyp_memcache *mc, unsigned long min_pages);
struct kvm_vmid {
atomic64_t id;
};
struct kvm_s2_mmu {
struct kvm_vmid vmid;
/*
* stage2 entry level table
*
* Two kvm_s2_mmu structures in the same VM can point to the same
* pgd here. This happens when running a guest using a
* translation regime that isn't affected by its own stage-2
* translation, such as a non-VHE hypervisor running at vEL2, or
* for vEL1/EL0 with vHCR_EL2.VM == 0. In that case, we use the
* canonical stage-2 page tables.
*/
phys_addr_t pgd_phys;
struct kvm_pgtable *pgt;
/*
* VTCR value used on the host. For a non-NV guest (or a NV
* guest that runs in a context where its own S2 doesn't
* apply), its T0SZ value reflects that of the IPA size.
*
* For a shadow S2 MMU, T0SZ reflects the PARange exposed to
* the guest.
*/
u64 vtcr;
Annotation
- Immediate include surface: `linux/arm-smccc.h`, `linux/bitmap.h`, `linux/types.h`, `linux/jump_label.h`, `linux/kvm_types.h`, `linux/maple_tree.h`, `linux/percpu.h`, `linux/psci.h`.
- Detected declarations: `struct kvm_hyp_memcache`, `struct kvm_vmid`, `struct kvm_s2_mmu`, `struct kvm_arch_memory_slot`, `struct kvm_smccc_features`, `struct kvm_protected_vm`, `struct kvm_mpidr_data`, `struct kvm_sysreg_masks`, `struct kvm_arch`, `struct kvm_vcpu_fault_info`.
- Atlas domain: Architecture Layer / arch/arm64.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.