5b2bc7494d5b3ce26919a8cebd139a5ee279dc6e
[linux-2.6-microblaze.git] / arch / s390 / kernel / vdso64 / getcpu.c
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 }