Release 4.14 arch/sparc/kernel/smp_32.c
// SPDX-License-Identifier: GPL-2.0
/* smp.c: Sparc SMP support.
*
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
* Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
* Copyright (C) 2004 Keith M Wesolowski (wesolows@foobazco.org)
*/
#include <asm/head.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/threads.h>
#include <linux/smp.h>
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/seq_file.h>
#include <linux/cache.h>
#include <linux/delay.h>
#include <linux/profile.h>
#include <linux/cpu.h>
#include <asm/ptrace.h>
#include <linux/atomic.h>
#include <asm/irq.h>
#include <asm/page.h>
#include <asm/pgalloc.h>
#include <asm/pgtable.h>
#include <asm/oplib.h>
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>
#include <asm/cpudata.h>
#include <asm/timer.h>
#include <asm/leon.h>
#include "kernel.h"
#include "irq.h"
volatile unsigned long cpu_callin_map[NR_CPUS] = {0,};
cpumask_t smp_commenced_mask = CPU_MASK_NONE;
const struct sparc32_ipi_ops *sparc32_ipi_ops;
/* The only guaranteed locking primitive available on all Sparc
* processors is 'ldstub [%reg + immediate], %dest_reg' which atomically
* places the current byte at the effective address into dest_reg and
* places 0xff there afterwards. Pretty lame locking primitive
* compared to the Alpha and the Intel no? Most Sparcs have 'swap'
* instruction which is much better...
*/
void smp_store_cpu_info(int id)
{
int cpu_node;
int mid;
cpu_data(id).udelay_val = loops_per_jiffy;
cpu_find_by_mid(id, &cpu_node);
cpu_data(id).clock_tick = prom_getintdefault(cpu_node,
"clock-frequency", 0);
cpu_data(id).prom_node = cpu_node;
mid = cpu_get_hwmid(cpu_node);
if (mid < 0) {
printk(KERN_NOTICE "No MID found for CPU%d at node 0x%08x", id, cpu_node);
mid = 0;
}
cpu_data(id).mid = mid;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Keith M. Wesolowski | 52 | 55.32% | 1 | 16.67% |
Linus Torvalds (pre-git) | 21 | 22.34% | 3 | 50.00% |
Sam Ravnborg | 20 | 21.28% | 1 | 16.67% |
Hans Wennborg | 1 | 1.06% | 1 | 16.67% |
Total | 94 | 100.00% | 6 | 100.00% |
void __init smp_cpus_done(unsigned int max_cpus)
{
unsigned long bogosum = 0;
int cpu, num = 0;
for_each_online_cpu(cpu) {
num++;
bogosum += cpu_data(cpu).udelay_val;
}
printk("Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
num, bogosum/(500000/HZ),
(bogosum/(5000/HZ))%100);
switch(sparc_cpu_model) {
case sun4m:
smp4m_smp_done();
break;
case sun4d:
smp4d_smp_done();
break;
case sparc_leon:
leon_smp_done();
break;
case sun4e:
printk("SUN4E\n");
BUG();
break;
case sun4u:
printk("SUN4U\n");
BUG();
break;
default:
printk("UNKNOWN!\n");
BUG();
break;
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Bob Breuer | 60 | 46.51% | 1 | 16.67% |
Raymond Burns | 50 | 38.76% | 1 | 16.67% |
Konrad Eisele | 7 | 5.43% | 1 | 16.67% |
Keith M. Wesolowski | 6 | 4.65% | 1 | 16.67% |
Rusty Russell | 4 | 3.10% | 1 | 16.67% |
Linus Torvalds (pre-git) | 2 | 1.55% | 1 | 16.67% |
Total | 129 | 100.00% | 6 | 100.00% |
void cpu_panic(void)
{
printk("CPU[%d]: Returns from cpu_idle!\n", smp_processor_id());
panic("SMP bolixed\n");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 20 | 100.00% | 1 | 100.00% |
Total | 20 | 100.00% | 1 | 100.00% |
struct linux_prom_registers smp_penguin_ctable = { 0 };
void smp_send_reschedule(int cpu)
{
/*
* CPU model dependent way of implementing IPI generation targeting
* a single CPU. The trap handler needs only to do trap entry/return
* to call schedule.
*/
sparc32_ipi_ops->resched(cpu);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pete Zaitcev | 8 | 50.00% | 1 | 33.33% |
Sam Ravnborg | 6 | 37.50% | 1 | 33.33% |
Daniel Hellstrom | 2 | 12.50% | 1 | 33.33% |
Total | 16 | 100.00% | 3 | 100.00% |
void smp_send_stop(void)
{
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Pete Zaitcev | 5 | 83.33% | 1 | 50.00% |
Keith M. Wesolowski | 1 | 16.67% | 1 | 50.00% |
Total | 6 | 100.00% | 2 | 100.00% |
void arch_send_call_function_single_ipi(int cpu)
{
/* trigger one IPI single call on one CPU */
sparc32_ipi_ops->single(cpu);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Hellstrom | 10 | 62.50% | 1 | 50.00% |
Sam Ravnborg | 6 | 37.50% | 1 | 50.00% |
Total | 16 | 100.00% | 2 | 100.00% |
void arch_send_call_function_ipi_mask(const struct cpumask *mask)
{
int cpu;
/* trigger IPI mask call on each CPU */
for_each_cpu(cpu, mask)
sparc32_ipi_ops->mask_one(cpu);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Hellstrom | 22 | 78.57% | 1 | 50.00% |
Sam Ravnborg | 6 | 21.43% | 1 | 50.00% |
Total | 28 | 100.00% | 2 | 100.00% |
void smp_resched_interrupt(void)
{
irq_enter();
scheduler_ipi();
local_cpu_data().irq_resched_count++;
irq_exit();
/* re-schedule routine called by interrupt return code. */
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Hellstrom | 13 | 56.52% | 1 | 50.00% |
David S. Miller | 10 | 43.48% | 1 | 50.00% |
Total | 23 | 100.00% | 2 | 100.00% |
void smp_call_function_single_interrupt(void)
{
irq_enter();
generic_smp_call_function_single_interrupt();
local_cpu_data().irq_call_count++;
irq_exit();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Hellstrom | 22 | 100.00% | 1 | 100.00% |
Total | 22 | 100.00% | 1 | 100.00% |
void smp_call_function_interrupt(void)
{
irq_enter();
generic_smp_call_function_interrupt();
local_cpu_data().irq_call_count++;
irq_exit();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Daniel Hellstrom | 22 | 100.00% | 1 | 100.00% |
Total | 22 | 100.00% | 1 | 100.00% |
int setup_profiling_timer(unsigned int multiplier)
{
return -EINVAL;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 13 | 100.00% | 1 | 100.00% |
Total | 13 | 100.00% | 1 | 100.00% |
void __init smp_prepare_cpus(unsigned int max_cpus)
{
int i, cpuid, extra;
printk("Entering SMP Mode...\n");
extra = 0;
for (i = 0; !cpu_find_by_instance(i, NULL, &cpuid); i++) {
if (cpuid >= NR_CPUS)
extra++;
}
/* i = number of cpus */
if (extra && max_cpus > i - extra)
printk("Warning: NR_CPUS is too low to start all cpus\n");
smp_store_cpu_info(boot_cpu_id);
switch(sparc_cpu_model) {
case sun4m:
smp4m_boot_cpus();
break;
case sun4d:
smp4d_boot_cpus();
break;
case sparc_leon:
leon_boot_cpus();
break;
case sun4e:
printk("SUN4E\n");
BUG();
break;
case sun4u:
printk("SUN4U\n");
BUG();
break;
default:
printk("UNKNOWN!\n");
BUG();
break;
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Bob Breuer | 74 | 53.24% | 2 | 33.33% |
Raymond Burns | 51 | 36.69% | 1 | 16.67% |
Konrad Eisele | 7 | 5.04% | 1 | 16.67% |
Keith M. Wesolowski | 6 | 4.32% | 1 | 16.67% |
Linus Torvalds | 1 | 0.72% | 1 | 16.67% |
Total | 139 | 100.00% | 6 | 100.00% |
/* Set this up early so that things like the scheduler can init
* properly. We use the same cpu mask for both the present and
* possible cpu map.
*/
void __init smp_setup_cpu_possible_map(void)
{
int instance, mid;
instance = 0;
while (!cpu_find_by_instance(instance, NULL, &mid)) {
if (mid < NR_CPUS) {
set_cpu_possible(mid, true);
set_cpu_present(mid, true);
}
instance++;
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Bob Breuer | 53 | 92.98% | 1 | 50.00% |
Rusty Russell | 4 | 7.02% | 1 | 50.00% |
Total | 57 | 100.00% | 2 | 100.00% |
void __init smp_prepare_boot_cpu(void)
{
int cpuid = hard_smp_processor_id();
if (cpuid >= NR_CPUS) {
prom_printf("Serious problem, boot cpu id >= NR_CPUS\n");
prom_halt();
}
if (cpuid != 0)
printk("boot cpu id != 0, this could work but is untested\n");
current_thread_info()->cpu = cpuid;
set_cpu_online(cpuid, true);
set_cpu_possible(cpuid, true);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Bob Breuer | 37 | 59.68% | 2 | 40.00% |
Keith M. Wesolowski | 20 | 32.26% | 1 | 20.00% |
Rusty Russell | 4 | 6.45% | 1 | 20.00% |
Linus Torvalds | 1 | 1.61% | 1 | 20.00% |
Total | 62 | 100.00% | 5 | 100.00% |
int __cpu_up(unsigned int cpu, struct task_struct *tidle)
{
int ret=0;
switch(sparc_cpu_model) {
case sun4m:
ret = smp4m_boot_one_cpu(cpu, tidle);
break;
case sun4d:
ret = smp4d_boot_one_cpu(cpu, tidle);
break;
case sparc_leon:
ret = leon_boot_one_cpu(cpu, tidle);
break;
case sun4e:
printk("SUN4E\n");
BUG();
break;
case sun4u:
printk("SUN4U\n");
BUG();
break;
default:
printk("UNKNOWN!\n");
BUG();
break;
}
if (!ret) {
cpumask_set_cpu(cpu, &smp_commenced_mask);
while (!cpu_online(cpu))
mb();
}
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Raymond Burns | 57 | 44.88% | 1 | 14.29% |
Bob Breuer | 34 | 26.77% | 1 | 14.29% |
Keith M. Wesolowski | 12 | 9.45% | 1 | 14.29% |
Konrad Eisele | 11 | 8.66% | 1 | 14.29% |
Thomas Gleixner | 11 | 8.66% | 2 | 28.57% |
Motohiro Kosaki | 2 | 1.57% | 1 | 14.29% |
Total | 127 | 100.00% | 7 | 100.00% |
static void arch_cpu_pre_starting(void *arg)
{
local_ops->cache_all();
local_ops->tlb_all();
switch(sparc_cpu_model) {
case sun4m:
sun4m_cpu_pre_starting(arg);
break;
case sun4d:
sun4d_cpu_pre_starting(arg);
break;
case sparc_leon:
leon_cpu_pre_starting(arg);
break;
default:
BUG();
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sam Ravnborg | 57 | 100.00% | 2 | 100.00% |
Total | 57 | 100.00% | 2 | 100.00% |
static void arch_cpu_pre_online(void *arg)
{
unsigned int cpuid = hard_smp_processor_id();
register_percpu_ce(cpuid);
calibrate_delay();
smp_store_cpu_info(cpuid);
local_ops->cache_all();
local_ops->tlb_all();
switch(sparc_cpu_model) {
case sun4m:
sun4m_cpu_pre_online(arg);
break;
case sun4d:
sun4d_cpu_pre_online(arg);
break;
case sparc_leon:
leon_cpu_pre_online(arg);
break;
default:
BUG();
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sam Ravnborg | 77 | 100.00% | 2 | 100.00% |
Total | 77 | 100.00% | 2 | 100.00% |
static void sparc_start_secondary(void *arg)
{
unsigned int cpu;
/*
* SMP booting is extremely fragile in some architectures. So run
* the cpu initialization code first before anything else.
*/
arch_cpu_pre_starting(arg);
preempt_disable();
cpu = smp_processor_id();
notify_cpu_starting(cpu);
arch_cpu_pre_online(arg);
/* Set the CPU in the cpu_online_mask */
set_cpu_online(cpu, true);
/* Enable local interrupts now */
local_irq_enable();
wmb();
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
/* We should never reach here! */
BUG();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sam Ravnborg | 61 | 98.39% | 3 | 75.00% |
Thomas Gleixner | 1 | 1.61% | 1 | 25.00% |
Total | 62 | 100.00% | 4 | 100.00% |
void smp_callin(void)
{
sparc_start_secondary(NULL);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sam Ravnborg | 12 | 100.00% | 1 | 100.00% |
Total | 12 | 100.00% | 1 | 100.00% |
void smp_bogo(struct seq_file *m)
{
int i;
for_each_online_cpu(i) {
seq_printf(m,
"Cpu%dBogo\t: %lu.%02lu\n",
i,
cpu_data(i).udelay_val/(500000/HZ),
(cpu_data(i).udelay_val/(5000/HZ))%100);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 41 | 70.69% | 2 | 40.00% |
Keith M. Wesolowski | 8 | 13.79% | 1 | 20.00% |
Linus Torvalds | 6 | 10.34% | 1 | 20.00% |
Andrew Morton | 3 | 5.17% | 1 | 20.00% |
Total | 58 | 100.00% | 5 | 100.00% |
void smp_info(struct seq_file *m)
{
int i;
seq_printf(m, "State:\n");
for_each_online_cpu(i)
seq_printf(m, "CPU%d\t\t: online\n", i);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 15 | 45.45% | 1 | 25.00% |
Keith M. Wesolowski | 9 | 27.27% | 1 | 25.00% |
Linus Torvalds | 7 | 21.21% | 1 | 25.00% |
Andrew Morton | 2 | 6.06% | 1 | 25.00% |
Total | 33 | 100.00% | 4 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Bob Breuer | 264 | 22.04% | 3 | 6.67% |
Sam Ravnborg | 263 | 21.95% | 6 | 13.33% |
Linus Torvalds (pre-git) | 186 | 15.53% | 15 | 33.33% |
Raymond Burns | 158 | 13.19% | 1 | 2.22% |
Keith M. Wesolowski | 124 | 10.35% | 3 | 6.67% |
Daniel Hellstrom | 91 | 7.60% | 1 | 2.22% |
Konrad Eisele | 28 | 2.34% | 1 | 2.22% |
Linus Torvalds | 24 | 2.00% | 2 | 4.44% |
Pete Zaitcev | 13 | 1.09% | 1 | 2.22% |
Thomas Gleixner | 12 | 1.00% | 3 | 6.67% |
Rusty Russell | 12 | 1.00% | 2 | 4.44% |
David S. Miller | 10 | 0.83% | 1 | 2.22% |
Andrew Morton | 5 | 0.42% | 1 | 2.22% |
Al Viro | 3 | 0.25% | 1 | 2.22% |
Motohiro Kosaki | 2 | 0.17% | 1 | 2.22% |
Arun Sharma | 1 | 0.08% | 1 | 2.22% |
Hans Wennborg | 1 | 0.08% | 1 | 2.22% |
Greg Kroah-Hartman | 1 | 0.08% | 1 | 2.22% |
Paul Gortmaker | | 0.00% | 0 | 0.00% |
Total | 1198 | 100.00% | 45 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.