2020-11-16 08:06:41 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/* Copyright IBM Corp. 2020 */
|
|
|
|
|
|
|
|
#include <linux/compiler.h>
|
|
|
|
#include <linux/getcpu.h>
|
|
|
|
#include <asm/timex.h>
|
2020-11-24 14:02:35 +01:00
|
|
|
#include "vdso.h"
|
2020-11-16 08:06:41 +01:00
|
|
|
|
|
|
|
int __s390_vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
|
|
|
|
{
|
2021-02-08 16:16:28 +01:00
|
|
|
union tod_clock clk;
|
2020-11-16 08:06:41 +01:00
|
|
|
|
|
|
|
/* CPU number is stored in the programmable field of the TOD clock */
|
2021-02-08 16:16:28 +01:00
|
|
|
store_tod_clock_ext(&clk);
|
2020-11-16 08:06:41 +01:00
|
|
|
if (cpu)
|
2021-02-08 16:16:28 +01:00
|
|
|
*cpu = clk.pf;
|
2020-11-16 08:06:41 +01:00
|
|
|
/* NUMA node is always zero */
|
|
|
|
if (node)
|
|
|
|
*node = 0;
|
|
|
|
return 0;
|
|
|
|
}
|