arch/x86/xen/enlighten.c
Source file repositories/reference/linux-study-clean/arch/x86/xen/enlighten.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/xen/enlighten.c- Extension
.c- Size
- 12689 bytes
- Lines
- 482
- 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.
- 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/console.hlinux/cpu.hlinux/instrumentation.hlinux/kexec.hlinux/memblock.hlinux/slab.hlinux/panic_notifier.hxen/xen.hxen/features.hxen/interface/sched.hxen/interface/version.hxen/page.hasm/xen/hypercall.hasm/xen/hypervisor.hasm/cpu.hasm/e820/api.hasm/setup.hxen-ops.h
Detected Declarations
function xen_get_vendorfunction xen_hypercall_setfuncfunction early_cpu_initfunction xen_cpu_up_onlinefunction xen_cpuhp_setupfunction xen_vcpu_setup_restorefunction xen_vcpu_restorefunction for_each_possible_cpufunction xen_vcpu_info_resetfunction xen_vcpu_setupfunction bootupfunction xen_bannerfunction xen_running_on_version_or_laterfunction xen_add_preferred_consolesfunction xen_rebootfunction xen_emergency_restartfunction xen_panic_eventfunction parse_xen_legacy_crashfunction xen_panic_handler_initfunction xen_pin_vcpufunction xen_arch_register_cpufunction xen_arch_unregister_cpufunction xen_add_extra_memfunction arch_xen_unpopulated_initexport machine_to_phys_mappingexport machine_to_phys_nrexport xen_start_infoexport xen_have_vector_callbackexport xen_domain_typeexport xen_start_flagsexport xen_arch_register_cpuexport xen_arch_unregister_cpu
Annotated Snippet
if (xen_extra_mem[i].n_pfns == 0) {
xen_extra_mem[i].start_pfn = start_pfn;
xen_extra_mem[i].n_pfns = n_pfns;
break;
}
/* Append to existing region. */
if (xen_extra_mem[i].start_pfn + xen_extra_mem[i].n_pfns ==
start_pfn) {
xen_extra_mem[i].n_pfns += n_pfns;
break;
}
}
if (i == XEN_EXTRA_MEM_MAX_REGIONS)
printk(KERN_WARNING "Warning: not enough extra memory regions\n");
memblock_reserve(PFN_PHYS(start_pfn), PFN_PHYS(n_pfns));
}
#ifdef CONFIG_XEN_UNPOPULATED_ALLOC
int __init arch_xen_unpopulated_init(struct resource **res)
{
unsigned int i;
if (!xen_domain())
return -ENODEV;
/* Must be set strictly before calling xen_free_unpopulated_pages(). */
*res = &iomem_resource;
/*
* Initialize with pages from the extra memory regions (see
* arch/x86/xen/setup.c).
*/
for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
unsigned int j;
for (j = 0; j < xen_extra_mem[i].n_pfns; j++) {
struct page *pg =
pfn_to_page(xen_extra_mem[i].start_pfn + j);
xen_free_unpopulated_pages(1, &pg);
}
/*
* Account for the region being in the physmap but unpopulated.
* The value in xen_released_pages is used by the balloon
* driver to know how much of the physmap is unpopulated and
* set an accurate initial memory target.
*/
xen_unpopulated_pages += xen_extra_mem[i].n_pfns;
/* Zero so region is not also added to the balloon driver. */
xen_extra_mem[i].n_pfns = 0;
}
return 0;
}
#endif
Annotation
- Immediate include surface: `linux/console.h`, `linux/cpu.h`, `linux/instrumentation.h`, `linux/kexec.h`, `linux/memblock.h`, `linux/slab.h`, `linux/panic_notifier.h`, `xen/xen.h`.
- Detected declarations: `function xen_get_vendor`, `function xen_hypercall_setfunc`, `function early_cpu_init`, `function xen_cpu_up_online`, `function xen_cpuhp_setup`, `function xen_vcpu_setup_restore`, `function xen_vcpu_restore`, `function for_each_possible_cpu`, `function xen_vcpu_info_reset`, `function xen_vcpu_setup`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: integration 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.