Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
109ab95
Documentation
arch
alpha
arc
arm
arm64
avr32
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
metag
microblaze
mips
mn10300
nios2
openrisc
parisc
powerpc
s390
appldata
boot
configs
crypto
hypfs
include
kernel
vdso32
vdso64
.gitignore
Makefile
asm-offsets.c
audit.c
audit.h
base.S
cache.c
compat_audit.c
compat_linux.c
compat_linux.h
compat_ptrace.h
compat_signal.c
compat_wrapper.c
cpcmd.c
crash_dump.c
debug.c
diag.c
dis.c
dumpstack.c
early.c
ebcdic.c
entry.S
entry.h
fpu.c
ftrace.c
head.S
head64.S
head_kdump.S
idle.c
ipl.c
irq.c
jump_label.c
kprobes.c
lgr.c
machine_kexec.c
mcount.S
module.c
nmi.c
os_info.c
perf_cpum_cf.c
perf_cpum_cf_events.c
perf_cpum_sf.c
perf_event.c
pgm_check.S
process.c
processor.c
ptrace.c
reipl.S
relocate_kernel.S
runtime_instr.c
s390_ksyms.c
sclp.c
setup.c
signal.c
smp.c
stacktrace.c
suspend.c
swsusp.S
sys_s390.c
syscalls.S
sysinfo.c
time.c
topology.c
trace.c
traps.c
uprobes.c
vdso.c
vmlinux.lds.S
vtime.c
kvm
lib
mm
net
numa
oprofile
pci
tools
Kbuild
Kconfig
Kconfig.debug
Makefile
defconfig
score
sh
sparc
tile
um
unicore32
x86
xtensa
.gitignore
Kconfig
block
certs
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.get_maintainer.ignore
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
arch
/
s390
/
kernel
/
processor.c
Blame
Blame
Latest commit
History
History
180 lines (155 loc) · 3.95 KB
Breadcrumbs
linux
/
arch
/
s390
/
kernel
/
processor.c
Top
File metadata and controls
Code
Blame
180 lines (155 loc) · 3.95 KB
Raw
/* * 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/kernel.h> #include <linux/init.h> #include <linux/seq_file.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 = 1; } 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; } void s390_update_cpu_mhz(void) { s390_adjust_jiffies(); if (machine_has_cpu_mhz) on_each_cpu(update_cpu_mhz, NULL, 0); } void notrace cpu_relax(void) { if (!smp_cpu_mtid && MACHINE_HAS_DIAG44) { diag_stat_inc(DIAG_STAT_X044); asm volatile("diag 0,0,0x44"); } barrier(); } EXPORT_SYMBOL(cpu_relax); /* * 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); atomic_inc(&init_mm.mm_count); current->active_mm = &init_mm; BUG_ON(current->mm); enter_lazy_tlb(&init_mm, current); } /* * cpu_have_feature - Test CPU features on module initialization */ int cpu_have_feature(unsigned int num) { return elf_hwcap & (1UL << num); } EXPORT_SYMBOL(cpu_have_feature); 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" }; 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_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_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); } } 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); } /* * 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; } 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; } static void *c_start(struct seq_file *m, loff_t *pos) { get_online_cpus(); return c_update(pos); } static void *c_next(struct seq_file *m, void *v, loff_t *pos) { ++*pos; return c_update(pos); } static void c_stop(struct seq_file *m, void *v) { put_online_cpus(); } const struct seq_operations cpuinfo_op = { .start = c_start, .next = c_next, .stop = c_stop, .show = show_cpuinfo, };
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
You can’t perform that action at this time.