xref: /linux/arch/s390/kernel/vdso/getcpu.c (revision 69050f8d6d075dc01af7a5f2f550a8067510366f)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright IBM Corp. 2020 */
3 
4 #include <linux/compiler.h>
5 #include <asm/timex.h>
6 #include "vdso.h"
7 
8 int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, void *unused)
9 {
10 	union tod_clock clk;
11 
12 	/* CPU number is stored in the programmable field of the TOD clock */
13 	store_tod_clock_ext(&clk);
14 	if (cpu)
15 		*cpu = clk.pf;
16 	/* NUMA node is always zero */
17 	if (node)
18 		*node = 0;
19 	return 0;
20 }
21