xref: /linux/arch/s390/kernel/vdso64/getcpu.c (revision 40d269c000bda9fcd276a0412a9cebd3f6e344c5)
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 	union tod_clock clk;
12 
13 	/* CPU number is stored in the programmable field of the TOD clock */
14 	store_tod_clock_ext(&clk);
15 	if (cpu)
16 		*cpu = clk.pf;
17 	/* NUMA node is always zero */
18 	if (node)
19 		*node = 0;
20 	return 0;
21 }
22