xref: /openbmc/linux/arch/s390/kernel/vdso64/getcpu.c (revision 80f06306)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright IBM Corp. 2020 */
3 
4 #include <linux/compiler.h>
5 #include <linux/getcpu.h>
6 #include <asm/timex.h>
7 
8 int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
9 {
10 	__u16 todval[8];
11 
12 	/* CPU number is stored in the programmable field of the TOD clock */
13 	get_tod_clock_ext((char *)todval);
14 	if (cpu)
15 		*cpu = todval[7];
16 	/* NUMA node is always zero */
17 	if (node)
18 		*node = 0;
19 	return 0;
20 }
21