blob: f357b9bb3576a109da86ef589dd76e9f262279f0 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#ifndef _ASM_IA64_PERCPU_H
3#define _ASM_IA64_PERCPU_H
4
5/*
6 * Copyright (C) 2002-2003 Hewlett-Packard Co
7 * David Mosberger-Tang <davidm@hpl.hp.com>
8 */
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#ifdef __ASSEMBLY__
Rusty Russelldd17c8f2009-10-29 22:34:15 +090011# define THIS_CPU(var) (var) /* use this to mark accesses to per-CPU variables... */
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#else /* !__ASSEMBLY__ */
13
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
15#include <linux/threads.h>
16
Ingo Molnarab6e14b2008-01-30 23:27:58 +010017#ifdef CONFIG_SMP
18
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#ifdef HAVE_MODEL_SMALL_ATTRIBUTE
travis@sgi.com5280e002008-01-30 13:32:52 +010020# define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__)))
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#endif
22
travis@sgi.com05991be2008-01-30 23:27:58 +010023#define __my_cpu_offset __ia64_per_cpu_var(local_per_cpu_offset)
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Linus Torvalds1da177e2005-04-16 15:20:36 -070025extern void *per_cpu_init(void);
26
27#else /* ! SMP */
28
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#define per_cpu_init() (__phys_per_cpu_start)
30
31#endif /* SMP */
32
Denys Vlasenko3d9a8542010-02-20 01:03:43 +010033#define PER_CPU_BASE_SECTION ".data..percpu"
Brian Gerstd3770442009-02-08 09:58:38 -050034
Linus Torvalds1da177e2005-04-16 15:20:36 -070035/*
36 * Be extremely careful when taking the address of this variable! Due to virtual
Christoph Lameter87b4bf62014-12-02 11:22:07 -080037 * remapping, it is different from the canonical address returned by this_cpu_ptr(&var)!
38 * On the positive side, using __ia64_per_cpu_var() instead of this_cpu_ptr() is slightly
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 * more efficient.
40 */
Tejun Heo308eb7a2010-05-12 12:10:39 +020041#define __ia64_per_cpu_var(var) (*({ \
42 __verify_pcpu_ptr(&(var)); \
43 ((typeof(var) __kernel __force *)&(var)); \
44}))
travis@sgi.com05991be2008-01-30 23:27:58 +010045
46#include <asm-generic/percpu.h>
47
48/* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
49DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
51#endif /* !__ASSEMBLY__ */
52
53#endif /* _ASM_IA64_PERCPU_H */