arch/x86/include/asm/kvm_host.h
Source file repositories/reference/linux-study-clean/arch/x86/include/asm/kvm_host.h
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/include/asm/kvm_host.h- Extension
.h- Size
- 80329 bytes
- Lines
- 2574
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/mm.hlinux/mmu_notifier.hlinux/tracepoint.hlinux/cpumask.hlinux/irq_work.hlinux/irq.hlinux/workqueue.hlinux/kvm.hlinux/kvm_para.hlinux/kvm_types.hlinux/perf_event.hlinux/pvclock_gtod.hlinux/clocksource.hlinux/irqbypass.hlinux/kfifo.hlinux/sched/vhost_task.hlinux/call_once.hlinux/atomic.hasm/apic.hasm/pvclock-abi.hasm/debugreg.hasm/desc.hasm/mtrr.hasm/msr-index.hasm/msr.hasm/asm.hasm/irq_remapping.hasm/kvm_page_track.hasm/kvm_vcpu_regs.hasm/virt.hhyperv/hvhdk.h
Detected Declarations
struct x86_emulate_ctxtstruct x86_exceptionstruct kvm_kernel_irqfdstruct kvm_kernel_irq_routing_entrystruct kvm_rmap_headstruct kvm_pio_requeststruct rsvd_bits_validatestruct kvm_mmu_root_infostruct kvm_mmu_pagestruct kvm_page_faultstruct kvm_mmustruct kvm_pmcstruct kvm_pmustruct kvm_pmu_opsstruct kvm_mtrrstruct kvm_vcpu_hv_stimerstruct kvm_vcpu_hv_synicstruct kvm_vcpu_hv_tlb_flush_fifostruct kvm_vcpu_hvstruct kvm_hypervisor_cpuidstruct kvm_vcpu_xenstruct kvm_queued_exceptionstruct kvm_vcpu_archstruct kvm_queued_interruptstruct kvm_lpage_infostruct kvm_arch_memory_slotstruct kvm_apic_mapstruct kvm_hv_syndbgstruct kvm_hvstruct msr_bitmap_rangestruct kvm_xenstruct kvm_x86_msr_filterstruct kvm_x86_pmu_event_filterstruct kvm_possible_nx_huge_pagesstruct kvm_archstruct kvm_vm_statstruct kvm_vcpu_statstruct x86_instruction_infostruct msr_datastruct kvm_lapic_irqstruct kvm_x86_opsstruct kvm_x86_nested_opsstruct kvm_x86_init_opsstruct kvm_arch_async_pfenum kvm_regenum exit_fastpath_completionenum x86_interceptenum x86_intercept_stage
Annotated Snippet
struct kvm_rmap_head {
atomic_long_t val;
};
struct kvm_pio_request {
unsigned long count;
int in;
int port;
int size;
};
#define PT64_ROOT_MAX_LEVEL 5
struct rsvd_bits_validate {
u64 rsvd_bits_mask[2][PT64_ROOT_MAX_LEVEL];
u64 bad_mt_xwr;
};
struct kvm_mmu_root_info {
gpa_t pgd;
hpa_t hpa;
};
#define KVM_MMU_ROOT_INFO_INVALID \
((struct kvm_mmu_root_info) { .pgd = INVALID_PAGE, .hpa = INVALID_PAGE })
#define KVM_MMU_NUM_PREV_ROOTS 3
#define KVM_MMU_ROOT_CURRENT BIT(0)
#define KVM_MMU_ROOT_PREVIOUS(i) BIT(1+i)
#define KVM_MMU_ROOTS_ALL (BIT(1 + KVM_MMU_NUM_PREV_ROOTS) - 1)
#define KVM_HAVE_MMU_RWLOCK
struct kvm_mmu_page;
struct kvm_page_fault;
/*
* x86 supports 4 paging modes (5-level 64-bit, 4-level 64-bit, 3-level 32-bit,
* and 2-level 32-bit). The kvm_mmu structure abstracts the details of the
* current mmu mode.
*/
struct kvm_mmu {
unsigned long (*get_guest_pgd)(struct kvm_vcpu *vcpu);
u64 (*get_pdptr)(struct kvm_vcpu *vcpu, int index);
int (*page_fault)(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault);
void (*inject_page_fault)(struct kvm_vcpu *vcpu,
struct x86_exception *fault,
bool from_hardware);
gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
gpa_t gva_or_gpa, u64 access,
struct x86_exception *exception);
int (*sync_spte)(struct kvm_vcpu *vcpu,
struct kvm_mmu_page *sp, int i);
struct kvm_mmu_root_info root;
hpa_t mirror_root_hpa;
union kvm_cpu_role cpu_role;
union kvm_mmu_page_role root_role;
/*
* The pkru_mask indicates if protection key checks are needed. It
* consists of 16 domains indexed by page fault error code bits [4:1],
* with PFEC.RSVD replaced by ACC_USER_MASK from the page tables.
* Each domain has 2 bits which are ANDed with AD and WD from PKRU.
*/
u32 pkru_mask;
struct kvm_mmu_root_info prev_roots[KVM_MMU_NUM_PREV_ROOTS];
/*
* Bitmap; bit set = permission fault
* Byte index: page fault error code [4:1]
* Bit index: pte permissions in ACC_* format
*/
u16 permissions[16];
u64 *pae_root;
u64 *pml4_root;
u64 *pml5_root;
/*
* check zero bits on shadow page table entries, these
* bits include not only hardware reserved bits but also
* the bits spte never used.
*/
struct rsvd_bits_validate shadow_zero_check;
struct rsvd_bits_validate guest_rsvd_check;
};
enum pmc_type {
Annotation
- Immediate include surface: `linux/types.h`, `linux/mm.h`, `linux/mmu_notifier.h`, `linux/tracepoint.h`, `linux/cpumask.h`, `linux/irq_work.h`, `linux/irq.h`, `linux/workqueue.h`.
- Detected declarations: `struct x86_emulate_ctxt`, `struct x86_exception`, `struct kvm_kernel_irqfd`, `struct kvm_kernel_irq_routing_entry`, `struct kvm_rmap_head`, `struct kvm_pio_request`, `struct rsvd_bits_validate`, `struct kvm_mmu_root_info`, `struct kvm_mmu_page`, `struct kvm_page_fault`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.