xref: /openbmc/linux/arch/s390/kernel/vdso64/getcpu.c (revision 301a1613)
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 #include "vdso.h"
8 
9 int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
10 {
11 	__u16 todval[8];
12 
13 	/* CPU number is stored in the programmable field of the TOD clock */
14 	get_tod_clock_ext((char *)todval);
15 	if (cpu)
16 		*cpu = todval[7];
17 	/* NUMA node is always zero */
18 	if (node)
19 		*node = 0;
20 	return 0;
21 }
22