Skip to content

Commit de4f6e5

Browse files
committed
[XTENSA] clean-up header files
The header files in the asm-xtensa directory are not clean and 'make headers_check' fails. This is a first patch to fix most of the header files. It removes unnecessary include statements and adds some that are required for building the kernel. The linker script required some updates or the linking stage would fail. Signed-off-by: Chris Zankel <chris@zankel.net>
1 parent 176fd6c commit de4f6e5

10 files changed

Lines changed: 50 additions & 63 deletions

File tree

‎arch/xtensa/kernel/setup.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <asm/platform.h>
4242
#include <asm/page.h>
4343
#include <asm/setup.h>
44+
#include <asm/param.h>
4445

4546
#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
4647
struct screen_info screen_info = { 0, 24, 0, 0, 0, 80, 0, 0, 0, 24, 1, 16};

‎arch/xtensa/kernel/vmlinux.lds.S‎

Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ SECTIONS
8484
{
8585
/* The .head.text section must be the first section! */
8686
*(.head.text)
87-
*(.literal)
88-
TEXT_TEXT
89-
*(.srom.text)
87+
*(.literal .text)
9088
VMLINUX_SYMBOL(__sched_text_start) = .;
9189
*(.sched.literal .sched.text)
9290
VMLINUX_SYMBOL(__sched_text_end) = .;
@@ -96,39 +94,14 @@ SECTIONS
9694

9795
}
9896
_etext = .;
97+
PROVIDE (etext = .);
9998

10099
. = ALIGN(16);
101100

102101
RODATA
103102

104103
/* Relocation table */
105104

106-
. = ALIGN(16);
107-
__boot_reloc_table_start = ABSOLUTE(.);
108-
109-
__relocate : {
110-
111-
RELOCATE_ENTRY(_WindowVectors_text,
112-
.WindowVectors.text);
113-
#if 0
114-
RELOCATE_ENTRY(_KernelExceptionVector_literal,
115-
.KernelExceptionVector.literal);
116-
#endif
117-
RELOCATE_ENTRY(_KernelExceptionVector_text,
118-
.KernelExceptionVector.text);
119-
#if 0
120-
RELOCATE_ENTRY(_UserExceptionVector_literal,
121-
.UserExceptionVector.literal);
122-
#endif
123-
RELOCATE_ENTRY(_UserExceptionVector_text,
124-
.UserExceptionVector.text);
125-
RELOCATE_ENTRY(_DoubleExceptionVector_literal,
126-
.DoubleExceptionVector.literal);
127-
RELOCATE_ENTRY(_DoubleExceptionVector_text,
128-
.DoubleExceptionVector.text);
129-
}
130-
__boot_reloc_table_end = ABSOLUTE(.) ;
131-
132105
.fixup : { *(.fixup) }
133106

134107
. = ALIGN(16);
@@ -145,8 +118,7 @@ SECTIONS
145118
_fdata = .;
146119
.data :
147120
{
148-
DATA_DATA
149-
CONSTRUCTORS
121+
*(.data) CONSTRUCTORS
150122
. = ALIGN(XCHAL_ICACHE_LINESIZE);
151123
*(.data.cacheline_aligned)
152124
}
@@ -174,6 +146,22 @@ SECTIONS
174146
__tagtable_begin = .;
175147
*(.taglist)
176148
__tagtable_end = .;
149+
150+
. = ALIGN(16);
151+
__boot_reloc_table_start = ABSOLUTE(.);
152+
153+
RELOCATE_ENTRY(_WindowVectors_text,
154+
.WindowVectors.text);
155+
RELOCATE_ENTRY(_KernelExceptionVector_text,
156+
.KernelExceptionVector.text);
157+
RELOCATE_ENTRY(_UserExceptionVector_text,
158+
.UserExceptionVector.text);
159+
RELOCATE_ENTRY(_DoubleExceptionVector_literal,
160+
.DoubleExceptionVector.literal);
161+
RELOCATE_ENTRY(_DoubleExceptionVector_text,
162+
.DoubleExceptionVector.text);
163+
164+
__boot_reloc_table_end = ABSOLUTE(.) ;
177165
}
178166

179167
. = ALIGN(XCHAL_ICACHE_LINESIZE);
@@ -194,16 +182,6 @@ SECTIONS
194182

195183
SECURITY_INIT
196184

197-
. = ALIGN(4);
198-
199-
__start___ftr_fixup = .;
200-
__ftr_fixup : { *(__ftr_fixup) }
201-
__stop___ftr_fixup = .;
202-
203-
. = ALIGN(4096);
204-
__per_cpu_start = .;
205-
.data.percpu : { *(.data.percpu) }
206-
__per_cpu_end = .;
207185

208186
#ifdef CONFIG_BLK_DEV_INITRD
209187
. = ALIGN(4096);
@@ -212,6 +190,12 @@ SECTIONS
212190
__initramfs_end = .;
213191
#endif
214192

193+
. = ALIGN(4096);
194+
__per_cpu_start = .;
195+
.data.percpu : { *(.data.percpu) }
196+
__per_cpu_end = .;
197+
198+
215199
/* We need this dummy segment here */
216200

217201
. = ALIGN(4);
@@ -273,9 +257,9 @@ SECTIONS
273257

274258
/* BSS section */
275259
_bss_start = .;
276-
.sbss : { *(.sbss) *(.scommon) }
277-
.bss : { *(COMMON) *(.bss) }
260+
.bss : { *(.bss.page_aligned) *(.bss) }
278261
_bss_end = .;
262+
279263
_end = .;
280264

