arch/powerpc/platforms/pseries/smp.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/pseries/smp.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/pseries/smp.c- Extension
.c- Size
- 6725 bytes
- Lines
- 283
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/sched.hlinux/smp.hlinux/interrupt.hlinux/delay.hlinux/init.hlinux/spinlock.hlinux/cache.hlinux/err.hlinux/device.hlinux/cpu.hlinux/pgtable.hasm/ptrace.hlinux/atomic.hasm/irq.hasm/page.hasm/io.hasm/smp.hasm/paca.hasm/machdep.hasm/cputable.hasm/firmware.hasm/rtas.hasm/vdso_datapage.hasm/cputhreads.hasm/xics.hasm/xive.hasm/dbell.hasm/plpar_wrappers.hasm/text-patching.hasm/svm.hasm/kvm_guest.h
Detected Declarations
function smp_query_cpu_stoppedfunction smp_startup_cpufunction smp_setup_cpufunction smp_pSeries_kick_cpufunction pseries_smp_prepare_cpufunction dbell_or_ic_cause_ipifunction pseries_cause_nmi_ipifunction pSeries_smp_probefunction smp_init_pseries
Annotated Snippet
if (cpu < 0) {
WARN_ONCE(true, "incorrect cpu parameter %d", cpu);
return 0;
}
hwcpu = get_hard_smp_processor_id(cpu);
}
if (plpar_signal_sys_reset(hwcpu) == H_SUCCESS)
return 1;
return 0;
}
static __init void pSeries_smp_probe(void)
{
if (xive_enabled())
xive_smp_probe();
else
xics_smp_probe();
/* No doorbell facility, must use the interrupt controller for IPIs */
if (!cpu_has_feature(CPU_FTR_DBELL))
return;
/* Doorbells can only be used for IPIs between SMT siblings */
if (!cpu_has_feature(CPU_FTR_SMT))
return;
check_kvm_guest();
if (is_kvm_guest()) {
/*
* KVM emulates doorbells by disabling FSCR[MSGP] so msgsndp
* faults to the hypervisor which then reads the instruction
* from guest memory, which tends to be slower than using XIVE.
*/
if (xive_enabled())
return;
/*
* XICS hcalls aren't as fast, so we can use msgsndp (which
* also helps exercise KVM emulation), however KVM can't
* emulate secure guests because it can't read the instruction
* out of their memory.
*/
if (is_secure_guest())
return;
}
/*
* Under PowerVM, FSCR[MSGP] is enabled as guest vCPU siblings are
* gang scheduled on the same physical core, so doorbells are always
* faster than the interrupt controller, and they can be used by
* secure guests.
*/
ic_cause_ipi = smp_ops->cause_ipi;
smp_ops->cause_ipi = dbell_or_ic_cause_ipi;
}
static struct smp_ops_t pseries_smp_ops = {
.message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
.cause_ipi = NULL, /* Filled at runtime by pSeries_smp_probe() */
.cause_nmi_ipi = pseries_cause_nmi_ipi,
.probe = pSeries_smp_probe,
.prepare_cpu = pseries_smp_prepare_cpu,
.kick_cpu = smp_pSeries_kick_cpu,
.setup_cpu = smp_setup_cpu,
.cpu_bootable = smp_generic_cpu_bootable,
};
/* This is called very early */
void __init smp_init_pseries(void)
{
int i;
pr_debug(" -> smp_init_pSeries()\n");
smp_ops = &pseries_smp_ops;
alloc_bootmem_cpumask_var(&of_spin_mask);
/*
* Mark threads which are still spinning in hold loops
*
* We know prom_init will not have started them if RTAS supports
* query-cpu-stopped-state.
*/
if (rtas_function_token(RTAS_FN_QUERY_CPU_STOPPED_STATE) == RTAS_UNKNOWN_SERVICE) {
if (cpu_has_feature(CPU_FTR_SMT)) {
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/sched.h`, `linux/smp.h`, `linux/interrupt.h`, `linux/delay.h`, `linux/init.h`, `linux/spinlock.h`, `linux/cache.h`.
- Detected declarations: `function smp_query_cpu_stopped`, `function smp_startup_cpu`, `function smp_setup_cpu`, `function smp_pSeries_kick_cpu`, `function pseries_smp_prepare_cpu`, `function dbell_or_ic_cause_ipi`, `function pseries_cause_nmi_ipi`, `function pSeries_smp_probe`, `function smp_init_pseries`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: source implementation candidate.
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.