Skip to content

Commit 2b398c0

Browse files
committed
Merge tag 'asm-generic-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
Pull asm-generic header updates from Arnd Bergmann: "A series from Thomas Weißschuh cleans up the UAPI header files to no longer contain any references to Kconfig symbols, as these make no sense in userspace. The build-time check for these was originally added by Sam Ravnborg in linux-2.6.28, and a later version started warning for all newly added CONFIG_* checks here but kept a list of known exceptions. With the last exceptions gone from that list, the warning is now unconditional in 'make headers_install'. John Garry contributed a cleanup of cpumask_of_node()" * tag 'asm-generic-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: scripts: headers_install.sh: Remove config leak ignore machinery x86/uapi: Stop leaking kconfig references to userspace nios2: uapi: Remove custom asm/swab.h from UAPI ARM: uapi: Drop PSR_ENDSTATE ARC: Always use SWAPE instructions for __arch_swab32() include/asm-generic/topology.h: Remove unused definition of cpumask_of_node()
2 parents 1ca2833 + adbbd97 commit 2b398c0

10 files changed

Lines changed: 10 additions & 116 deletions

File tree

arch/arc/Kconfig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ choice
121121
config ARC_CPU_770
122122
bool "ARC770"
123123
depends on ISA_ARCOMPACT
124-
select ARC_HAS_SWAPE
125124
help
126125
Support for ARC770 core introduced with Rel 4.10 (Summer 2011)
127126
This core has a bunch of cool new features:
@@ -340,10 +339,6 @@ config ARC_HAS_LLSC
340339
default y
341340
depends on !ARC_CANT_LLSC
342341

343-
config ARC_HAS_SWAPE
344-
bool "Insn: SWAPE (endian-swap)"
345-
default y
346-
347342
if ISA_ARCV2
348343

349344
config ARC_USE_UNALIGNED_MEM_ACCESS

arch/arc/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ifeq ($(CROSS_COMPILE),)
99
CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux- arc-linux-gnu-)
1010
endif
1111

12-
cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
12+
cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -mswape -D__linux__
1313

1414
tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mcpu=arc700
1515
tune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38
@@ -41,7 +41,6 @@ endif
4141
cflags-y += -fsection-anchors
4242

4343
cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
44-
cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
4544

4645
ifdef CONFIG_ISA_ARCV2
4746

arch/arc/include/uapi/asm/swab.h

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919

2020
#include <linux/types.h>
2121

22-
/* Native single cycle endian swap insn */
23-
#ifdef CONFIG_ARC_HAS_SWAPE
24-
2522
#define __arch_swab32(x) \
2623
({ \
2724
unsigned int tmp = x; \
@@ -32,66 +29,6 @@
3229
tmp; \
3330
})
3431

35-
#else
36-
37-
/* Several ways of Endian-Swap Emulation for ARC
38-
* 0: kernel generic
39-
* 1: ARC optimised "C"
40-
* 2: ARC Custom instruction
41-
*/
42-
#define ARC_BSWAP_TYPE 1
43-
44-
#if (ARC_BSWAP_TYPE == 1) /******* Software only ********/
45-
46-
/* The kernel default implementation of htonl is
47-
* return x<<24 | x>>24 |
48-
* (x & (__u32)0x0000ff00UL)<<8 | (x & (__u32)0x00ff0000UL)>>8;
49-
*
50-
* This generates 9 instructions on ARC (excluding the ld/st)
51-
*
52-
* 8051fd8c: ld r3,[r7,20] ; Mem op : Get the value to be swapped
53-
* 8051fd98: asl r5,r3,24 ; get 3rd Byte
54-
* 8051fd9c: lsr r2,r3,24 ; get 0th Byte
55-
* 8051fda0: and r4,r3,0xff00
56-
* 8051fda8: asl r4,r4,8 ; get 1st Byte
57-
* 8051fdac: and r3,r3,0x00ff0000
58-
* 8051fdb4: or r2,r2,r5 ; combine 0th and 3rd Bytes
59-
* 8051fdb8: lsr r3,r3,8 ; 2nd Byte at correct place in Dst Reg
60-
* 8051fdbc: or r2,r2,r4 ; combine 0,3 Bytes with 1st Byte
61-
* 8051fdc0: or r2,r2,r3 ; combine 0,3,1 Bytes with 2nd Byte
62-
* 8051fdc4: st r2,[r1,20] ; Mem op : save result back to mem
63-
*
64-
* Joern suggested a better "C" algorithm which is great since
65-
* (1) It is portable to any architecture
66-
* (2) At the same time it takes advantage of ARC ISA (rotate intrns)
67-
*/
68-
69-
#define __arch_swab32(x) \
70-
({ unsigned long __in = (x), __tmp; \
71-
__tmp = __in << 8 | __in >> 24; /* ror tmp,in,24 */ \
72-
__in = __in << 24 | __in >> 8; /* ror in,in,8 */ \
73-
__tmp ^= __in; \
74-
__tmp &= 0xff00ff; \
75-
__tmp ^ __in; \
76-
})
77-
78-
#elif (ARC_BSWAP_TYPE == 2) /* Custom single cycle bswap instruction */
79-
80-
#define __arch_swab32(x) \
81-
({ \
82-
unsigned int tmp = x; \
83-
__asm__( \
84-
" .extInstruction bswap, 7, 0x00, SUFFIX_NONE, SYNTAX_2OP \n"\
85-
" bswap %0, %1 \n"\
86-
: "=r" (tmp) \
87-
: "r" (tmp)); \
88-
tmp; \
89-
})
90-
91-
#endif /* ARC_BSWAP_TYPE=zzz */
92-
93-
#endif /* CONFIG_ARC_HAS_SWAPE */
94-
9532
#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
9633
#define __SWAB_64_THRU_32__
9734
#endif

