arch/x86/kernel/apic/apic_common.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/apic/apic_common.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/apic/apic_common.c- Extension
.c- Size
- 922 bytes
- Lines
- 44
- 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.
Dependency Surface
linux/irq.hlinux/kvm_types.hasm/apic.hlocal.h
Detected Declarations
function apic_default_calc_apicidfunction apic_flat_calc_apicidfunction default_cpu_present_to_apicidfunction default_init_apic_ldr
Annotated Snippet
#include <linux/irq.h>
#include <linux/kvm_types.h>
#include <asm/apic.h>
#include "local.h"
u32 apic_default_calc_apicid(unsigned int cpu)
{
return per_cpu(x86_cpu_to_apicid, cpu);
}
u32 apic_flat_calc_apicid(unsigned int cpu)
{
return 1U << cpu;
}
u32 default_cpu_present_to_apicid(int mps_cpu)
{
if (mps_cpu < nr_cpu_ids && cpu_present(mps_cpu))
return (int)per_cpu(x86_cpu_to_apicid, mps_cpu);
else
return BAD_APICID;
}
EXPORT_SYMBOL_FOR_KVM(default_cpu_present_to_apicid);
/*
* Set up the logical destination ID when the APIC operates in logical
* destination mode.
*/
void default_init_apic_ldr(void)
{
unsigned long val;
apic_write(APIC_DFR, APIC_DFR_FLAT);
val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id());
apic_write(APIC_LDR, val);
}
Annotation
- Immediate include surface: `linux/irq.h`, `linux/kvm_types.h`, `asm/apic.h`, `local.h`.
- Detected declarations: `function apic_default_calc_apicid`, `function apic_flat_calc_apicid`, `function default_cpu_present_to_apicid`, `function default_init_apic_ldr`.
- 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.