arch/x86/kernel/apic/x2apic_uv_x.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/apic/x2apic_uv_x.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/apic/x2apic_uv_x.c- Extension
.c- Size
- 48762 bytes
- Lines
- 1835
- 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.
- 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/crash_dump.hlinux/cpuhotplug.hlinux/cpumask.hlinux/proc_fs.hlinux/memory.hlinux/export.hlinux/pci.hlinux/acpi.hlinux/efi.hasm/e820/api.hasm/uv/uv_mmrs.hasm/uv/uv_hub.hasm/uv/bios.hasm/uv/uv.hasm/apic.hlocal.h
Detected Declarations
struct mnenum map_typeenum mmioh_archfunction uv_undefinedfunction uv_early_read_mmrfunction is_GRU_rangefunction uv_is_untracked_pat_rangefunction early_get_pnodeidfunction early_set_hub_typefunction uv_tsc_check_syncfunction early_get_apic_socketid_shiftfunction uv_stringifyfunction early_find_archtypefunction decode_arch_typefunction early_get_arch_typefunction early_set_apic_modefunction uv_set_system_typefunction uv_acpi_madt_oem_checkfunction get_uv_system_typefunction uv_get_hubless_systemfunction uv_get_archtypefunction is_uv_systemfunction is_uv_hubbedfunction is_uv_hublessfunction parse_mem_block_sizefunction adj_blksizefunction set_block_sizefunction build_uv_gr_tablefunction uv_wakeup_secondaryfunction uv_send_IPI_onefunction uv_send_IPI_maskfunction uv_send_IPI_mask_allbutselffunction for_each_cpufunction uv_send_IPI_allbutselffunction for_each_online_cpufunction uv_send_IPI_allfunction uv_probefunction get_lowmem_redirectfunction map_highfunction map_gru_highfunction map_mmr_highfunction calc_mmioh_mapfunction map_mmioh_highfunction map_low_mmrsfunction uv_rtc_initfunction uv_set_vga_statefunction uv_cpu_initfunction get_mn
Annotated Snippet
struct mn {
unsigned char m_val;
unsigned char n_val;
unsigned char m_shift;
unsigned char n_lshift;
};
/* Initialize caller's MN struct and fill in values */
static void get_mn(struct mn *mnp)
{
memset(mnp, 0, sizeof(*mnp));
mnp->n_val = uv_cpuid.n_skt;
if (is_uv(UV4|UVY)) {
mnp->m_val = 0;
mnp->n_lshift = 0;
} else if (is_uv3_hub()) {
union uvyh_gr0_gam_gr_config_u m_gr_config;
mnp->m_val = uv_cpuid.m_skt;
m_gr_config.v = uv_read_local_mmr(UVH_GR0_GAM_GR_CONFIG);
mnp->n_lshift = m_gr_config.s3.m_skt;
} else if (is_uv2_hub()) {
mnp->m_val = uv_cpuid.m_skt;
mnp->n_lshift = mnp->m_val == 40 ? 40 : 39;
}
mnp->m_shift = mnp->m_val ? 64 - mnp->m_val : 0;
}
static void __init uv_init_hub_info(struct uv_hub_info_s *hi)
{
struct mn mn;
get_mn(&mn);
hi->gpa_mask = mn.m_val ?
(1UL << (mn.m_val + mn.n_val)) - 1 :
(1UL << uv_cpuid.gpa_shift) - 1;
hi->m_val = mn.m_val;
hi->n_val = mn.n_val;
hi->m_shift = mn.m_shift;
hi->n_lshift = mn.n_lshift ? mn.n_lshift : 0;
hi->hub_revision = uv_hub_info->hub_revision;
hi->hub_type = uv_hub_info->hub_type;
hi->pnode_mask = uv_cpuid.pnode_mask;
hi->nasid_shift = uv_cpuid.nasid_shift;
hi->min_pnode = _min_pnode;
hi->min_socket = _min_socket;
hi->node_to_socket = _node_to_socket;
hi->pnode_to_socket = _pnode_to_socket;
hi->socket_to_node = _socket_to_node;
hi->socket_to_pnode = _socket_to_pnode;
hi->gr_table_len = _gr_table_len;
hi->gr_table = _gr_table;
uv_cpuid.gnode_shift = max_t(unsigned int, uv_cpuid.gnode_shift, mn.n_val);
hi->gnode_extra = (uv_node_id & ~((1 << uv_cpuid.gnode_shift) - 1)) >> 1;
if (mn.m_val)
hi->gnode_upper = (u64)hi->gnode_extra << mn.m_val;
if (uv_gp_table) {
hi->global_mmr_base = uv_gp_table->mmr_base;
hi->global_mmr_shift = uv_gp_table->mmr_shift;
hi->global_gru_base = uv_gp_table->gru_base;
hi->global_gru_shift = uv_gp_table->gru_shift;
hi->gpa_shift = uv_gp_table->gpa_shift;
hi->gpa_mask = (1UL << hi->gpa_shift) - 1;
} else {
hi->global_mmr_base =
uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG) &
~UV_MMR_ENABLE;
hi->global_mmr_shift = _UV_GLOBAL_MMR64_PNODE_SHIFT;
}
get_lowmem_redirect(&hi->lowmem_remap_base, &hi->lowmem_remap_top);
hi->apic_pnode_shift = uv_cpuid.socketid_shift;
/* Show system specific info: */
pr_info("UV: N:%d M:%d m_shift:%d n_lshift:%d\n", hi->n_val, hi->m_val, hi->m_shift, hi->n_lshift);
pr_info("UV: gpa_mask/shift:0x%lx/%d pnode_mask:0x%x apic_pns:%d\n", hi->gpa_mask, hi->gpa_shift, hi->pnode_mask, hi->apic_pnode_shift);
pr_info("UV: mmr_base/shift:0x%lx/%ld\n", hi->global_mmr_base, hi->global_mmr_shift);
if (hi->global_gru_base)
pr_info("UV: gru_base/shift:0x%lx/%ld\n",
hi->global_gru_base, hi->global_gru_shift);
pr_info("UV: gnode_upper:0x%lx gnode_extra:0x%x\n", hi->gnode_upper, hi->gnode_extra);
}
static void __init decode_gam_params(unsigned long ptr)
{
Annotation
- Immediate include surface: `linux/crash_dump.h`, `linux/cpuhotplug.h`, `linux/cpumask.h`, `linux/proc_fs.h`, `linux/memory.h`, `linux/export.h`, `linux/pci.h`, `linux/acpi.h`.
- Detected declarations: `struct mn`, `enum map_type`, `enum mmioh_arch`, `function uv_undefined`, `function uv_early_read_mmr`, `function is_GRU_range`, `function uv_is_untracked_pat_range`, `function early_get_pnodeid`, `function early_set_hub_type`, `function uv_tsc_check_sync`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: integration 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.