arch/arm/xen/enlighten.c
Source file repositories/reference/linux-study-clean/arch/arm/xen/enlighten.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/xen/enlighten.c- Extension
.c- Size
- 15004 bytes
- Lines
- 589
- Domain
- Architecture Layer
- Bucket
- arch/arm
- 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 IRQ or DMA behavior; this matters for the representative real-device path.
- 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
xen/xen.hxen/events.hxen/grant_table.hxen/hvm.hxen/interface/vcpu.hxen/interface/xen.hxen/interface/memory.hxen/interface/hvm/params.hxen/features.hxen/platform_pci.hxen/xenbus.hxen/page.hxen/interface/sched.hxen/xen-ops.hasm/xen/hypervisor.hasm/xen/hypercall.hasm/system_misc.hasm/efi.hlinux/interrupt.hlinux/irqreturn.hlinux/module.hlinux/of.hlinux/of_fdt.hlinux/of_irq.hlinux/of_address.hlinux/cpuidle.hlinux/cpufreq.hlinux/cpu.hlinux/console.hlinux/pvclock_gtod.hlinux/reboot.hlinux/time64.h
Detected Declarations
function xen_unmap_domain_gfn_rangefunction xen_read_wallclockfunction xen_pvclock_gtod_notifyfunction xen_starting_cpufunction xen_dying_cpufunction xen_rebootfunction xen_restartfunction xen_power_offfunction xen_arm_callbackfunction fdt_find_hyper_nodefunction functionsfunction xen_early_initfunction xen_acpi_guest_initfunction arch_xen_unpopulated_initfunction xen_dt_guest_initfunction xen_guest_initfunction xen_starting_runstate_cpufunction xen_late_initfunction xen_arch_pre_suspendexport xen_start_infoexport xen_domain_typeexport xen_start_flagsexport xen_unmap_domain_gfn_rangeexport HYPERVISOR_event_channel_opexport HYPERVISOR_grant_table_opexport HYPERVISOR_xen_versionexport HYPERVISOR_console_ioexport HYPERVISOR_sched_opexport HYPERVISOR_hvm_opexport HYPERVISOR_memory_opexport HYPERVISOR_physdev_opexport HYPERVISOR_vcpu_opexport HYPERVISOR_platform_op_rawexport HYPERVISOR_multicallexport HYPERVISOR_vm_assistexport HYPERVISOR_dm_opexport privcmd_call
Annotated Snippet
if (regs[i - 1].end + 1 > regs[i].start) {
rc = -EINVAL;
goto err;
}
/* There is no hole between regions */
if (regs[i - 1].end + 1 == regs[i].start)
continue;
start = regs[i - 1].end + 1;
end = regs[i].start - 1;
tmp_res = kzalloc_obj(*tmp_res);
if (!tmp_res) {
rc = -ENOMEM;
goto err;
}
tmp_res->name = "Unavailable space";
tmp_res->start = start;
tmp_res->end = end;
rc = insert_resource(&xen_resource, tmp_res);
if (rc) {
pr_err("Cannot insert resource %pR (%d)\n", tmp_res, rc);
kfree(tmp_res);
goto err;
}
}
*res = &xen_resource;
err:
of_node_put(np);
kfree(regs);
return rc;
}
#endif
static void __init xen_dt_guest_init(void)
{
struct device_node *xen_node;
struct resource res;
xen_node = of_find_compatible_node(NULL, NULL, "xen,xen");
if (!xen_node) {
pr_err("Xen support was detected before, but it has disappeared\n");
return;
}
xen_events_irq = irq_of_parse_and_map(xen_node, 0);
if (of_address_to_resource(xen_node, GRANT_TABLE_INDEX, &res)) {
pr_err("Xen grant table region is not found\n");
of_node_put(xen_node);
return;
}
of_node_put(xen_node);
xen_grant_frames = res.start;
}
static int __init xen_guest_init(void)
{
struct xen_add_to_physmap xatp;
struct shared_info *shared_info_page = NULL;
int rc, cpu;
if (!xen_domain())
return 0;
if (IS_ENABLED(CONFIG_XEN_VIRTIO))
virtio_set_mem_acc_cb(xen_virtio_restricted_mem_acc);
if (!acpi_disabled)
xen_acpi_guest_init();
else
xen_dt_guest_init();
if (!xen_events_irq) {
pr_err("Xen event channel interrupt not found\n");
return -ENODEV;
}
/*
* The fdt parsing codes have set EFI_RUNTIME_SERVICES if Xen EFI
* parameters are found. Force enable runtime services.
*/
if (efi_enabled(EFI_RUNTIME_SERVICES))
xen_efi_runtime_setup();
Annotation
- Immediate include surface: `xen/xen.h`, `xen/events.h`, `xen/grant_table.h`, `xen/hvm.h`, `xen/interface/vcpu.h`, `xen/interface/xen.h`, `xen/interface/memory.h`, `xen/interface/hvm/params.h`.
- Detected declarations: `function xen_unmap_domain_gfn_range`, `function xen_read_wallclock`, `function xen_pvclock_gtod_notify`, `function xen_starting_cpu`, `function xen_dying_cpu`, `function xen_reboot`, `function xen_restart`, `function xen_power_off`, `function xen_arm_callback`, `function fdt_find_hyper_node`.
- Atlas domain: Architecture Layer / arch/arm.
- Implementation status: integration implementation candidate.
- 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.