percpu.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef __ARCH_S390_PERCPU__
  2. #define __ARCH_S390_PERCPU__
  3. #include <linux/compiler.h>
  4. #include <asm/lowcore.h>
  5. /*
  6. * s390 uses its own implementation for per cpu data, the offset of
  7. * the cpu local data area is cached in the cpu's lowcore memory.
  8. * For 64 bit module code s390 forces the use of a GOT slot for the
  9. * address of the per cpu variable. This is needed because the module
  10. * may be more than 4G above the per cpu area.
  11. */
  12. #if defined(__s390x__) && defined(MODULE)
  13. #define SHIFT_PERCPU_PTR(ptr,offset) (({ \
  14. extern int simple_identifier_##var(void); \
  15. unsigned long *__ptr; \
  16. asm ( "larl %0, %1@GOTENT" \
  17. : "=a" (__ptr) : "X" (ptr) ); \
  18. (typeof(ptr))((*__ptr) + (offset)); }))
  19. #else
  20. #define SHIFT_PERCPU_PTR(ptr, offset) (({ \
  21. extern int simple_identifier_##var(void); \
  22. unsigned long __ptr; \
  23. asm ( "" : "=a" (__ptr) : "0" (ptr) ); \
  24. (typeof(ptr)) (__ptr + (offset)); }))
  25. #endif
  26. #define __my_cpu_offset S390_lowcore.percpu_offset
  27. #include <asm-generic/percpu.h>
  28. #endif /* __ARCH_S390_PERCPU__ */