arch/powerpc/include/asm/kvm_book3s.h
Source file repositories/reference/linux-study-clean/arch/powerpc/include/asm/kvm_book3s.h
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/include/asm/kvm_book3s.h- Extension
.h- Size
- 23730 bytes
- Lines
- 700
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- 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/types.hlinux/kvm_host.hasm/kvm_book3s_asm.hasm/guest-state-buffer.hasm/kvm_book3s_32.hasm/kvm_book3s_64.h
Detected Declarations
struct kvmppc_batstruct kvmppc_sid_mapstruct hpte_cachestruct kvmppc_vcorestruct kvmppc_vcpu_book3sfunction kvmppc_save_tm_prfunction kvmhv_is_nestedv2function kvmhv_is_nestedv1function kvmhv_is_nestedv2function kvmhv_is_nestedv1function kvmhv_nestedv2_reload_ptregsfunction kvmhv_nestedv2_mark_dirty_ptregsfunction kvmhv_nestedv2_mark_dirtyfunction kvmhv_nestedv2_cached_reloadfunction kvmppc_set_gprfunction kvmppc_get_gprfunction kvmppc_set_crfunction kvmppc_get_crfunction kvmppc_set_xerfunction kvmppc_get_xerfunction kvmppc_set_ctrfunction kvmppc_get_ctrfunction kvmppc_set_lrfunction kvmppc_get_lrfunction kvmppc_set_pcfunction kvmppc_get_pcfunction kvmppc_need_byteswapfunction kvmppc_get_fault_darfunction kvmppc_get_fprfunction kvmppc_set_fprfunction kvmppc_get_fpscrfunction kvmppc_set_fpscrfunction kvmppc_get_vsx_fprfunction kvmppc_set_vsx_fprfunction kvmppc_get_vsx_vrfunction kvmppc_set_vsx_vrfunction kvmppc_get_vscrfunction kvmppc_set_vscrfunction KVMPPC_BOOK3S_VCORE_ACCESSORfunction kvmppc_get_dec_expiresfunction kvmppc_set_dec_expiresfunction kvmppc_dec_expires_host_tbfunction is_kvmppc_resume_guestfunction kvmppc_supports_magic_pagefunction KVM_MAX_VCPUS
Annotated Snippet
struct kvmppc_bat {
u64 raw;
u32 bepi;
u32 bepi_mask;
u32 brpn;
u8 wimg;
u8 pp;
bool vs : 1;
bool vp : 1;
};
struct kvmppc_sid_map {
u64 guest_vsid;
u64 guest_esid;
u64 host_vsid;
bool valid : 1;
};
#define SID_MAP_BITS 9
#define SID_MAP_NUM (1 << SID_MAP_BITS)
#define SID_MAP_MASK (SID_MAP_NUM - 1)
#ifdef CONFIG_PPC_BOOK3S_64
#define SID_CONTEXTS 1
#else
#define SID_CONTEXTS 128
#define VSID_POOL_SIZE (SID_CONTEXTS * 16)
#endif
struct hpte_cache {
struct hlist_node list_pte;
struct hlist_node list_pte_long;
struct hlist_node list_vpte;
struct hlist_node list_vpte_long;
#ifdef CONFIG_PPC_BOOK3S_64
struct hlist_node list_vpte_64k;
#endif
struct rcu_head rcu_head;
u64 host_vpn;
u64 pfn;
ulong slot;
struct kvmppc_pte pte;
int pagesize;
};
/*
* Struct for a virtual core.
* Note: entry_exit_map combines a bitmap of threads that have entered
* in the bottom 8 bits and a bitmap of threads that have exited in the
* next 8 bits. This is so that we can atomically set the entry bit
* iff the exit map is 0 without taking a lock.
*/
struct kvmppc_vcore {
int n_runnable;
int num_threads;
int entry_exit_map;
int napping_threads;
int first_vcpuid;
u16 pcpu;
u16 last_cpu;
u8 vcore_state;
u8 in_guest;
struct kvm_vcpu *runnable_threads[MAX_SMT_THREADS];
struct list_head preempt_list;
spinlock_t lock;
struct rcuwait wait;
spinlock_t stoltb_lock; /* protects stolen_tb and preempt_tb */
u64 stolen_tb;
u64 preempt_tb;
struct kvm_vcpu *runner;
struct kvm *kvm;
u64 tb_offset; /* guest timebase - host timebase */
u64 tb_offset_applied; /* timebase offset currently in force */
ulong lpcr;
u32 arch_compat;
ulong pcr;
ulong dpdes; /* doorbell state (POWER8) */
ulong vtb; /* virtual timebase */
ulong conferring_threads;
unsigned int halt_poll_ns;
atomic_t online_count;
};
struct kvmppc_vcpu_book3s {
struct kvmppc_sid_map sid_map[SID_MAP_NUM];
struct {
u64 esid;
u64 vsid;
} slb_shadow[64];
u8 slb_shadow_max;
Annotation
- Immediate include surface: `linux/types.h`, `linux/kvm_host.h`, `asm/kvm_book3s_asm.h`, `asm/guest-state-buffer.h`, `asm/kvm_book3s_32.h`, `asm/kvm_book3s_64.h`.
- Detected declarations: `struct kvmppc_bat`, `struct kvmppc_sid_map`, `struct hpte_cache`, `struct kvmppc_vcore`, `struct kvmppc_vcpu_book3s`, `function kvmppc_save_tm_pr`, `function kvmhv_is_nestedv2`, `function kvmhv_is_nestedv1`, `function kvmhv_is_nestedv2`, `function kvmhv_is_nestedv1`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.