getcpu.c 467 B

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