summaryrefslogtreecommitdiff
path: root/arch/s390/include/asm/percpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/include/asm/percpu.h')
-rw-r--r--arch/s390/include/asm/percpu.h33
1 files changed, 21 insertions, 12 deletions
diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h
index 84f6b8357b45..b18a96f3a334 100644
--- a/arch/s390/include/asm/percpu.h
+++ b/arch/s390/include/asm/percpu.h
@@ -12,14 +12,23 @@
*/
#define __my_cpu_offset get_lowcore()->percpu_offset
-/*
- * For 64 bit module code, the module may be more than 4G above the
- * per cpu area, use weak definitions to force the compiler to
- * generate external references.
- */
-#if defined(MODULE)
-#define ARCH_NEEDS_WEAK_PER_CPU
-#endif
+#define arch_raw_cpu_ptr(_ptr) \
+({ \
+ unsigned long lc_percpu, tcp_ptr__; \
+ \
+ tcp_ptr__ = (__force unsigned long)(_ptr); \
+ lc_percpu = offsetof(struct lowcore, percpu_offset); \
+ asm_inline volatile( \
+ ALTERNATIVE("ag %[__ptr__],%[offzero](%%r0)\n", \
+ "ag %[__ptr__],%[offalt](%%r0)\n", \
+ ALT_FEATURE(MFEATURE_LOWCORE)) \
+ : [__ptr__] "+d" (tcp_ptr__) \
+ : [offzero] "i" (lc_percpu), \
+ [offalt] "i" (lc_percpu + LOWCORE_ALT_ADDRESS), \
+ "m" (((struct lowcore *)0)->percpu_offset) \
+ : "cc"); \
+ (TYPEOF_UNQUAL(*(_ptr)) __force __kernel *)tcp_ptr__; \
+})
/*
* We use a compare-and-swap loop since that uses less cpu cycles than
@@ -74,13 +83,13 @@
if (__builtin_constant_p(val__) && \
((szcast)val__ > -129) && ((szcast)val__ < 128)) { \
asm volatile( \
- op2 " %[ptr__],%[val__]\n" \
+ op2 " %[ptr__],%[val__]" \
: [ptr__] "+Q" (*ptr__) \
: [val__] "i" ((szcast)val__) \
: "cc"); \
} else { \
asm volatile( \
- op1 " %[old__],%[val__],%[ptr__]\n" \
+ op1 " %[old__],%[val__],%[ptr__]" \
: [old__] "=d" (old__), [ptr__] "+Q" (*ptr__) \
: [val__] "d" (val__) \
: "cc"); \
@@ -99,7 +108,7 @@
preempt_disable_notrace(); \
ptr__ = raw_cpu_ptr(&(pcp)); \
asm volatile( \
- op " %[old__],%[val__],%[ptr__]\n" \
+ op " %[old__],%[val__],%[ptr__]" \
: [old__] "=d" (old__), [ptr__] "+Q" (*ptr__) \
: [val__] "d" (val__) \
: "cc"); \
@@ -118,7 +127,7 @@
preempt_disable_notrace(); \
ptr__ = raw_cpu_ptr(&(pcp)); \
asm volatile( \
- op " %[old__],%[val__],%[ptr__]\n" \
+ op " %[old__],%[val__],%[ptr__]" \
: [old__] "=d" (old__), [ptr__] "+Q" (*ptr__) \
: [val__] "d" (val__) \
: "cc"); \