arch/sparc/kernel/sun4d_smp.c
Source file repositories/reference/linux-study-clean/arch/sparc/kernel/sun4d_smp.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/kernel/sun4d_smp.c- Extension
.c- Size
- 9880 bytes
- Lines
- 416
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clockchips.hlinux/interrupt.hlinux/profile.hlinux/delay.hlinux/sched/mm.hlinux/cpu.hasm/cacheflush.hasm/switch_to.hasm/tlbflush.hasm/timer.hasm/oplib.hasm/sbi.hasm/mmu.hkernel.hirq.h
Detected Declarations
struct sun4d_ipi_workfunction sun4d_swapfunction show_ledsfunction sun4d_cpu_pre_startingfunction sun4d_cpu_pre_onlinefunction smp4d_boot_cpusfunction smp4d_boot_one_cpufunction smp4d_smp_donefunction smp4d_ipi_initfunction for_each_possible_cpufunction sun4d_ipi_interruptfunction sun4d_send_ipifunction sun4d_ipi_singlefunction sun4d_ipi_mask_onefunction sun4d_ipi_reschedfunction sun4d_cross_callfunction smp4d_cross_call_irqfunction smp4d_percpu_timer_interruptfunction sun4d_init_smp
Annotated Snippet
struct sun4d_ipi_work {
int single;
int msk;
int resched;
};
static DEFINE_PER_CPU_SHARED_ALIGNED(struct sun4d_ipi_work, sun4d_ipi_work);
/* Initialize IPIs on the SUN4D SMP machine */
static void __init smp4d_ipi_init(void)
{
int cpu;
struct sun4d_ipi_work *work;
printk(KERN_INFO "smp4d: setup IPI at IRQ %d\n", SUN4D_IPI_IRQ);
for_each_possible_cpu(cpu) {
work = &per_cpu(sun4d_ipi_work, cpu);
work->single = work->msk = work->resched = 0;
}
}
void sun4d_ipi_interrupt(void)
{
struct sun4d_ipi_work *work = this_cpu_ptr(&sun4d_ipi_work);
if (work->single) {
work->single = 0;
smp_call_function_single_interrupt();
}
if (work->msk) {
work->msk = 0;
smp_call_function_interrupt();
}
if (work->resched) {
work->resched = 0;
smp_resched_interrupt();
}
}
/* +-------+-------------+-----------+------------------------------------+
* | bcast | devid | sid | levels mask |
* +-------+-------------+-----------+------------------------------------+
* 31 30 23 22 15 14 0
*/
#define IGEN_MESSAGE(bcast, devid, sid, levels) \
(((bcast) << 31) | ((devid) << 23) | ((sid) << 15) | (levels))
static void sun4d_send_ipi(int cpu, int level)
{
cc_set_igen(IGEN_MESSAGE(0, cpu << 3, 6 + ((level >> 1) & 7), 1 << (level - 1)));
}
static void sun4d_ipi_single(int cpu)
{
struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu);
/* Mark work */
work->single = 1;
/* Generate IRQ on the CPU */
sun4d_send_ipi(cpu, SUN4D_IPI_IRQ);
}
static void sun4d_ipi_mask_one(int cpu)
{
struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu);
/* Mark work */
work->msk = 1;
/* Generate IRQ on the CPU */
sun4d_send_ipi(cpu, SUN4D_IPI_IRQ);
}
static void sun4d_ipi_resched(int cpu)
{
struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu);
/* Mark work */
work->resched = 1;
/* Generate IRQ on the CPU (any IRQ will cause resched) */
sun4d_send_ipi(cpu, SUN4D_IPI_IRQ);
}
static struct smp_funcall {
void *func;
unsigned long arg1;
unsigned long arg2;
Annotation
- Immediate include surface: `linux/clockchips.h`, `linux/interrupt.h`, `linux/profile.h`, `linux/delay.h`, `linux/sched/mm.h`, `linux/cpu.h`, `asm/cacheflush.h`, `asm/switch_to.h`.
- Detected declarations: `struct sun4d_ipi_work`, `function sun4d_swap`, `function show_leds`, `function sun4d_cpu_pre_starting`, `function sun4d_cpu_pre_online`, `function smp4d_boot_cpus`, `function smp4d_boot_one_cpu`, `function smp4d_smp_done`, `function smp4d_ipi_init`, `function for_each_possible_cpu`.
- Atlas domain: Architecture Layer / arch/sparc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.