arch/hexagon/kernel/smp.c
Source file repositories/reference/linux-study-clean/arch/hexagon/kernel/smp.c
File Facts
- System
- Linux kernel
- Corpus path
arch/hexagon/kernel/smp.c- Extension
.c- Size
- 4983 bytes
- Lines
- 246
- Domain
- Architecture Layer
- Bucket
- arch/hexagon
- 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.
- 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/err.hlinux/errno.hlinux/kernel.hlinux/init.hlinux/interrupt.hlinux/module.hlinux/percpu.hlinux/sched/mm.hlinux/smp.hlinux/spinlock.hlinux/cpu.hlinux/mm_types.hasm/time.hasm/hexagon_vm.h
Detected Declarations
struct ipi_datafunction __handle_ipifunction smp_vm_unmask_irqfunction takefunction send_ipifunction for_each_cpufunction start_secondaryfunction __cpu_upfunction smp_cpus_donefunction arch_smp_send_reschedulefunction smp_send_stopfunction arch_send_call_function_single_ipifunction arch_send_call_function_ipi_maskfunction smp_start_cpus
Annotated Snippet
struct ipi_data {
unsigned long bits;
};
static DEFINE_PER_CPU(struct ipi_data, ipi_data);
static inline void __handle_ipi(unsigned long *ops, struct ipi_data *ipi,
int cpu)
{
unsigned long msg = 0;
do {
msg = find_next_bit(ops, BITS_PER_LONG, msg+1);
switch (msg) {
case IPI_TIMER:
ipi_timer();
break;
case IPI_CALL_FUNC:
generic_smp_call_function_interrupt();
break;
case IPI_CPU_STOP:
/*
* call vmstop()
*/
__vmstop();
break;
case IPI_RESCHEDULE:
scheduler_ipi();
break;
}
} while (msg < BITS_PER_LONG);
}
/* Used for IPI call from other CPU's to unmask int */
void smp_vm_unmask_irq(void *info)
{
__vmintop_locen((long) info);
}
/*
* This is based on Alpha's IPI stuff.
* Supposed to take (int, void*) as args now.
* Specifically, first arg is irq, second is the irq_desc.
*/
static irqreturn_t handle_ipi(int irq, void *desc)
{
int cpu = smp_processor_id();
struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
unsigned long ops;
while ((ops = xchg(&ipi->bits, 0)) != 0)
__handle_ipi(&ops, ipi, cpu);
return IRQ_HANDLED;
}
void send_ipi(const struct cpumask *cpumask, enum ipi_message_type msg)
{
unsigned long flags;
unsigned long cpu;
unsigned long retval;
local_irq_save(flags);
for_each_cpu(cpu, cpumask) {
struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
set_bit(msg, &ipi->bits);
/* Possible barrier here */
retval = __vmintop_post(BASE_IPI_IRQ+cpu);
if (retval != 0) {
printk(KERN_ERR "interrupt %ld not configured?\n",
BASE_IPI_IRQ+cpu);
}
}
local_irq_restore(flags);
}
/*
* interrupts should already be disabled from the VM
* SP should already be correct; need to set THREADINFO_REG
* to point to current thread info
*/
Annotation
- Immediate include surface: `linux/err.h`, `linux/errno.h`, `linux/kernel.h`, `linux/init.h`, `linux/interrupt.h`, `linux/module.h`, `linux/percpu.h`, `linux/sched/mm.h`.
- Detected declarations: `struct ipi_data`, `function __handle_ipi`, `function smp_vm_unmask_irq`, `function take`, `function send_ipi`, `function for_each_cpu`, `function start_secondary`, `function __cpu_up`, `function smp_cpus_done`, `function arch_smp_send_reschedule`.
- Atlas domain: Architecture Layer / arch/hexagon.
- Implementation status: source 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.