arm64: Add this_cpu_ptr() assembler macro for use in entry.S
authorJames Morse <james.morse@arm.com>
Thu, 10 Dec 2015 10:22:39 +0000 (10:22 +0000)
committerWill Deacon <will.deacon@arm.com>
Thu, 10 Dec 2015 12:08:09 +0000 (12:08 +0000)
irq_stack is a per_cpu variable, that needs to be access from entry.S.
Use an assembler macro instead of the unreadable details.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/assembler.h
arch/arm64/kernel/entry.S

index 12eff928ef8b38dd18ae3bd157b12eb918f797a6..bb7b72734c24ae5f5572d2b01c70900abe99abcf 100644 (file)
@@ -193,6 +193,17 @@ lr .req    x30             // link register
        str     \src, [\tmp, :lo12:\sym]
        .endm
 
+       /*
+        * @sym: The name of the per-cpu variable
+        * @reg: Result of per_cpu(sym, smp_processor_id())
+        * @tmp: scratch register
+        */
+       .macro this_cpu_ptr, sym, reg, tmp
+       adr_l   \reg, \sym
+       mrs     \tmp, tpidr_el1
+       add     \reg, \reg, \tmp
+       .endm
+
 /*
  * Annotate a function as position independent, i.e., safe to be called before
  * the kernel virtual mapping is activated.
index be7ec544b540c58f15f4210538a47f0685dec8e3..e394f8c9595a493f00c083f1d0733ad1fdca5a27 100644 (file)
@@ -179,9 +179,7 @@ alternative_endif
        .macro  irq_stack_entry, dummy_lr
        mov     x19, sp                 // preserve the original sp
 
-       adr_l   x25, irq_stack
-       mrs     x26, tpidr_el1
-       add     x25, x25, x26
+       this_cpu_ptr irq_stack, x25, x26
 
        /*
         * Check the lowest address on irq_stack for the irq_count value,