arch/x86/xen/setup.c
Source file repositories/reference/linux-study-clean/arch/x86/xen/setup.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/xen/setup.c- Extension
.c- Size
- 29012 bytes
- Lines
- 1067
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/iscsi_ibft.hlinux/sched.hlinux/kstrtox.hlinux/mm.hlinux/pm.hlinux/memblock.hlinux/cpuidle.hlinux/cpufreq.hlinux/memory_hotplug.hlinux/acpi.hasm/elf.hasm/vdso.hasm/e820/api.hasm/setup.hasm/numa.hasm/idtentry.hasm/xen/hypervisor.hasm/xen/hypercall.hxen/xen.hxen/page.hxen/interface/callback.hxen/interface/memory.hxen/interface/physdev.hxen/features.hxen/hvc-console.hxen-ops.h
Detected Declarations
function xen_parse_512gbfunction xen_del_extra_memfunction xen_chk_extra_memfunction xen_inv_extra_memfunction xen_find_pfn_rangefunction xen_free_mfnfunction xen_set_identity_and_release_chunkfunction xen_update_mem_tablesfunction xen_do_set_identity_and_remap_chunkfunction xen_set_identity_and_remap_chunkfunction xen_count_remap_pagesfunction xen_foreach_remap_areafunction xen_do_set_identity_and_remap_chunkfunction xen_get_pages_limitfunction xen_get_max_pagesfunction xen_align_and_add_e820_regionfunction xen_ignore_unusablefunction xen_is_e820_reservedfunction xen_find_free_areafunction xen_e820_swap_entry_with_ramfunction possiblefunction xen_chk_is_e820_usablefunction xen_phys_memcpyfunction xen_reserve_xen_mfnlistfunction xen_memory_setupfunction register_callbackfunction xen_enable_syscallfunction xen_pvmmu_arch_setupfunction xen_arch_setup
Annotated Snippet
if (start_r == start_pfn) {
BUG_ON(n_pfns > size_r);
xen_extra_mem[i].start_pfn += n_pfns;
xen_extra_mem[i].n_pfns -= n_pfns;
break;
}
/* End of region. */
if (start_r + size_r == start_pfn + n_pfns) {
BUG_ON(n_pfns > size_r);
xen_extra_mem[i].n_pfns -= n_pfns;
break;
}
/* Mid of region. */
if (start_pfn > start_r && start_pfn < start_r + size_r) {
BUG_ON(start_pfn + n_pfns > start_r + size_r);
xen_extra_mem[i].n_pfns = start_pfn - start_r;
/* Calling memblock_reserve() again is okay. */
xen_add_extra_mem(start_pfn + n_pfns, start_r + size_r -
(start_pfn + n_pfns));
break;
}
}
memblock_phys_free(PFN_PHYS(start_pfn), PFN_PHYS(n_pfns));
}
/*
* Called during boot before the p2m list can take entries beyond the
* hypervisor supplied p2m list. Entries in extra mem are to be regarded as
* invalid.
*/
unsigned long __ref xen_chk_extra_mem(unsigned long pfn)
{
int i;
for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
if (pfn >= xen_extra_mem[i].start_pfn &&
pfn < xen_extra_mem[i].start_pfn + xen_extra_mem[i].n_pfns)
return INVALID_P2M_ENTRY;
}
return IDENTITY_FRAME(pfn);
}
/*
* Mark all pfns of extra mem as invalid in p2m list.
*/
void __init xen_inv_extra_mem(void)
{
unsigned long pfn, pfn_s, pfn_e;
int i;
for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
if (!xen_extra_mem[i].n_pfns)
continue;
pfn_s = xen_extra_mem[i].start_pfn;
pfn_e = pfn_s + xen_extra_mem[i].n_pfns;
for (pfn = pfn_s; pfn < pfn_e; pfn++)
set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
}
}
/*
* Finds the next RAM pfn available in the E820 map after min_pfn.
* This function updates min_pfn with the pfn found and returns
* the size of that range or zero if not found.
*/
static unsigned long __init xen_find_pfn_range(unsigned long *min_pfn)
{
const struct e820_entry *entry = xen_e820_table.entries;
unsigned int i;
unsigned long done = 0;
for (i = 0; i < xen_e820_table.nr_entries; i++, entry++) {
unsigned long s_pfn;
unsigned long e_pfn;
if (entry->type != E820_TYPE_RAM)
continue;
e_pfn = PFN_DOWN(entry->addr + entry->size);
/* We only care about E820 after this */
if (e_pfn <= *min_pfn)
continue;
s_pfn = PFN_UP(entry->addr);
/* If min_pfn falls within the E820 entry, we want to start
* at the min_pfn PFN.
*/
Annotation
- Immediate include surface: `linux/init.h`, `linux/iscsi_ibft.h`, `linux/sched.h`, `linux/kstrtox.h`, `linux/mm.h`, `linux/pm.h`, `linux/memblock.h`, `linux/cpuidle.h`.
- Detected declarations: `function xen_parse_512gb`, `function xen_del_extra_mem`, `function xen_chk_extra_mem`, `function xen_inv_extra_mem`, `function xen_find_pfn_range`, `function xen_free_mfn`, `function xen_set_identity_and_release_chunk`, `function xen_update_mem_tables`, `function xen_do_set_identity_and_remap_chunk`, `function xen_set_identity_and_remap_chunk`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source implementation candidate.
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.