arch/arm/include/asm/processor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset,
7373
regs->ARM_cpsr = USR26_MODE; \
7474
if (elf_hwcap & HWCAP_THUMB && pc & 1) \
7575
regs->ARM_cpsr |= PSR_T_BIT; \
76-
regs->ARM_cpsr |= PSR_ENDSTATE; \
76+
if (IS_ENABLED(CONFIG_CPU_ENDIAN_BE8)) \
77+
regs->ARM_cpsr |= PSR_E_BIT; \
7778
regs->ARM_pc = pc & ~1; /* pc */ \
7879
regs->ARM_sp = sp; /* sp */ \
7980
})

arch/arm/include/uapi/asm/ptrace.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,6 @@
102102
#define PSR_IT_MASK 0x0600fc00 /* If-Then execution state mask */
103103
#define PSR_ENDIAN_MASK 0x00000200 /* Endianness state mask */
104104

105-
/*
106-
* Default endianness state
107-
*/
108-
#ifdef CONFIG_CPU_ENDIAN_BE8
109-
#define PSR_ENDSTATE PSR_E_BIT
110-
#else
111-
#define PSR_ENDSTATE 0
112-
#endif
113-
114105
/*
115106
* These are 'magic' values for PTRACE_PEEKUSR that return info about where a
116107
* process is located in memory.

arch/arm/kernel/signal.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ setup_return(struct pt_regs *regs, struct ksignal *ksig,
337337
return 1;
338338
}
339339

340-
cpsr |= PSR_ENDSTATE;
340+
if (IS_ENABLED(CONFIG_CPU_ENDIAN_BE8))
341+
cpsr |= PSR_E_BIT;
341342

342343
/*
343344
* Maybe we need to deliver a 32-bit signal to a 26-bit task.

arch/x86/include/uapi/asm/auxvec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define AT_SYSINFO_EHDR 33
1212

1313
/* entries in ARCH_DLINFO: */
14-
#if defined(CONFIG_IA32_EMULATION) || !defined(CONFIG_X86_64)
14+
#if defined(__KERNEL__) && (defined(CONFIG_IA32_EMULATION) || !defined(CONFIG_X86_64))
1515
# define AT_VECTOR_SIZE_ARCH 3
1616
#else /* else it's non-compat x86-64 */
1717
# define AT_VECTOR_SIZE_ARCH 2

include/asm-generic/topology.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@
4545
#endif
4646

4747
#ifndef cpumask_of_node
48-
#ifdef CONFIG_NUMA
49-
#define cpumask_of_node(node) ((node) == 0 ? cpu_online_mask : cpu_none_mask)
50-
#else
51-
#define cpumask_of_node(node) ((void)(node), cpu_online_mask)
52-
#endif
48+
#define cpumask_of_node(node) ((void)(node), cpu_online_mask)
5349
#endif
5450
#ifndef pcibus_to_node
5551
#define pcibus_to_node(bus) ((void)(bus), -1)
@@ -61,7 +57,7 @@
6157
cpumask_of_node(pcibus_to_node(bus)))
6258
#endif
6359

64-
#endif /* CONFIG_NUMA */
60+
#endif /* !CONFIG_NUMA */
6561

6662
#if !defined(CONFIG_NUMA) || !defined(CONFIG_HAVE_MEMORYLESS_NODES)
6763

scripts/headers_install.sh

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -64,36 +64,10 @@ configs=$(sed -e '
6464
d
6565
' $OUTFILE)
6666

67-
# The entries in the following list do not result in an error.
68-
# Please do not add a new entry. This list is only for existing ones.
69-
# The list will be reduced gradually, and deleted eventually. (hopefully)
70-
#
71-
# The format is <file-name>:<CONFIG-option> in each line.
72-
config_leak_ignores="
73-
arch/arc/include/uapi/asm/swab.h:CONFIG_ARC_HAS_SWAPE
74-
arch/arm/include/uapi/asm/ptrace.h:CONFIG_CPU_ENDIAN_BE8
75-
arch/nios2/include/uapi/asm/swab.h:CONFIG_NIOS2_CI_SWAB_NO
76-
arch/nios2/include/uapi/asm/swab.h:CONFIG_NIOS2_CI_SWAB_SUPPORT
77-
arch/x86/include/uapi/asm/auxvec.h:CONFIG_IA32_EMULATION
78-
arch/x86/include/uapi/asm/auxvec.h:CONFIG_X86_64
79-
"
80-
8167
for c in $configs
8268
do
83-
leak_error=1
84-
85-
for ignore in $config_leak_ignores
86-
do
87-
if echo "$INFILE:$c" | grep -q "$ignore$"; then
88-
leak_error=
89-
break
90-
fi
91-
done
92-
93-
if [ "$leak_error" = 1 ]; then
94-
echo "error: $INFILE: leak $c to user-space" >&2
95-
exit 1
96-
fi
69+
echo "error: $INFILE: leak $c to user-space" >&2
70+
exit 1
9771
done
9872

9973
rm -f $TMPFILE

0 commit comments

Comments
 (0)