blob: b9295793a5e24b3f7aa6c4df05b8228977d9c35c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASM_IA64_PERCPU_H
2#define _ASM_IA64_PERCPU_H
3
4/*
5 * Copyright (C) 2002-2003 Hewlett-Packard Co
6 * David Mosberger-Tang <davidm@hpl.hp.com>
7 */
8
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#ifdef __ASSEMBLY__
Rusty Russelldd17c8f2009-10-29 22:34:15 +090010# define THIS_CPU(var) (var) /* use this to mark accesses to per-CPU variables... */
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#else /* !__ASSEMBLY__ */
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
14#include <linux/threads.h>
15
Ingo Molnarab6e14b2008-01-30 23:27:58 +010016#ifdef CONFIG_SMP
17
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#ifdef HAVE_MODEL_SMALL_ATTRIBUTE
travis@sgi.com5280e002008-01-30 13:32:52 +010019# define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__)))
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#endif
21
travis@sgi.com05991be2008-01-30 23:27:58 +010022#define __my_cpu_offset __ia64_per_cpu_var(local_per_cpu_offset)
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Linus Torvalds1da177e2005-04-16 15:20:36 -070024extern void *per_cpu_init(void);
25
26#else /* ! SMP */
27
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#define per_cpu_init() (__phys_per_cpu_start)
29
30#endif /* SMP */
31
Denys Vlasenko3d9a8542010-02-20 01:03:43 +010032#define PER_CPU_BASE_SECTION ".data..percpu"
Brian Gerstd3770442009-02-08 09:58:38 -050033
Linus Torvalds1da177e2005-04-16 15:20:36 -070034/*
35 * Be extremely careful when taking the address of this variable! Due to virtual
Christoph Lameter87b4bf62014-12-02 11:22:07 -080036 * remapping, it is different from the canonical address returned by this_cpu_ptr(&var)!
37 * On the positive side, using __ia64_per_cpu_var() instead of this_cpu_ptr() is slightly
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 * more efficient.
39 */
Tejun Heo308eb7a2010-05-12 12:10:39 +020040#define __ia64_per_cpu_var(var) (*({ \
41 __verify_pcpu_ptr(&(var)); \
42 ((typeof(var) __kernel __force *)&(var)); \
43}))
travis@sgi.com05991be2008-01-30 23:27:58 +010044
45#include <asm-generic/percpu.h>
46
47/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
48DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
50#endif /* !__ASSEMBLY__ */
51
52#endif /* _ASM_IA64_PERCPU_H */