Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #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 Russell | dd17c8f | 2009-10-29 22:34:15 +0900 | [diff] [blame] | 12 | # define THIS_CPU(var) (var) /* use this to mark accesses to per-CPU variables... */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #else /* !__ASSEMBLY__ */ |
| 14 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
| 16 | #include <linux/threads.h> |
| 17 | |
Ingo Molnar | ab6e14b | 2008-01-30 23:27:58 +0100 | [diff] [blame] | 18 | #ifdef CONFIG_SMP |
| 19 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #ifdef HAVE_MODEL_SMALL_ATTRIBUTE |
travis@sgi.com | 5280e00 | 2008-01-30 13:32:52 +0100 | [diff] [blame] | 21 | # define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__))) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #endif |
| 23 | |
travis@sgi.com | 05991be | 2008-01-30 23:27:58 +0100 | [diff] [blame] | 24 | #define __my_cpu_offset __ia64_per_cpu_var(local_per_cpu_offset) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | extern void *per_cpu_init(void); |
| 27 | |
| 28 | #else /* ! SMP */ |
| 29 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #define per_cpu_init() (__phys_per_cpu_start) |
| 31 | |
| 32 | #endif /* SMP */ |
| 33 | |
Denys Vlasenko | 3d9a854 | 2010-02-20 01:03:43 +0100 | [diff] [blame] | 34 | #define PER_CPU_BASE_SECTION ".data..percpu" |
Brian Gerst | d377044 | 2009-02-08 09:58:38 -0500 | [diff] [blame] | 35 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | /* |
| 37 | * Be extremely careful when taking the address of this variable! Due to virtual |
Christoph Lameter | 87b4bf6 | 2014-12-02 11:22:07 -0800 | [diff] [blame] | 38 | * remapping, it is different from the canonical address returned by this_cpu_ptr(&var)! |
| 39 | * On the positive side, using __ia64_per_cpu_var() instead of this_cpu_ptr() is slightly |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | * more efficient. |
| 41 | */ |
Tejun Heo | 308eb7a | 2010-05-12 12:10:39 +0200 | [diff] [blame] | 42 | #define __ia64_per_cpu_var(var) (*({ \ |
| 43 | __verify_pcpu_ptr(&(var)); \ |
| 44 | ((typeof(var) __kernel __force *)&(var)); \ |
| 45 | })) |
travis@sgi.com | 05991be | 2008-01-30 23:27:58 +0100 | [diff] [blame] | 46 | |
| 47 | #include <asm-generic/percpu.h> |
| 48 | |
| 49 | /* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */ |
| 50 | DECLARE_PER_CPU(unsigned long, local_per_cpu_offset); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
| 52 | #endif /* !__ASSEMBLY__ */ |
| 53 | |
| 54 | #endif /* _ASM_IA64_PERCPU_H */ |