281265
/* only used by the boot loader */
@@ -293,16 +277,16 @@ SECTIONS
293277
*(.ResetVector.text)
294278
}
295279

296-
297280
/* Sections to be discarded */
298281
/DISCARD/ :
299282
{
300-
*(.text.exit)
301-
*(.text.exit.literal)
302-
*(.data.exit)
283+
*(.exit.literal .exit.text)
284+
*(.exit.data)
303285
*(.exitcall.exit)
304286
}
305287

288+
.xt.lit : { *(.xt.lit) }
289+
.xt.prop : { *(.xt.prop) }
306290

307291
.debug 0 : { *(.debug) }
308292
.line 0 : { *(.line) }

‎include/asm-xtensa/bitops.h‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ static inline int __ffs(unsigned long x)
5757
return 31 - __cntlz(x & -x);
5858
}
5959

60-
61-
#ifdef __KERNEL__
62-
6360
/*
6461
* ffs: Find first bit set in word. This is defined the same way as
6562
* the libc and compiler builtin ffs routines, therefore
@@ -97,11 +94,15 @@ static inline int fls (unsigned int x)
9794
#include <asm-generic/bitops/ext2-non-atomic.h>
9895

9996
#ifdef __XTENSA_EL__
100-
# define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit((nr),(addr))
101-
# define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr),(addr))
97+
# define ext2_set_bit_atomic(lock,nr,addr) \
98+
test_and_set_bit((nr), (unsigned long*)(addr))
99+
# define ext2_clear_bit_atomic(lock,nr,addr) \
100+
test_and_clear_bit((nr), (unsigned long*)(addr))
102101
#elif defined(__XTENSA_EB__)
103-
# define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit((nr) ^ 0x18, (addr))
104-
# define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr)^0x18,(addr))
102+
# define ext2_set_bit_atomic(lock,nr,addr) \
103+
test_and_set_bit((nr) ^ 0x18, (unsigned long*)(addr))
104+
# define ext2_clear_bit_atomic(lock,nr,addr) \
105+
test_and_clear_bit((nr) ^ 0x18, (unsigned long*)(addr))
105106
#else
106107
# error processor byte order undefined!
107108
#endif

‎include/asm-xtensa/byteorder.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define _XTENSA_BYTEORDER_H
1313

1414
#include <asm/types.h>
15+
#include <linux/compiler.h>
1516

1617
static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
1718
{
@@ -78,4 +79,4 @@ static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
7879
# error processor byte order undefined!
7980
#endif
8081

81-
#endif /* __ASM_XTENSA_BYTEORDER_H */
82+
#endif /* _XTENSA_BYTEORDER_H */

‎include/asm-xtensa/mmu_context.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define _XTENSA_MMU_CONTEXT_H
1515

1616
#include <linux/stringify.h>
17+
#include <linux/sched.h>
1718

1819
#include <asm/pgtable.h>
1920
#include <asm/cacheflush.h>

‎include/asm-xtensa/page.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,6 @@ void copy_user_page(void *to,void* from,unsigned long vaddr,struct page* page);
131131
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
132132
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
133133

134-
#endif /* __KERNEL__ */
135134
#include <asm-generic/memory_model.h>
135+
#endif /* __KERNEL__ */
136136
#endif /* _XTENSA_PAGE_H */

‎include/asm-xtensa/param.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111
#ifndef _XTENSA_PARAM_H
1212
#define _XTENSA_PARAM_H
1313

14-
#include <asm/variant/core.h>
15-
1614
#ifdef __KERNEL__
1715
# define HZ 100 /* internal timer frequency */
1816
# define USER_HZ 100 /* for user interfaces in "ticks" */
1917
# define CLOCKS_PER_SEC (USER_HZ) /* frequnzy at which times() counts */
2018
#endif
2119

22-
#define EXEC_PAGESIZE (1 << XCHAL_MMU_MIN_PTE_PAGE_SIZE)
20+
#define EXEC_PAGESIZE 4096
2321

2422
#ifndef NGROUPS
2523
#define NGROUPS 32

‎include/asm-xtensa/ptrace.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
#ifndef _XTENSA_PTRACE_H
1212
#define _XTENSA_PTRACE_H
1313

14-
#include <asm/variant/core.h>
15-
1614
/*
1715
* Kernel stack
1816
*
@@ -113,6 +111,9 @@ struct pt_regs {
113111
};
114112

115113
#ifdef __KERNEL__
114+
115+
#include <asm/variant/core.h>
116+
116117
# define task_pt_regs(tsk) ((struct pt_regs*) \
117118
(task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
118119
# define user_mode(regs) (((regs)->ps & 0x00000020)!=0)

‎include/asm-xtensa/shmparam.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#ifndef _XTENSA_SHMPARAM_H
1010
#define _XTENSA_SHMPARAM_H
1111

12-
#include <asm/processor.h>
13-
1412
/*
1513
* Xtensa can have variable size caches, and if
1614
* the size of single way is larger than the page size,

‎include/asm-xtensa/thread_info.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ static inline struct thread_info *current_thread_info(void)
116116
#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
117117
#define TIF_IRET 5 /* return with iret */
118118
#define TIF_MEMDIE 6
119+
#define TIF_RESTORE_SIGMASK 7 /* restore signal mask in do_signal() */
119120
#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
120121

121122
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -125,6 +126,7 @@ static inline struct thread_info *current_thread_info(void)
125126
#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
126127
#define _TIF_IRET (1<<TIF_IRET)
127128
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
129+
#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
128130

129131
#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
130132
#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */

0 commit comments

Comments
 (0)