arch/loongarch/include/asm/kvm_host.h
Source file repositories/reference/linux-study-clean/arch/loongarch/include/asm/kvm_host.h
File Facts
- System
- Linux kernel
- Corpus path
arch/loongarch/include/asm/kvm_host.h- Extension
.h- Size
- 9932 bytes
- Lines
- 369
- Domain
- Architecture Layer
- Bucket
- arch/loongarch
- 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/cpumask.hlinux/hrtimer.hlinux/interrupt.hlinux/kvm.hlinux/kvm_types.hlinux/mutex.hlinux/perf_event.hlinux/spinlock.hlinux/threads.hlinux/types.hasm/inst.hasm/kvm_mmu.hasm/kvm_ipi.hasm/kvm_dmsintc.hasm/kvm_eiointc.hasm/kvm_pch_pic.hasm/loongarch.h
Detected Declarations
struct kvm_vm_statstruct kvm_vcpu_statstruct kvm_arch_memory_slotstruct kvm_contextstruct kvm_world_switchstruct kvm_phyid_infostruct kvm_phyid_mapstruct kvm_archstruct loongarch_csrsstruct kvm_vcpu_archenum emulation_resultfunction readl_sw_gcsrfunction writel_sw_gcsrfunction kvm_guest_has_msgintfunction kvm_guest_has_fpufunction kvm_guest_has_lsxfunction kvm_guest_has_lasxfunction kvm_guest_has_lbtfunction kvm_guest_has_pmufunction kvm_get_pmu_numfunction kvm_vm_supportfunction update_pcfunction kvm_is_ifetch_faultfunction kvm_arch_hardware_unsetup
Annotated Snippet
struct kvm_vm_stat {
struct kvm_vm_stat_generic generic;
u64 pages;
u64 hugepages;
};
struct kvm_vcpu_stat {
struct kvm_vcpu_stat_generic generic;
u64 int_exits;
u64 idle_exits;
u64 cpucfg_exits;
u64 signal_exits;
u64 hypercall_exits;
u64 ipi_read_exits;
u64 ipi_write_exits;
u64 eiointc_read_exits;
u64 eiointc_write_exits;
u64 pch_pic_read_exits;
u64 pch_pic_write_exits;
};
#define KVM_MEM_HUGEPAGE_CAPABLE (1UL << 0)
#define KVM_MEM_HUGEPAGE_INCAPABLE (1UL << 1)
struct kvm_arch_memory_slot {
unsigned long flags;
};
#define HOST_MAX_PMNUM 16
struct kvm_context {
unsigned long vpid_cache;
struct kvm_vcpu *last_vcpu;
/* Host PMU CSR */
u64 perf_ctrl[HOST_MAX_PMNUM];
u64 perf_cntr[HOST_MAX_PMNUM];
};
struct kvm_world_switch {
int (*exc_entry)(void);
int (*enter_guest)(struct kvm_run *run, struct kvm_vcpu *vcpu);
};
#define MAX_PGTABLE_LEVELS 4
/*
* Physical CPUID is used for interrupt routing, there are different
* definitions about physical cpuid on different hardwares.
*
* For LOONGARCH_CSR_CPUID register, max CPUID size if 512
* For IPI hardware, max destination CPUID size 1024
* For eiointc interrupt controller, max destination CPUID size is 256
* For msgint interrupt controller, max supported CPUID size is 65536
*
* Currently max CPUID is defined as 256 for KVM hypervisor, in future
* it will be expanded to 4096, including 16 packages at most. And every
* package supports at most 256 vcpus
*/
#define KVM_MAX_PHYID 256
struct kvm_phyid_info {
struct kvm_vcpu *vcpu;
bool enabled;
};
struct kvm_phyid_map {
int max_phyid;
struct kvm_phyid_info phys_map[KVM_MAX_PHYID];
};
struct kvm_arch {
/* Guest physical mm */
kvm_pte_t *pgd;
unsigned long gpa_size;
unsigned long invalid_ptes[MAX_PGTABLE_LEVELS];
unsigned int pte_shifts[MAX_PGTABLE_LEVELS];
unsigned int root_level;
spinlock_t phyid_map_lock;
struct kvm_phyid_map *phyid_map;
/* Enabled PV features */
unsigned long pv_features;
/* Supported KVM features */
unsigned long kvm_features;
s64 time_offset;
struct kvm_context __percpu *vmcs;
struct loongarch_ipi *ipi;
struct loongarch_dmsintc *dmsintc;
struct loongarch_eiointc *eiointc;
struct loongarch_pch_pic *pch_pic;
};
Annotation
- Immediate include surface: `linux/cpumask.h`, `linux/hrtimer.h`, `linux/interrupt.h`, `linux/kvm.h`, `linux/kvm_types.h`, `linux/mutex.h`, `linux/perf_event.h`, `linux/spinlock.h`.
- Detected declarations: `struct kvm_vm_stat`, `struct kvm_vcpu_stat`, `struct kvm_arch_memory_slot`, `struct kvm_context`, `struct kvm_world_switch`, `struct kvm_phyid_info`, `struct kvm_phyid_map`, `struct kvm_arch`, `struct loongarch_csrs`, `struct kvm_vcpu_arch`.
- Atlas domain: Architecture Layer / arch/loongarch.
- 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.