percpu.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_IA64_PERCPU_H
  3. #define _ASM_IA64_PERCPU_H
  4. /*
  5. * Copyright (C) 2002-2003 Hewlett-Packard Co
  6. * David Mosberger-Tang <davidm@hpl.hp.com>
  7. */
  8. #ifdef __ASSEMBLY__
  9. # define THIS_CPU(var) (var) /* use this to mark accesses to per-CPU variables... */
  10. #else /* !__ASSEMBLY__ */
  11. #include <linux/threads.h>
  12. #ifdef CONFIG_SMP
  13. #ifdef HAVE_MODEL_SMALL_ATTRIBUTE
  14. # define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__)))
  15. #endif
  16. #define __my_cpu_offset __ia64_per_cpu_var(local_per_cpu_offset)
  17. extern void *per_cpu_init(void);
  18. #else /* ! SMP */
  19. #define per_cpu_init() (__phys_per_cpu_start)
  20. #endif /* SMP */
  21. #define PER_CPU_BASE_SECTION ".data..percpu"
  22. /*
  23. * Be extremely careful when taking the address of this variable! Due to virtual
  24. * remapping, it is different from the canonical address returned by this_cpu_ptr(&var)!
  25. * On the positive side, using __ia64_per_cpu_var() instead of this_cpu_ptr() is slightly
  26. * more efficient.
  27. */
  28. #define __ia64_per_cpu_var(var) (*({ \
  29. __verify_pcpu_ptr(&(var)); \
  30. ((typeof(var) __kernel __force *)&(var)); \
  31. }))
  32. #include <asm-generic/percpu.h>
  33. /* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
  34. DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
  35. #endif /* !__ASSEMBLY__ */
  36. #endif /* _ASM_IA64_PERCPU_H */