Release 4.14 arch/s390/kernel/processor.c
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright IBM Corp. 2008
* Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
*/
#define KMSG_COMPONENT "cpu"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/cpufeature.h>
#include <linux/bitops.h>
#include <linux/kernel.h>
#include <linux/sched/mm.h>
#include <linux/init.h>
#include <linux/seq_file.h>
#include <linux/mm_types.h>
#include <linux/delay.h>
#include <linux/cpu.h>
#include <asm/diag.h>
#include <asm/facility.h>
#include <asm/elf.h>
#include <asm/lowcore.h>
#include <asm/param.h>
#include <asm/smp.h>
struct cpu_info {
unsigned int cpu_mhz_dynamic;
unsigned int cpu_mhz_static;
struct cpuid cpu_id;
};
static DEFINE_PER_CPU(struct cpu_info, cpu_info);
static bool machine_has_cpu_mhz;
void __init cpu_detect_mhz_feature(void)
{
if (test_facility(34) && __ecag(ECAG_CPU_ATTRIBUTE, 0) != -1UL)
machine_has_cpu_mhz = true;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Heiko Carstens | 29 | 100.00% | 2 | 100.00% |
Total | 29 | 100.00% | 2 | 100.00% |
static void update_cpu_mhz(void *arg)
{
unsigned long mhz;
struct cpu_info *c;
mhz = __ecag(ECAG_CPU_ATTRIBUTE, 0);
c = this_cpu_ptr(&cpu_info);
c->cpu_mhz_dynamic = mhz >> 32;
c->cpu_mhz_static = mhz & 0xffffffff;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Heiko Carstens | 52 | 100.00% | 1 | 100.00% |
Total | 52 | 100.00% | 1 | 100.00% |
void s390_update_cpu_mhz(void)
{
s390_adjust_jiffies();
if (machine_has_cpu_mhz)
on_each_cpu(update_cpu_mhz, NULL, 0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Heiko Carstens | 23 | 100.00% | 1 | 100.00% |
Total | 23 | 100.00% | 1 | 100.00% |
void notrace cpu_relax_yield(void)
{
if (!smp_cpu_mtid && MACHINE_HAS_DIAG44) {
diag_stat_inc(DIAG_STAT_X044);
asm volatile("diag 0,0,0x44");
}
barrier();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Heiko Carstens | 20 | 71.43% | 2 | 50.00% |
Martin Schwidefsky | 7 | 25.00% | 1 | 25.00% |
Christian Bornträger | 1 | 3.57% | 1 | 25.00% |
Total | 28 | 100.00% | 4 | 100.00% |
EXPORT_SYMBOL(cpu_relax_yield);
/*
* cpu_init - initializes state that is per-CPU.
*/
void cpu_init(void)
{
struct cpuid *id = this_cpu_ptr(&cpu_info.cpu_id);
get_cpu_id(id);
if (machine_has_cpu_mhz)
update_cpu_mhz(NULL);
mmgrab(&init_mm);
current->active_mm = &init_mm;
BUG_ON(current->mm);
enter_lazy_tlb(&init_mm, current);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Schwidefsky | 40 | 64.52% | 1 | 16.67% |
Heiko Carstens | 19 | 30.65% | 3 | 50.00% |
Christoph Lameter | 2 | 3.23% | 1 | 16.67% |
Vegard Nossum | 1 | 1.61% | 1 | 16.67% |
Total | 62 | 100.00% | 6 | 100.00% |
/*
* cpu_have_feature - Test CPU features on module initialization
*/
int cpu_have_feature(unsigned int num)
{
return elf_hwcap & (1UL << num);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Hendrik Brueckner | 18 | 100.00% | 1 | 100.00% |
Total | 18 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(cpu_have_feature);
static void show_facilities(struct seq_file *m)
{
unsigned int bit;
long *facilities;
facilities = (long *)&S390_lowcore.stfle_fac_list;
seq_puts(m, "facilities :");
for_each_set_bit_inv(bit, facilities, MAX_FACILITY_BIT)
seq_printf(m, " %d", bit);
seq_putc(m, '\n');
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Heiko Carstens | 61 | 100.00% | 1 | 100.00% |
Total | 61 | 100.00% | 1 | 100.00% |
static void show_cpu_summary(struct seq_file *m, void *v)
{
static const char *hwcap_str[] = {
"esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp",
"edat", "etf3eh", "highgprs", "te", "vx", "vxd", "vxe", "gs"
};
static const char * const int_hwcap_str[] = {
"sie"
};
int i, cpu;
seq_printf(m, "vendor_id : IBM/S390\n"
"# processors : %i\n"
"bogomips per cpu: %lu.%02lu\n",
num_online_cpus(), loops_per_jiffy/(500000/HZ),
(loops_per_jiffy/(5000/HZ))%100);
seq_printf(m, "max thread id : %d\n", smp_cpu_mtid);
seq_puts(m, "features\t: ");
for (i = 0; i < ARRAY_SIZE(hwcap_str); i++)
if (hwcap_str[i] && (elf_hwcap & (1UL << i)))
seq_printf(m, "%s ", hwcap_str[i]);
for (i = 0; i < ARRAY_SIZE(int_hwcap_str); i++)
if (int_hwcap_str[i] && (int_hwcap & (1UL << i)))
seq_printf(m, "%s ", int_hwcap_str[i]);
seq_puts(m, "\n");
show_facilities(m);
show_cacheinfo(m);
for_each_online_cpu(cpu) {
struct cpuid *id = &per_cpu(cpu_info.cpu_id, cpu);
seq_printf(m, "processor %d: "
"version = %02X, "
"identification = %06X, "
"machine = %04X\n",
cpu, id->version, id->ident, id->machine);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Schwidefsky | 174 | 64.21% | 6 | 40.00% |
David Hildenbrand | 57 | 21.03% | 1 | 6.67% |
Heiko Carstens | 36 | 13.28% | 6 | 40.00% |
Andreas Krebbel | 4 | 1.48% | 2 | 13.33% |
Total | 271 | 100.00% | 15 | 100.00% |
static void show_cpu_mhz(struct seq_file *m, unsigned long n)
{
struct cpu_info *c = per_cpu_ptr(&cpu_info, n);
seq_printf(m, "cpu MHz dynamic : %d\n", c->cpu_mhz_dynamic);
seq_printf(m, "cpu MHz static : %d\n", c->cpu_mhz_static);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Heiko Carstens | 50 | 100.00% | 1 | 100.00% |
Total | 50 | 100.00% | 1 | 100.00% |
/*
* show_cpuinfo - Get information on one CPU for use by procfs.
*/
static int show_cpuinfo(struct seq_file *m, void *v)
{
unsigned long n = (unsigned long) v - 1;
if (!n)
show_cpu_summary(m, v);
if (!machine_has_cpu_mhz)
return 0;
seq_printf(m, "\ncpu number : %ld\n", n);
show_cpu_mhz(m, n);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Heiko Carstens | 62 | 93.94% | 3 | 75.00% |
Martin Schwidefsky | 4 | 6.06% | 1 | 25.00% |
Total | 66 | 100.00% | 4 | 100.00% |
static inline void *c_update(loff_t *pos)
{
if (*pos)
*pos = cpumask_next(*pos - 1, cpu_online_mask);
return *pos < nr_cpu_ids ? (void *)*pos + 1 : NULL;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Schwidefsky | 27 | 57.45% | 2 | 66.67% |
Heiko Carstens | 20 | 42.55% | 1 | 33.33% |
Total | 47 | 100.00% | 3 | 100.00% |
static void *c_start(struct seq_file *m, loff_t *pos)
{
get_online_cpus();
return c_update(pos);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Heiko Carstens | 25 | 100.00% | 1 | 100.00% |
Total | 25 | 100.00% | 1 | 100.00% |
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
++*pos;
return c_update(pos);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Schwidefsky | 29 | 96.67% | 1 | 50.00% |
Heiko Carstens | 1 | 3.33% | 1 | 50.00% |
Total | 30 | 100.00% | 2 | 100.00% |
static void c_stop(struct seq_file *m, void *v)
{
put_online_cpus();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Schwidefsky | 13 | 72.22% | 1 | 50.00% |
Heiko Carstens | 5 | 27.78% | 1 | 50.00% |
Total | 18 | 100.00% | 2 | 100.00% |
const struct seq_operations cpuinfo_op = {
.start = c_start,
.next = c_next,
.stop = c_stop,
.show = show_cpuinfo,
};
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Heiko Carstens | 447 | 49.23% | 16 | 47.06% |
Martin Schwidefsky | 364 | 40.09% | 8 | 23.53% |
David Hildenbrand | 57 | 6.28% | 1 | 2.94% |
Hendrik Brueckner | 24 | 2.64% | 1 | 2.94% |
Ingo Molnar | 6 | 0.66% | 2 | 5.88% |
Andreas Krebbel | 4 | 0.44% | 2 | 5.88% |
Christoph Lameter | 2 | 0.22% | 1 | 2.94% |
Christian Bornträger | 2 | 0.22% | 1 | 2.94% |
Vegard Nossum | 1 | 0.11% | 1 | 2.94% |
Greg Kroah-Hartman | 1 | 0.11% | 1 | 2.94% |
Total | 908 | 100.00% | 34 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.