Skip to content

Commit a9ea001

Browse files
mrutland-armctmarinas
authored andcommitted
arm64: factor out current_stack_pointer
We define current_stack_pointer in <asm/thread_info.h>, though other files and header relying upon it do not have this necessary include, and are thus fragile to changes in the header soup. Subsequent patches will affect the header soup such that directly including <asm/thread_info.h> may result in a circular header include in some of these cases, so we can't simply include <asm/thread_info.h>. Instead, factor current_thread_info into its own header, and have all existing users include this explicitly. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Laura Abbott <labbott@redhat.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 3fe12da commit a9ea001

7 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎arch/arm64/include/asm/percpu.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#ifndef __ASM_PERCPU_H
1717
#define __ASM_PERCPU_H
1818

19+
#include <asm/stack_pointer.h>
20+
1921
static inline void set_my_cpu_offset(unsigned long off)
2022
{
2123
asm volatile("msr tpidr_el1, %0" :: "r" (off) : "memory");

‎arch/arm64/include/asm/perf_event.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef __ASM_PERF_EVENT_H
1818
#define __ASM_PERF_EVENT_H
1919

20+
#include <asm/stack_pointer.h>
21+
2022
#define ARMV8_PMU_MAX_COUNTERS 32
2123
#define ARMV8_PMU_COUNTER_MASK (ARMV8_PMU_MAX_COUNTERS - 1)
2224

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ifndef __ASM_STACK_POINTER_H
2+
#define __ASM_STACK_POINTER_H
3+
4+
/*
5+
* how to get the current stack pointer from C
6+
*/
7+
register unsigned long current_stack_pointer asm ("sp");
8+
9+
#endif /* __ASM_STACK_POINTER_H */

‎arch/arm64/include/asm/thread_info.h‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
struct task_struct;
3838

39+
#include <asm/stack_pointer.h>
3940
#include <asm/types.h>
4041

4142
typedef unsigned long mm_segment_t;
@@ -61,11 +62,6 @@ struct thread_info {
6162

6263
#define init_stack (init_thread_union.stack)
6364

64-
/*
65-
* how to get the current stack pointer from C
66-
*/
67-
register unsigned long current_stack_pointer asm ("sp");
68-
6965
/*
7066
* how to get the thread information struct from C
7167
*/

‎arch/arm64/kernel/return_address.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/export.h>
1313
#include <linux/ftrace.h>
1414

15+
#include <asm/stack_pointer.h>
1516
#include <asm/stacktrace.h>
1617

1718
struct return_address_data {

‎arch/arm64/kernel/stacktrace.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/stacktrace.h>
2323

2424
#include <asm/irq.h>
25+
#include <asm/stack_pointer.h>
2526
#include <asm/stacktrace.h>
2627

2728
/*

‎arch/arm64/kernel/traps.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <asm/esr.h>
3939
#include <asm/insn.h>
4040
#include <asm/traps.h>
41+
#include <asm/stack_pointer.h>
4142
#include <asm/stacktrace.h>
4243
#include <asm/exception.h>
4344
#include <asm/system_misc.h>

0 commit comments

Comments
 (0)