diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2020-11-16 08:06:41 +0100 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2020-11-23 12:01:13 +0100 |
commit | 80f06306240e0ad1c75116111be11950474dfda7 (patch) | |
tree | 99ed304a1c6d26ad408145ba98b83d9fbf807b7f /arch/s390/kernel/vdso64/getcpu.c | |
parent | 062e527956d05fae02f143c0d5ff9e8525c6799f (diff) |
s390/vdso: reimplement getcpu vdso syscall
Implement the previously removed getcpu vdso syscall by using the
TOD programmable field to pass the cpu number to user space.
Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/kernel/vdso64/getcpu.c')
-rw-r--r-- | arch/s390/kernel/vdso64/getcpu.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/s390/kernel/vdso64/getcpu.c b/arch/s390/kernel/vdso64/getcpu.c new file mode 100644 index 000000000000..a5da7a9eb43d --- /dev/null +++ b/arch/s390/kernel/vdso64/getcpu.c @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright IBM Corp. 2020 */ + +#include <linux/compiler.h> +#include <linux/getcpu.h> +#include <asm/timex.h> + +int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) +{ + __u16 todval[8]; + + /* CPU number is stored in the programmable field of the TOD clock */ + get_tod_clock_ext((char *)todval); + if (cpu) + *cpu = todval[7]; + /* NUMA node is always zero */ + if (node) + *node = 0; + return 0; +} |