arch/x86/xen/enlighten_pv.c
Source file repositories/reference/linux-study-clean/arch/x86/xen/enlighten_pv.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/xen/enlighten_pv.c- Extension
.c- Size
- 40161 bytes
- Lines
- 1615
- Domain
- Architecture Layer
- Bucket
- arch/x86
- 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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpu.hlinux/kernel.hlinux/init.hlinux/smp.hlinux/preempt.hlinux/hardirq.hlinux/percpu.hlinux/delay.hlinux/start_kernel.hlinux/sched.hlinux/kprobes.hlinux/kstrtox.hlinux/memblock.hlinux/export.hlinux/mm.hlinux/page-flags.hlinux/pci.hlinux/gfp.hlinux/edd.hlinux/reboot.hlinux/virtio_anchor.hlinux/stackprotector.hxen/xen.hxen/events.hxen/interface/xen.hxen/interface/version.hxen/interface/physdev.hxen/interface/vcpu.hxen/interface/memory.hxen/interface/nmi.hxen/interface/xen-mca.hxen/features.h
Detected Declarations
struct tls_descsstruct trap_array_entryfunction get_and_clear_inhcallfunction restore_inhcallfunction get_and_clear_inhcallfunction restore_inhcallfunction xen_is_cpu_lazy_modefunction parse_xen_msr_safefunction xen_set_mtrr_datafunction xen_pv_init_platformfunction xen_pv_guest_late_initfunction xen_cpuidfunction xen_check_mwaitfunction xen_check_xsavefunction xen_init_capabilitiesfunction xen_set_debugregfunction xen_get_debugregfunction xen_start_context_switchfunction xen_end_context_switchfunction xen_store_trfunction mappingfunction xen_alloc_ldtfunction xen_free_ldtfunction xen_set_ldtfunction xen_load_gdtfunction xen_load_gdt_bootfunction desc_equalfunction load_TLS_descriptorfunction xen_load_tlsfunction xen_load_gs_indexfunction xen_write_ldt_entryfunction __xen_pv_evtchn_do_upcallfunction xen_pv_evtchn_do_upcallfunction get_trap_addrfunction cvt_gate_to_trapfunction xen_write_idt_entryfunction xen_convert_trap_infofunction xen_copy_trap_infofunction xen_load_idtfunction xen_write_gdt_entryfunction xen_write_gdt_entry_bootfunction xen_load_sp0function xen_invalidate_io_bitmapfunction xen_update_io_bitmapfunction xen_read_cr0function xen_write_cr0function xen_write_cr4function xen_do_read_msr
Annotated Snippet
#include <linux/start_kernel.h>
#include <linux/sched.h>
#include <linux/kprobes.h>
#include <linux/kstrtox.h>
#include <linux/memblock.h>
#include <linux/export.h>
#include <linux/mm.h>
#include <linux/page-flags.h>
#include <linux/pci.h>
#include <linux/gfp.h>
#include <linux/edd.h>
#include <linux/reboot.h>
#include <linux/virtio_anchor.h>
#include <linux/stackprotector.h>
#include <xen/xen.h>
#include <xen/events.h>
#include <xen/interface/xen.h>
#include <xen/interface/version.h>
#include <xen/interface/physdev.h>
#include <xen/interface/vcpu.h>
#include <xen/interface/memory.h>
#include <xen/interface/nmi.h>
#include <xen/interface/xen-mca.h>
#include <xen/features.h>
#include <xen/page.h>
#include <xen/hvc-console.h>
#include <xen/acpi.h>
#include <asm/cpuid/api.h>
#include <asm/paravirt.h>
#include <asm/apic.h>
#include <asm/page.h>
#include <asm/xen/pci.h>
#include <asm/xen/hypercall.h>
#include <asm/xen/hypervisor.h>
#include <asm/xen/cpuid.h>
#include <asm/fixmap.h>
#include <asm/processor.h>
#include <asm/proto.h>
#include <asm/msr-index.h>
#include <asm/msr.h>
#include <asm/traps.h>
#include <asm/setup.h>
#include <asm/desc.h>
#include <asm/pgalloc.h>
#include <asm/tlbflush.h>
#include <asm/reboot.h>
#include <asm/hypervisor.h>
#include <asm/mach_traps.h>
#include <asm/mtrr.h>
#include <asm/mwait.h>
#include <asm/pci_x86.h>
#include <asm/cpu.h>
#include <asm/irq_stack.h>
#ifdef CONFIG_X86_IOPL_IOPERM
#include <asm/io_bitmap.h>
#endif
#ifdef CONFIG_ACPI
#include <linux/acpi.h>
#include <asm/acpi.h>
#include <acpi/proc_cap_intel.h>
#include <acpi/processor.h>
#include <xen/interface/platform.h>
#endif
#include "xen-ops.h"
#include "../kernel/cpu/cpu.h" /* get_cpu_cap() */
void *xen_initial_gdt;
static int xen_cpu_up_prepare_pv(unsigned int cpu);
static int xen_cpu_dead_pv(unsigned int cpu);
#ifndef CONFIG_PREEMPTION
/*
* Some hypercalls issued by the toolstack can take many 10s of
* seconds. Allow tasks running hypercalls via the privcmd driver to
* be voluntarily preempted even if full kernel preemption is
* disabled.
*
* Such preemptible hypercalls are bracketed by
* xen_preemptible_hcall_begin() and xen_preemptible_hcall_end()
* calls.
*/
DEFINE_PER_CPU(bool, xen_in_preemptible_hcall);
EXPORT_PER_CPU_SYMBOL_GPL(xen_in_preemptible_hcall);
Annotation
- Immediate include surface: `linux/cpu.h`, `linux/kernel.h`, `linux/init.h`, `linux/smp.h`, `linux/preempt.h`, `linux/hardirq.h`, `linux/percpu.h`, `linux/delay.h`.
- Detected declarations: `struct tls_descs`, `struct trap_array_entry`, `function get_and_clear_inhcall`, `function restore_inhcall`, `function get_and_clear_inhcall`, `function restore_inhcall`, `function xen_is_cpu_lazy_mode`, `function parse_xen_msr_safe`, `function xen_set_mtrr_data`, `function xen_pv_init_platform`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source 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.
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.