arch/powerpc/platforms/85xx/smp.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/85xx/smp.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/85xx/smp.c- Extension
.c- Size
- 11808 bytes
- Lines
- 523
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- 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/stddef.hlinux/kernel.hlinux/sched/hotplug.hlinux/init.hlinux/delay.hlinux/of.hlinux/kexec.hlinux/highmem.hlinux/cpu.hlinux/fsl/guts.hlinux/pgtable.hasm/machdep.hasm/page.hasm/mpic.hasm/cacheflush.hasm/dbell.hasm/text-patching.hasm/cputhreads.hasm/fsl_pm.hsysdev/fsl_soc.hsysdev/mpic.hsmp.h
Detected Declarations
struct epapr_spin_tablefunction mpc85xx_give_timebasefunction mpc85xx_take_timebasefunction smp_85xx_cpu_offline_selffunction qoriq_cpu_killfunction flush_spin_tablefunction read_spin_table_addr_lfunction wake_hw_threadfunction smp_85xx_start_cpufunction smp_85xx_kick_cpufunction mpc85xx_smp_kexec_cpu_downfunction mpc85xx_smp_kexec_downfunction mpc85xx_smp_kexec_cpu_downfunction mpc85xx_smp_machine_kexecfunction for_each_online_cpufunction smp_85xx_setup_cpufunction mpc85xx_smp_init
Annotated Snippet
struct epapr_spin_table {
u32 addr_h;
u32 addr_l;
u32 r3_h;
u32 r3_l;
u32 reserved;
u32 pir;
};
static u64 timebase;
static int tb_req;
static int tb_valid;
static void mpc85xx_give_timebase(void)
{
unsigned long flags;
local_irq_save(flags);
hard_irq_disable();
while (!tb_req)
barrier();
tb_req = 0;
qoriq_pm_ops->freeze_time_base(true);
#ifdef CONFIG_PPC64
/*
* e5500/e6500 have a workaround for erratum A-006958 in place
* that will reread the timebase until TBL is non-zero.
* That would be a bad thing when the timebase is frozen.
*
* Thus, we read it manually, and instead of checking that
* TBL is non-zero, we ensure that TB does not change. We don't
* do that for the main mftb implementation, because it requires
* a scratch register
*/
{
u64 prev;
asm volatile("mfspr %0, %1" : "=r" (timebase) :
"i" (SPRN_TBRL));
do {
prev = timebase;
asm volatile("mfspr %0, %1" : "=r" (timebase) :
"i" (SPRN_TBRL));
} while (prev != timebase);
}
#else
timebase = get_tb();
#endif
mb();
tb_valid = 1;
while (tb_valid)
barrier();
qoriq_pm_ops->freeze_time_base(false);
local_irq_restore(flags);
}
static void mpc85xx_take_timebase(void)
{
unsigned long flags;
local_irq_save(flags);
hard_irq_disable();
tb_req = 1;
while (!tb_valid)
barrier();
set_tb(timebase >> 32, timebase & 0xffffffff);
isync();
tb_valid = 0;
local_irq_restore(flags);
}
#ifdef CONFIG_HOTPLUG_CPU
static void smp_85xx_cpu_offline_self(void)
{
unsigned int cpu = smp_processor_id();
local_irq_disable();
hard_irq_disable();
/* mask all irqs to prevent cpu wakeup */
qoriq_pm_ops->irq_mask(cpu);
Annotation
- Immediate include surface: `linux/stddef.h`, `linux/kernel.h`, `linux/sched/hotplug.h`, `linux/init.h`, `linux/delay.h`, `linux/of.h`, `linux/kexec.h`, `linux/highmem.h`.
- Detected declarations: `struct epapr_spin_table`, `function mpc85xx_give_timebase`, `function mpc85xx_take_timebase`, `function smp_85xx_cpu_offline_self`, `function qoriq_cpu_kill`, `function flush_spin_table`, `function read_spin_table_addr_l`, `function wake_hw_thread`, `function smp_85xx_start_cpu`, `function smp_85xx_kick_cpu`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.