blob: 14aa1c58912b6ff70a62d35f77c052fa80ee2930 [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
9#define PERCPU_ENOUGH_ROOM PERCPU_PAGE_SIZE
10
11#ifdef __ASSEMBLY__
Rusty Russelldd17c8f2009-10-29 22:34:15 +090012# define THIS_CPU(var) (var) /* use this to mark accesses to per-CPU variables... */
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#else /* !__ASSEMBLY__ */
14
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
16#include <linux/threads.h>
17
Ingo Molnarab6e14b2008-01-30 23:27:58 +010018#ifdef CONFIG_SMP
19
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#ifdef HAVE_MODEL_SMALL_ATTRIBUTE
travis@sgi.com5280e002008-01-30 13:32:52 +010021# define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__)))
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#endif
23
travis@sgi.com05991be2008-01-30 23:27:58 +010024#define __my_cpu_offset __ia64_per_cpu_var(local_per_cpu_offset)
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
Linus Torvalds1da177e2005-04-16 15:20:36 -070026extern void *per_cpu_init(void);
27
28#else /* ! SMP */
29
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#define per_cpu_init() (__phys_per_cpu_start)
31
32#endif /* SMP */
33
Denys Vlasenko3d9a8542010-02-20 01:03:43 +010034#define PER_CPU_BASE_SECTION ".data..percpu"
Brian Gerstd3770442009-02-08 09:58:38 -050035
Linus Torvalds1da177e2005-04-16 15:20:36 -070036/*
37 * Be extremely careful when taking the address of this variable! Due to virtual
38 * remapping, it is different from the canonical address returned by __get_cpu_var(var)!
39 * On the positive side, using __ia64_per_cpu_var() instead of __get_cpu_var() is slightly
40 * more efficient.
41 */
Tejun Heo308eb7a2010-05-12 12:10:39 +020042#define __ia64_per_cpu_var(var) (*({ \
43 __verify_pcpu_ptr(&(var)); \
44 ((typeof(var) __kernel __force *)&(var)); \
45}))
travis@sgi.com05991be2008-01-30 23:27:58 +010046
47#include <asm-generic/percpu.h>
48
49/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
50DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
52#endif /* !__ASSEMBLY__ */
53
54#endif /* _ASM_IA64_PERCPU_H */