arch/xtensa/kernel/smp.c
Source file repositories/reference/linux-study-clean/arch/xtensa/kernel/smp.c
File Facts
- System
- Linux kernel
- Corpus path
arch/xtensa/kernel/smp.c- Extension
.c- Size
- 13751 bytes
- Lines
- 638
- Domain
- Architecture Layer
- Bucket
- arch/xtensa
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpu.hlinux/cpumask.hlinux/delay.hlinux/init.hlinux/interrupt.hlinux/irqdomain.hlinux/irq.hlinux/kdebug.hlinux/module.hlinux/profile.hlinux/sched/mm.hlinux/sched/hotplug.hlinux/sched/task_stack.hlinux/reboot.hlinux/seq_file.hlinux/smp.hlinux/thread_info.hasm/cacheflush.hasm/coprocessor.hasm/kdebug.hasm/mmu_context.hasm/mxregs.hasm/platform.hasm/tlbflush.hasm/traps.h
Detected Declarations
struct ipi_datastruct flush_dataenum ipi_msg_typefunction ipi_initfunction get_core_countfunction get_core_idfunction smp_prepare_cpusfunction smp_init_cpusfunction smp_prepare_boot_cpufunction smp_cpus_donefunction secondary_start_kernelfunction mx_cpu_startfunction mx_cpu_stopfunction boot_secondaryfunction __cpu_upfunction __cpu_disablefunction platform_cpu_killfunction __cpu_diefunction arch_cpu_idle_deadfunction cpu_diefunction send_ipi_messagefunction arch_send_call_function_ipi_maskfunction arch_send_call_function_single_ipifunction arch_smp_send_reschedulefunction smp_send_stopfunction ipi_cpu_stopfunction ipi_interruptfunction show_ipi_listfunction setup_profiling_timerfunction ipi_flush_tlb_allfunction flush_tlb_allfunction ipi_flush_tlb_mmfunction flush_tlb_mmfunction ipi_flush_tlb_pagefunction flush_tlb_pagefunction ipi_flush_tlb_rangefunction flush_tlb_rangefunction ipi_flush_tlb_kernel_rangefunction flush_tlb_kernel_rangefunction ipi_flush_cache_allfunction flush_cache_allfunction ipi_flush_cache_pagefunction flush_cache_pagefunction ipi_flush_cache_rangefunction flush_cache_rangefunction ipi_flush_icache_rangefunction flush_icache_rangefunction ipi_invalidate_dcache_range
Annotated Snippet
struct ipi_data {
unsigned long ipi_count[IPI_MAX];
};
static DEFINE_PER_CPU(struct ipi_data, ipi_data);
static void send_ipi_message(const struct cpumask *callmask,
enum ipi_msg_type msg_id)
{
int index;
unsigned long mask = 0;
for_each_cpu(index, callmask)
mask |= 1 << index;
set_er(mask, MIPISET(msg_id));
}
void arch_send_call_function_ipi_mask(const struct cpumask *mask)
{
send_ipi_message(mask, IPI_CALL_FUNC);
}
void arch_send_call_function_single_ipi(int cpu)
{
send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC);
}
void arch_smp_send_reschedule(int cpu)
{
send_ipi_message(cpumask_of(cpu), IPI_RESCHEDULE);
}
void smp_send_stop(void)
{
struct cpumask targets;
cpumask_copy(&targets, cpu_online_mask);
cpumask_clear_cpu(smp_processor_id(), &targets);
send_ipi_message(&targets, IPI_CPU_STOP);
}
static void ipi_cpu_stop(unsigned int cpu)
{
set_cpu_online(cpu, false);
machine_halt();
}
irqreturn_t ipi_interrupt(int irq, void *dev_id)
{
unsigned int cpu = smp_processor_id();
struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
for (;;) {
unsigned int msg;
msg = get_er(MIPICAUSE(cpu));
set_er(msg, MIPICAUSE(cpu));
if (!msg)
break;
if (msg & (1 << IPI_CALL_FUNC)) {
++ipi->ipi_count[IPI_CALL_FUNC];
generic_smp_call_function_interrupt();
}
if (msg & (1 << IPI_RESCHEDULE)) {
++ipi->ipi_count[IPI_RESCHEDULE];
scheduler_ipi();
}
if (msg & (1 << IPI_CPU_STOP)) {
++ipi->ipi_count[IPI_CPU_STOP];
ipi_cpu_stop(cpu);
}
}
return IRQ_HANDLED;
}
void show_ipi_list(struct seq_file *p, int prec)
{
unsigned int cpu;
unsigned i;
for (i = 0; i < IPI_MAX; ++i) {
seq_printf(p, "%*s:", prec, ipi_text[i].short_text);
for_each_online_cpu(cpu)
seq_printf(p, " %10lu",
Annotation
- Immediate include surface: `linux/cpu.h`, `linux/cpumask.h`, `linux/delay.h`, `linux/init.h`, `linux/interrupt.h`, `linux/irqdomain.h`, `linux/irq.h`, `linux/kdebug.h`.
- Detected declarations: `struct ipi_data`, `struct flush_data`, `enum ipi_msg_type`, `function ipi_init`, `function get_core_count`, `function get_core_id`, `function smp_prepare_cpus`, `function smp_init_cpus`, `function smp_prepare_boot_cpu`, `function smp_cpus_done`.
- Atlas domain: Architecture Layer / arch/xtensa.
- 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.