arch/arc/kernel/smp.c
Source file repositories/reference/linux-study-clean/arch/arc/kernel/smp.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arc/kernel/smp.c- Extension
.c- Size
- 9611 bytes
- Lines
- 410
- Domain
- Architecture Layer
- Bucket
- arch/arc
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/spinlock.hlinux/sched/mm.hlinux/interrupt.hlinux/profile.hlinux/mm.hlinux/cpu.hlinux/irq.hlinux/atomic.hlinux/cpumask.hlinux/reboot.hlinux/irqdomain.hlinux/export.hlinux/of_fdt.hasm/mach_desc.hasm/setup.hasm/smp.hasm/processor.h
Detected Declarations
enum ipi_msg_typefunction arc_get_cpu_mapfunction arc_init_cpu_possiblefunction setup_archfunction smp_prepare_cpusfunction smp_cpus_donefunction arc_default_smp_cpu_kickfunction arc_platform_smp_wait_to_bootfunction start_kernel_secondaryfunction kernel_initfunction ipi_send_msg_onefunction ipi_send_msgfunction arch_smp_send_reschedulefunction smp_send_stopfunction arch_send_call_function_single_ipifunction arch_send_call_function_ipi_maskfunction ipi_cpu_stopfunction __do_IPIfunction do_IPIfunction smp_ipi_irq_setupexport smp_atomic_ops_lock
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
*
* RajeshwarR: Dec 11, 2007
* -- Added support for Inter Processor Interrupts
*
* Vineetg: Nov 1st, 2007
* -- Initial Write (Borrowed heavily from ARM)
*/
#include <linux/spinlock.h>
#include <linux/sched/mm.h>
#include <linux/interrupt.h>
#include <linux/profile.h>
#include <linux/mm.h>
#include <linux/cpu.h>
#include <linux/irq.h>
#include <linux/atomic.h>
#include <linux/cpumask.h>
#include <linux/reboot.h>
#include <linux/irqdomain.h>
#include <linux/export.h>
#include <linux/of_fdt.h>
#include <asm/mach_desc.h>
#include <asm/setup.h>
#include <asm/smp.h>
#include <asm/processor.h>
#ifndef CONFIG_ARC_HAS_LLSC
arch_spinlock_t smp_atomic_ops_lock = __ARCH_SPIN_LOCK_UNLOCKED;
EXPORT_SYMBOL_GPL(smp_atomic_ops_lock);
#endif
struct plat_smp_ops __weak plat_smp_ops;
/* XXX: per cpu ? Only needed once in early secondary boot */
struct task_struct *secondary_idle_tsk;
static int __init arc_get_cpu_map(const char *name, struct cpumask *cpumask)
{
unsigned long dt_root = of_get_flat_dt_root();
const char *buf;
buf = of_get_flat_dt_prop(dt_root, name, NULL);
if (!buf)
return -EINVAL;
if (cpulist_parse(buf, cpumask))
return -EINVAL;
return 0;
}
/*
* Read from DeviceTree and setup cpu possible mask. If there is no
* "possible-cpus" property in DeviceTree pretend all [0..NR_CPUS-1] exist.
*/
static void __init arc_init_cpu_possible(void)
{
struct cpumask cpumask;
if (arc_get_cpu_map("possible-cpus", &cpumask)) {
pr_warn("Failed to get possible-cpus from dtb, pretending all %u cpus exist\n",
NR_CPUS);
cpumask_setall(&cpumask);
}
if (!cpumask_test_cpu(0, &cpumask))
panic("Master cpu (cpu[0]) is missed in cpu possible mask!");
init_cpu_possible(&cpumask);
}
/*
* Called from setup_arch() before calling setup_processor()
*
* - Initialise the CPU possible map early - this describes the CPUs
* which may be present or become present in the system.
* - Call early smp init hook. This can initialize a specific multi-core
* IP which is say common to several platforms (hence not part of
* platform specific int_early() hook)
*/
void __init smp_init_cpus(void)
{
arc_init_cpu_possible();
Annotation
- Immediate include surface: `linux/spinlock.h`, `linux/sched/mm.h`, `linux/interrupt.h`, `linux/profile.h`, `linux/mm.h`, `linux/cpu.h`, `linux/irq.h`, `linux/atomic.h`.
- Detected declarations: `enum ipi_msg_type`, `function arc_get_cpu_map`, `function arc_init_cpu_possible`, `function setup_arch`, `function smp_prepare_cpus`, `function smp_cpus_done`, `function arc_default_smp_cpu_kick`, `function arc_platform_smp_wait_to_boot`, `function start_kernel_secondary`, `function kernel_init`.
- Atlas domain: Architecture Layer / arch/arc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.