arch/mips/kernel/smp-bmips.c
Source file repositories/reference/linux-study-clean/arch/mips/kernel/smp-bmips.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/kernel/smp-bmips.c- Extension
.c- Size
- 17437 bytes
- Lines
- 696
- Domain
- Architecture Layer
- Bucket
- arch/mips
- 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.
- 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/init.hlinux/sched.hlinux/sched/hotplug.hlinux/sched/task_stack.hlinux/mm.hlinux/delay.hlinux/smp.hlinux/interrupt.hlinux/spinlock.hlinux/cpu.hlinux/cpumask.hlinux/reboot.hlinux/io.hlinux/compiler.hlinux/linkage.hlinux/bug.hlinux/kernel.hlinux/kexec.hlinux/irq.hasm/time.hasm/processor.hasm/bootinfo.hasm/cacheflush.hasm/tlbflush.hasm/mipsregs.hasm/bmips.hasm/traps.hasm/barrier.hasm/cpu-features.hasm/smp.h
Detected Declarations
struct reset_vec_infofunction bmips_smp_setupfunction bmips_prepare_cpusfunction bmips_boot_secondaryfunction bmips_init_secondaryfunction bmips_smp_finishfunction bmips5000_send_ipi_singlefunction bmips5000_ipi_interruptfunction bmips5000_send_ipi_maskfunction bmips43xx_send_ipi_singlefunction bmips43xx_ipi_interruptfunction bmips43xx_send_ipi_maskfunction bmips_cpu_disablefunction bmips_cpu_diefunction bmips_wr_vecfunction bmips_nmi_handler_setupfunction bmips_set_reset_vec_remotefunction bmips_set_reset_vecfunction bmips_ebase_setupfunction plat_wired_tlb_setup
Annotated Snippet
struct reset_vec_info {
int cpu;
u32 val;
};
static void bmips_set_reset_vec_remote(void *vinfo)
{
struct reset_vec_info *info = vinfo;
int shift = info->cpu & 0x01 ? 16 : 0;
u32 mask = ~(0xffff << shift), val = info->val >> 16;
preempt_disable();
if (smp_processor_id() > 0) {
smp_call_function_single(0, &bmips_set_reset_vec_remote,
info, 1);
} else {
if (info->cpu & 0x02) {
/* BMIPS5200 "should" use mask/shift, but it's buggy */
bmips_write_zscm_reg(0xa0, (val << 16) | val);
bmips_read_zscm_reg(0xa0);
} else {
write_c0_brcm_bootvec((read_c0_brcm_bootvec() & mask) |
(val << shift));
}
}
preempt_enable();
}
static void bmips_set_reset_vec(int cpu, u32 val)
{
struct reset_vec_info info;
if (current_cpu_type() == CPU_BMIPS5000) {
/* this needs to run from CPU0 (which is always online) */
info.cpu = cpu;
info.val = val;
bmips_set_reset_vec_remote(&info);
} else {
void __iomem *cbr = bmips_cbr_addr;
if (cpu == 0)
__raw_writel(val, cbr + BMIPS_RELO_VECTOR_CONTROL_0);
else {
if (current_cpu_type() != CPU_BMIPS4380)
return;
__raw_writel(val, cbr + BMIPS_RELO_VECTOR_CONTROL_1);
}
}
__sync();
back_to_back_c0_hazard();
}
void bmips_ebase_setup(void)
{
unsigned long new_ebase = ebase;
BUG_ON(ebase != CKSEG0);
switch (current_cpu_type()) {
case CPU_BMIPS4350:
/*
* BMIPS4350 cannot relocate the normal vectors, but it
* can relocate the BEV=1 vectors. So CPU1 starts up at
* the relocated BEV=1, IV=0 general exception vector @
* 0xa000_0380.
*
* set_uncached_handler() is used here because:
* - CPU1 will run this from uncached space
* - None of the cacheflush functions are set up yet
*/
set_uncached_handler(BMIPS_WARM_RESTART_VEC - CKSEG0,
&bmips_smp_int_vec, 0x80);
__sync();
return;
case CPU_BMIPS3300:
case CPU_BMIPS4380:
/*
* 0x8000_0000: reset/NMI (initially in kseg1)
* 0x8000_0400: normal vectors
*/
new_ebase = 0x80000400;
bmips_set_reset_vec(0, RESET_FROM_KSEG0);
break;
case CPU_BMIPS5000:
/*
* 0x8000_0000: reset/NMI (initially in kseg1)
* 0x8000_1000: normal vectors
*/
new_ebase = 0x80001000;
bmips_set_reset_vec(0, RESET_FROM_KSEG0);
Annotation
- Immediate include surface: `linux/init.h`, `linux/sched.h`, `linux/sched/hotplug.h`, `linux/sched/task_stack.h`, `linux/mm.h`, `linux/delay.h`, `linux/smp.h`, `linux/interrupt.h`.
- Detected declarations: `struct reset_vec_info`, `function bmips_smp_setup`, `function bmips_prepare_cpus`, `function bmips_boot_secondary`, `function bmips_init_secondary`, `function bmips_smp_finish`, `function bmips5000_send_ipi_single`, `function bmips5000_ipi_interrupt`, `function bmips5000_send_ipi_mask`, `function bmips43xx_send_ipi_single`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: source 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.