arm64: Remove unused big-endian support
Subsystems (15)
Will Deacon
maintainercover arm64: Remove unused big-endian support
Hi folks,
Big-endian support on arm64 (CONFIG_CPU_BIG_ENDIAN) has depended on BROKEN since 1cf89b6bf660 ("arm64: Kconfig: Make CPU_BIG_ENDIAN depend on BROKEN") and has already seen some clean-up patches removing some of the unused support code (e.g. 5276ea17a23c ("lib/crc: arm64: Assume a little-endian kernel")).
Finish the job, and remove the remaining big-endian support code from arm64. Note that the SETEND emulation for 32-bit tasks remains and so some of the mixed-endian EL0 helpers are retained.
I've broken this down into fairly coarse chunks, as it seemed a lot easier to manage than one giant patch (even with the Kconfig being effectively disabled already) and not all of it is just mindless deletion. Despite that, I'm anticipating the whole thing going via the arm64 tree.
Will
--->8
Will Deacon (12):
selftests/arm64: Remove big-endian support
arm64: bpf: Remove big-endian support from the JIT compiler
arm64: crypto: Assume a little-endian kernel
arm64: lib: Assume a little-endian kernel in custom library routines
arm64: lib: Assume a little-endian kernel in optimised string routines
arm64: assembler: Remove endianness helper macros
arm64: vdso32: Always build compat vDSO object as little-endian
KVM: arm64: Remove support for a big-endian hypervisor object
arm64: Remove all usage of CONFIG_CPU_BIG_ENDIAN
arm64: Remove all usage of __AARCH64EB__
arm64: image: Remove endianness handling for generating image header
arm64: Kbuild: Remove vestigial big-endian support
arch/arm64/Kconfig | 35 +------- arch/arm64/Makefile | 12 +-- arch/arm64/crypto/aes-ce-ccm-core.S | 4 +- arch/arm64/crypto/aes-neonbs-core.S | 4 +- arch/arm64/crypto/ghash-ce-core.S | 6 +- arch/arm64/crypto/sm4-ce-cipher-core.S | 4 +- arch/arm64/include/asm/assembler.h | 42 --------- arch/arm64/include/asm/compat.h | 14 --- arch/arm64/include/asm/elf.h | 12 --- arch/arm64/include/asm/processor.h | 2 - arch/arm64/include/asm/ptrace.h | 6 -- arch/arm64/include/asm/sysreg.h | 50 +++-------- arch/arm64/include/asm/thread_info.h | 5 -- arch/arm64/include/asm/word-at-a-time.h | 6 -- arch/arm64/include/uapi/asm/byteorder.h | 4 - arch/arm64/kernel/fpsimd.c | 21 +---- arch/arm64/kernel/head.S | 7 +- arch/arm64/kernel/image.h | 38 +------- arch/arm64/kernel/kexec_image.c | 5 +- arch/arm64/kernel/kgdb.c | 3 - arch/arm64/kernel/ptrace.c | 8 +- arch/arm64/kernel/signal32.c | 13 --- arch/arm64/kernel/sys32.c | 5 -- arch/arm64/kernel/vdso32/Makefile | 4 - arch/arm64/kvm/hyp/include/nvhe/spinlock.h | 4 - arch/arm64/kvm/hyp/nvhe/gen-hyprel.c | 16 ---- arch/arm64/lib/csum.c | 17 ---- arch/arm64/lib/memchr.S | 2 +- arch/arm64/lib/memcmp.S | 2 - arch/arm64/lib/strcmp.S | 34 +------ arch/arm64/lib/strlen.S | 26 ------ arch/arm64/lib/strncmp.S | 93 ++------------------ arch/arm64/lib/strnlen.S | 16 +--- arch/arm64/mm/extable.c | 5 -- arch/arm64/net/bpf_jit_comp.c | 11 --- tools/testing/selftests/arm64/fp/fp-ptrace.c | 19 +--- tools/testing/selftests/rseq/rseq-arm64.h | 5 -- 37 files changed, 50 insertions(+), 510 deletions(-)
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Will Deacon
maintainerPATCH 1/12 selftests/arm64: Remove big-endian support
Big-endian support on arm64 depends on BROKEN, so the arm64 selftests do not need to worry about testing this configuration any more.
Remove the 128-bit byte-swapping helper from the fp-ptrace test and the big-endian definition of RSEQ_SIG_DATA from the rseq test.
--- tools/testing/selftests/arm64/fp/fp-ptrace.c | 19 +------------------ tools/testing/selftests/rseq/rseq-arm64.h | 5 ----- 2 files changed, 1 insertion(+), 23 deletions(-)
tools/testing/selftests/arm64/fp/fp-ptrace.c +1 -18
@@ -112,23 +112,6 @@ static void handle_alarm(int sig, siginfo_t *info, void *context) got_alarm = true; } -#ifdef CONFIG_CPU_BIG_ENDIAN -static __uint128_t arm64_cpu_to_le128 (__uint128_t x) -{ -u64 a =swab64 (x); -u64 b =swab64 (x >>64 ); - -return ((__uint128_t )a <<64 ) | b; -} -#else -static __uint128_t arm64_cpu_to_le128 (__uint128_t x) -{ -return x; -} -#endif - -#define arm64_le128_to_cpu (x) arm64_cpu_to_le128(x) -static bool sve_supported (void ) {return getauxval (AT_HWCAP ) &HWCAP_SVE ;
@@ -897,7 +880,7 @@ static void fpsimd_to_sve(__uint128_t *v, char *z, int vl)for (i =0 ; i < __SVE_NUM_ZREGS; i++) { p = (__uint128_t *)&z[__SVE_ZREG_OFFSET (vq, i)]; - *p =arm64_cpu_to_le128 (v[i]); + *p = v[i]; } }
tools/testing/selftests/rseq/rseq-arm64.h +0 -5
@@ -12,12 +12,7 @@* matches code endianness. */ #define RSEQ_SIG_CODE 0xd428bc00/* BRK #0x45E0. */ - -#ifdef __AARCH64EB__ -#define RSEQ_SIG_DATA 0x00bc28d4/* BRK #0x45E0. */ -#else #define RSEQ_SIG_DATA RSEQ_SIG_CODE -#endif #define RSEQ_SIG RSEQ_SIG_DATA
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Will Deacon
maintainerPATCH 2/12 arm64: bpf: Remove big-endian support from the JIT compiler
In reply to Will DeaconBig-endian support on arm64 depends on BROKEN. In preparation for removing the dead code altogether, remove the big-endian-specific support from the arm64 BPF JIT backend.
--- arch/arm64/net/bpf_jit_comp.c | 11 ----------- 1 file changed, 11 deletions(-)
arch/arm64/net/bpf_jit_comp.c +0 -11
@@ -1377,13 +1377,8 @@ static int build_insn(const struct bpf_verifier_env *env, const struct bpf_insncase BPF_ALU |BPF_END |BPF_FROM_LE :case BPF_ALU |BPF_END |BPF_FROM_BE :case BPF_ALU64 |BPF_END |BPF_FROM_LE : -#ifdef CONFIG_CPU_BIG_ENDIAN -if (BPF_CLASS (code) ==BPF_ALU &&BPF_SRC (code) ==BPF_FROM_BE ) - goto emit_bswap_uxt; -#else /* !CONFIG_CPU_BIG_ENDIAN */ if (BPF_CLASS (code) ==BPF_ALU &&BPF_SRC (code) ==BPF_FROM_LE ) goto emit_bswap_uxt; -#endif switch (imm) {case 16 :emit (A64_REV16 (is64, dst, dst), ctx);
@@ -2478,15 +2473,9 @@ static void clear_garbage(struct jit_ctx *ctx, int reg, int effective_bytes) {if (effective_bytes) {int garbage_bits =64 -8 * effective_bytes; -#ifdef CONFIG_CPU_BIG_ENDIAN -/* garbage bits are at the right end */ -emit (A64_LSR (1 , reg, reg, garbage_bits), ctx); -emit (A64_LSL (1 , reg, reg, garbage_bits), ctx); -#else /* garbage bits are at the left end */ emit (A64_LSL (1 , reg, reg, garbage_bits), ctx);emit (A64_LSR (1 , reg, reg, garbage_bits), ctx); -#endif } }
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Will Deacon
maintainerPATCH 3/12 arm64: crypto: Assume a little-endian kernel
In reply to Will DeaconCommit 5276ea17a23c ("lib/crc: arm64: Assume a little-endian kernel") removed all usage of the CPU_LE()/CPU_BE() macros from the arm64 CRC assembly now that big-endian support depends on BROKEN.
Do the same for the crypto assembly code.
--- arch/arm64/crypto/aes-ce-ccm-core.S | 4 ++-- arch/arm64/crypto/aes-neonbs-core.S | 4 ++-- arch/arm64/crypto/ghash-ce-core.S | 6 +++--- arch/arm64/crypto/sm4-ce-cipher-core.S | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-)
arch/arm64/crypto/aes-ce-ccm-core.S +2 -2
@@ -50,7 +50,7 @@ ld1 {v0.16b}, [x5] /* load mac */ cbz x2, ce_aes_ccm_final ldr x8, [x6, #8] /* load lower ctr */ -CPU_LE( rev x8, x8 ) /* keep swabbed ctr in reg */ + rev x8, x8 /* keep swabbed ctr in reg */ 0: /* outer loop */ ld1 {v1.8b}, [x6] /* load upper ctr */ prfm pldl1strm, [x1]
@@ -73,7 +73,7 @@ CPU_LE( rev x8, x8 ) /* keep swabbed ctr in reg */ eor v0.16b, v0.16b, v2.16b /* xor mac with pt ^ rk[last] */ st1 {v6.16b}, [x0], #16 /* write output block */ bne 0b -CPU_LE( rev x8, x8 ) + rev x8, x8 str x8, [x6, #8] /* store lsb end of ctr (BE) */ cbnz x7, ce_aes_ccm_final st1 {v0.16b}, [x5] /* store mac */
arch/arm64/crypto/aes-neonbs-core.S +2 -2
@@ -824,8 +824,8 @@ SYM_FUNC_START(aesbs_ctr_encrypt) frame_push 0 ldp x7, x8, [x5] ld1 {v0.16b}, [x5] -CPU_LE( rev x7, x7 ) -CPU_LE( rev x8, x8 ) + rev x7, x7 + rev x8, x8 adds x8, x8, #1 adc x7, x7, xzr
arch/arm64/crypto/ghash-ce-core.S +3 -3
@@ -148,7 +148,7 @@ SYM_FUNC_START(pmull_ghash_update_p64) sub w0, w0, #1 3: /* multiply XL by SHASH in GF(2^128) */ -CPU_LE( rev64 T1.16b, T1.16b ) + rev64 T1.16b, T1.16b ext T2.16b, XL.16b, XL.16b, #8 ext IN1.16b, T1.16b, T1.16b, #8
@@ -272,7 +272,7 @@ SYM_FUNC_END(pmull_ghash_update_p64) cbz x0, 3f // tag only? ldr w8, [x5, #12] // load lower counter -CPU_LE( rev w8, w8 ) + rev w8, w8 0: mov w9, #4 // max blocks per round add x10, x0, #0xf
@@ -380,7 +380,7 @@ CPU_LE( rev w8, w8 ) ret 5: -CPU_LE( rev w8, w8 ) + rev w8, w8 str w8, [x5, #12] // store lower counter st1 {XL.2d}, [x4] b 4b
arch/arm64/crypto/sm4-ce-cipher-core.S +2 -2
@@ -18,7 +18,7 @@ SYM_FUNC_START(sm4_ce_do_crypt) ld1 {v8.4s}, [x2] ld1 {v0.4s-v3.4s}, [x0], #64 -CPU_LE( rev32 v8.16b, v8.16b ) + rev32 v8.16b, v8.16b ld1 {v4.4s-v7.4s}, [x0] sm4e v8.4s, v0.4s sm4e v8.4s, v1.4s
@@ -30,7 +30,7 @@ CPU_LE( rev32 v8.16b, v8.16b ) sm4e v8.4s, v7.4s rev64 v8.4s, v8.4s ext v8.16b, v8.16b, v8.16b, #8 -CPU_LE( rev32 v8.16b, v8.16b ) + rev32 v8.16b, v8.16b st1 {v8.4s}, [x1] ret SYM_FUNC_END(sm4_ce_do_crypt)
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Will Deacon
maintainerPATCH 4/12 arm64: lib: Assume a little-endian kernel in custom library routines
In reply to Will DeaconCommit 5276ea17a23c ("lib/crc: arm64: Assume a little-endian kernel") removed all usage of the CPU_LE()/CPU_BE() macros from the arm64 CRC assembly now that big-endian support depends on BROKEN.
Do the same for the rest of the custom arm64 library code, as well as removing all usage of the '__LITTLE_ENDIAN' macro.
--- arch/arm64/lib/csum.c | 17 ----------------- arch/arm64/lib/memchr.S | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-)
arch/arm64/lib/csum.c +0 -17
@@ -47,11 +47,7 @@ unsigned int __no_sanitize_address do_csum(const unsigned char *buff, int len)*/ shift = offset *8 ; data = *ptr++; -#ifdef __LITTLE_ENDIAN data = (data >> shift) << shift; -#else - data = (data << shift) >> shift; -#endif /* * Body: straightforward aligned loads from here on (the paired loads
@@ -94,13 +90,8 @@ unsigned int __no_sanitize_address do_csum(const unsigned char *buff, int len) len -=16 ; ptr +=2 ; -#ifdef __LITTLE_ENDIAN data = tmp >>64 ; sum64 =accumulate (sum64, tmp); -#else - data = tmp; - sum64 =accumulate (sum64, tmp >>64 ); -#endif }if (len >0 ) { sum64 =accumulate (sum64, data);
@@ -112,11 +103,7 @@ unsigned int __no_sanitize_address do_csum(const unsigned char *buff, int len)* preserving odd/even alignment. */ shift = len *-8 ; -#ifdef __LITTLE_ENDIAN data = (data << shift) >> shift; -#else - data = (data >> shift) << shift; -#endif sum64 =accumulate (sum64, data);/* Finally, folding */
@@ -140,11 +127,7 @@ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, dst = *(const __uint128_t *)daddr->s6_addr; sum += (__force u32 )htonl (len); -#ifdef __LITTLE_ENDIAN sum += (u32 )proto <<24 ; -#else - sum += proto; -#endif src += (src >>64 ) | (src <<64 ); dst += (dst >>64 ) | (dst <<64 );
arch/arm64/lib/memchr.S +1 -1
@@ -63,7 +63,7 @@ L(byte_loop): sub srcin, srcin, #1 ret L(found_word): -CPU_LE( rev tmp, tmp) + rev tmp, tmp clz tmp, tmp sub tmp, tmp, #64 add result, srcin, tmp, asr #3
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Will Deacon
maintainerPATCH 5/12 arm64: lib: Assume a little-endian kernel in optimised string routines
In reply to Will DeaconBig-endian support on arm64 depends on BROKEN. In preparation for removing the dead code altogether, remove the big-endian-specific support from the arm64 optimised string routines. Although these started life as a fork of Arm's "cortex strings" library and later got updated with the "optimized-routines" code, the in-kernel implementation has always been different enough that removing the unused big-endian portion still makes sense.
--- arch/arm64/lib/memcmp.S | 2 - arch/arm64/lib/strcmp.S | 34 +-------------- arch/arm64/lib/strlen.S | 26 ----------- arch/arm64/lib/strncmp.S | 93 +++------------------------------------- arch/arm64/lib/strnlen.S | 16 +------ 5 files changed, 8 insertions(+), 163 deletions(-)
arch/arm64/lib/memcmp.S +0 -2
@@ -103,10 +103,8 @@ L(last_bytes): /* Compare data bytes and set return value to 0, -1 or 1. */ L(return): -#ifndef __AARCH64EB__ rev data1, data1 rev data2, data2 -#endif cmp data1, data2 L(ret_eq): cset result, ne
arch/arm64/lib/strcmp.S +1 -33
@@ -38,14 +38,6 @@ #define shift x9 #define off2 x10 -/* On big-endian early bytes are at MSB and on little-endian LSB. - LS_FW means shifting towards early bytes. */ -#ifdef __AARCH64EB__ -# define LS_FW lsl -#else -# define LS_FW lsr -#endif - /* NUL detection works on the principle that (X - 1) & (~X) & 0x80 (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and can be done in parallel across the entire word.
@@ -67,28 +59,17 @@ L(loop_aligned): ldr data2, [src1, off2] ldr data1, [src1], 8 L(start_realigned): -#ifdef __AARCH64EB__ - rev tmp, data1 - sub has_nul, tmp, zeroones - orr tmp, tmp, REP8_7f -#else sub has_nul, data1, zeroones orr tmp, data1, REP8_7f -#endif bics has_nul, has_nul, tmp /* Non-zero if NUL terminator. */ ccmp data1, data2, 0, eq b.eq L(loop_aligned) -#ifdef __AARCH64EB__ - rev has_nul, has_nul -#endif eor diff, data1, data2 orr syndrome, diff, has_nul L(end): -#ifndef __AARCH64EB__ rev syndrome, syndrome rev data1, data1 rev data2, data2 -#endif clz shift, syndrome /* The most-significant-non-zero bit of the syndrome marks either the first bit that is different, or the top bit of the first zero byte.
@@ -113,7 +94,7 @@ L(mutual_align): ldr data1, [src1], 8 neg shift, src2, lsl 3 /* Bits to alignment -64. */ mov tmp, -1 - LS_FW tmp, tmp, shift + lsr tmp, tmp, shift orr data1, data1, tmp orr data2, data2, tmp b L(start_realigned)
@@ -135,9 +116,6 @@ L(src1_aligned): neg shift, src2, lsl 3 bic src2, src2, 7 ldr data3, [src2], 8 -#ifdef __AARCH64EB__ - rev data3, data3 -#endif lsr tmp, zeroones, shift orr data3, data3, tmp sub has_nul, data3, zeroones
@@ -152,9 +130,6 @@ L(src1_aligned): L(loop_unaligned): ldr data3, [src1, off1] ldr data2, [src1, off2] -#ifdef __AARCH64EB__ - rev data3, data3 -#endif sub has_nul, data3, zeroones orr tmp, data3, REP8_7f ldr data1, [src1], 8
@@ -163,9 +138,6 @@ L(loop_unaligned): b.eq L(loop_unaligned) lsl tmp, has_nul, shift -#ifdef __AARCH64EB__ - rev tmp, tmp -#endif eor diff, data1, data2 orr syndrome, diff, tmp cbnz syndrome, L(end)
@@ -174,10 +146,6 @@ L(tail): neg shift, shift lsr data2, data3, shift lsr has_nul, has_nul, shift -#ifdef __AARCH64EB__ - rev data2, data2 - rev has_nul, has_nul -#endif eor diff, data1, data2 orr syndrome, diff, has_nul b L(end)
arch/arm64/lib/strlen.S +0 -26
@@ -85,14 +85,6 @@ SYM_FUNC_START(__pi_strlen) cmp tmp1, MIN_PAGE_SIZE - 16 b.gt L(page_cross) ldp data1, data2, [srcin] -#ifdef __AARCH64EB__ - /* For big-endian, carry propagation (if the final byte in the - string is 0x01) means we cannot use has_nul1/2 directly. - Since we expect strings to be small and early-exit, - byte-swap the data now so has_null1/2 will be correct. */ - rev data1, data1 - rev data2, data2 -#endif sub tmp1, data1, zeroones orr tmp2, data1, REP8_7f sub tmp3, data2, zeroones
@@ -144,19 +136,7 @@ L(page_cross_entry): /* Enter with C = has_nul1 == 0. */ L(tail): -#ifdef __AARCH64EB__ - /* For big-endian, carry propagation (if the final byte in the - string is 0x01) means we cannot use has_nul1/2 directly. The - easiest way to get the correct byte is to byte-swap the data - and calculate the syndrome a second time. */ - csel data1, data1, data2, cc - rev data1, data1 - sub tmp1, data1, zeroones - orr tmp2, data1, REP8_7f - bic has_nul1, tmp1, tmp2 -#else csel has_nul1, has_nul1, has_nul2, cc -#endif sub len, src, srcin rev has_nul1, has_nul1 add tmp2, len, 8
@@ -194,13 +174,7 @@ L(page_cross): ldp data1, data2, [src] lsl tmp1, srcin, 3 mov tmp4, -1 -#ifdef __AARCH64EB__ - /* Big-endian. Early bytes are at MSB. */ - lsr tmp1, tmp4, tmp1 /* Shift (tmp1 & 63). */ -#else - /* Little-endian. Early bytes are at LSB. */ lsl tmp1, tmp4, tmp1 /* Shift (tmp1 & 63). */ -#endif orr tmp1, tmp1, REP8_80 orn data1, data1, tmp1 orn tmp2, data2, tmp1
arch/arm64/lib/strncmp.S +6 -87
152 lines not on this page · raw message
arch/arm64/lib/strnlen.S +1 -15
@@ -91,22 +91,10 @@ SYM_FUNC_START(__pi_strnlen) */ sub len, src, srcin cbz has_nul1, .Lnul_in_data2 -CPU_BE( mov data2, data1 ) /*perpare data to re-calculate the syndrome*/ sub len, len, #8 mov has_nul2, has_nul1 .Lnul_in_data2: - /* - * For big-endian, carry propagation (if the final byte in the - * string is 0x01) means we cannot use has_nul directly. The - * easiest way to get the correct byte is to byte-swap the data - * and calculate the syndrome a second time. - */ -CPU_BE( rev data2, data2 ) -CPU_BE( sub tmp1, data2, zeroones ) -CPU_BE( orr tmp2, data2, #REP8_7f ) -CPU_BE( bic has_nul2, tmp1, tmp2 ) - sub len, len, #8 rev has_nul2, has_nul2 clz pos, has_nul2
@@ -139,10 +127,8 @@ CPU_BE( bic has_nul2, tmp1, tmp2 ) lsl tmp4, tmp4, #3 /* Bytes beyond alignment -> bits. */ mov tmp2, #~0 - /* Big-endian. Early bytes are at MSB. */ -CPU_BE( lsl tmp2, tmp2, tmp4 ) /* Shift (tmp1 & 63). */ /* Little-endian. Early bytes are at LSB. */ -CPU_LE( lsr tmp2, tmp2, tmp4 ) /* Shift (tmp1 & 63). */ + lsr tmp2, tmp2, tmp4 /* Shift (tmp1 & 63). */ cmp tmp1, #8
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Will Deacon
maintainerPATCH 6/12 arm64: assembler: Remove endianness helper macros
In reply to Will DeaconThe CPU_LE()/CPU_BE() helper macros are only used by head.S. Since big-endian support depends on BROKEN, remove the last users along with the macro definitions. The unused regs_to_64() assembly macro, which somewhat bizarrely behaves differently depend on the endianness, is also removed.
--- arch/arm64/include/asm/assembler.h | 31 ------------------------------ arch/arm64/kernel/head.S | 3 +-- 2 files changed, 1 insertion(+), 33 deletions(-)
arch/arm64/include/asm/assembler.h +0 -31
@@ -133,37 +133,6 @@ lr .req x30 // link register b \label .endm -/* -* Select code when configured for BE. - */ -#ifdef CONFIG_CPU_BIG_ENDIAN -#define CPU_BE(code...) code -#else -#define CPU_BE(code...) -#endif - -/* -* Select code when configured for LE. -*/ -#ifdef CONFIG_CPU_BIG_ENDIAN -#define CPU_LE(code...) -#else -#define CPU_LE(code...) code -#endif - -/* -* Define a macro that constructs a 64-bit value by concatenating two -* 32-bit registers. Note that on big endian systems the order of the -* registers is swapped. -*/ -#ifndef CONFIG_CPU_BIG_ENDIAN - .macro regs_to_64, rd, lbits, hbits -#else - .macro regs_to_64, rd, hbits, lbits -#endif - orr \rd, \lbits, \hbits, lsl #32 - .endm -/* * Pseudo-ops for PC-relative adr/ldr/str <reg>, <symbol> where * <symbol> is within the range +/- 4 GB of the PC.
arch/arm64/kernel/head.S +1 -2
@@ -138,8 +138,7 @@ SYM_CODE_START_LOCAL(record_mmu_state) b.ne 0f mrs x19, sctlr_el2 0: -CPU_LE( tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f ) -CPU_BE( tbz x19, #SCTLR_ELx_EE_SHIFT, 1f ) + tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f tst x19, #SCTLR_ELx_C // Z := (C == 0) and x19, x19, #SCTLR_ELx_M // isolate M bit csel x19, xzr, x19, eq // clear x19 if Z
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Re: [PATCH 06/12] arm64: assembler: Remove endianness helper macros
Quoted 60 lines · Will Deacon
The CPU_LE()/CPU_BE() helper macros are only used by
head.S. Since big-endian support depends on BROKEN, remove the last users along with the macro definitions. The unusedregs_to_64()assembly macro, which somewhat bizarrely behaves differently depend on the endianness, is also removed.Signed-off-by Will Deacon <[email protected]>--- arch/arm64/include/asm/assembler.h | 31 ------------------------------ arch/arm64/kernel/head.S | 3 +-- 2 files changed, 1 insertion(+), 33 deletions(-)arch/arm64/include/asm/assembler.h +0
-31@@ -133,37 +133,6 @@ lr .req x30 // link register b \label .endm -/* -* Select code when configured for BE. - */ -#ifdef CONFIG_CPU_BIG_ENDIAN -#define CPU_BE(code...) code -#else -#define CPU_BE(code...) -#endif - -/* -* Select code when configured for LE. -*/ -#ifdef CONFIG_CPU_BIG_ENDIAN -#define CPU_LE(code...) -#else -#define CPU_LE(code...) code -#endif - -/* -* Define a macro that constructs a 64-bit value by concatenating two -* 32-bit registers. Note that on big endian systems the order of the -* registers is swapped. -*/ -#ifndef CONFIG_CPU_BIG_ENDIAN - .macro regs_to_64, rd, lbits, hbits -#else - .macro regs_to_64, rd, hbits, lbits -#endif - orr \rd, \lbits, \hbits, lsl #32 - .endm -/* * Pseudo-ops for PC-relative adr/ldr/str <reg>, <symbol> where * <symbol> is within the range +/- 4 GB of the PC. arch/arm64/kernel/head.S +0
-0
arch/arm64/kernel/head.S SYM_CODE_START_LOCAL(record_mmu_state) · line 144
Quoted 9 lines
arch/arm64/kernel/head.S +1
-2@@ -138,8 +138,7 @@ SYM_CODE_START_LOCAL(record_mmu_state) b.ne 0f mrs x19, sctlr_el2 0: -CPU_LE( tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f ) -CPU_BE( tbz x19, #SCTLR_ELx_EE_SHIFT, 1f ) + tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f tst x19, #SCTLR_ELx_C // Z := (C == 0) and x19, x19, #SCTLR_ELx_M // isolate M bit csel x19, xzr, x19, eq // clear x19 if Z
There is some more code that can be removed here - see 2ced0f30a426c7301350681f838344d5aea711e3
Will Deacon
maintainerRe: [PATCH 06/12] arm64: assembler: Remove endianness helper macros
Quoted 10 lines · Ard Biesheuvel
Quoted 9 lines · Will Deacon
arch/arm64/kernel/head.S +0
-1@@ -138,8 +138,7 @@ SYM_CODE_START_LOCAL(record_mmu_state) b.ne 0f mrs x19, sctlr_el2 0: -CPU_LE( tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f )
Quoted 8 lines
arch/arm64/kernel/head.S SYM_CODE_START_LOCAL(record_mmu_state) · line 144
Quoted 5 lines
arch/arm64/kernel/head.S +1
-1-CPU_BE( tbz x19, #SCTLR_ELx_EE_SHIFT, 1f ) + tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f tst x19, #SCTLR_ELx_C // Z := (C == 0) and x19, x19, #SCTLR_ELx_M // isolate M bit csel x19, xzr, x19, eq // clear x19 if ZThere is some more code that can be removed here - see
2ced0f30a426c7301350681f838344d5aea711e3
Good spot, thanks! I'll do some more surgery at -rc1.
Will
Will Deacon
maintainerRe: [PATCH 06/12] arm64: assembler: Remove endianness helper macros
Quoted 20 lines · Will Deacon
Quoted 10 lines · Ard Biesheuvel
Quoted 9 lines · Will Deacon
arch/arm64/kernel/head.S +0
-1@@ -138,8 +138,7 @@ SYM_CODE_START_LOCAL(record_mmu_state) b.ne 0f mrs x19, sctlr_el2 0: -CPU_LE( tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f )Quoted 8 lines
arch/arm64/kernel/head.S SYM_CODE_START_LOCAL(record_mmu_state) · line 144
Quoted 5 lines
arch/arm64/kernel/head.S +1
-1-CPU_BE( tbz x19, #SCTLR_ELx_EE_SHIFT, 1f ) + tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f tst x19, #SCTLR_ELx_C // Z := (C == 0) and x19, x19, #SCTLR_ELx_M // isolate M bit csel x19, xzr, x19, eq // clear x19 if ZThere is some more code that can be removed here - see
2ced0f30a426c7301350681f838344d5aea711e3
Quoted 1 line
Good spot, thanks! I'll do some more surgery at -rc1.
Looking at this again, I'm not sure we can remove much here. I think we probably still want to force little-endian (i.e. clear the EE bit) if we're entered as big-endian. I've changed the following EOR to a BIC (see below), but I think that's about all we can do?
Will
--->8
arch/arm64/kernel/head.S +5 -5
@@ -145,12 +145,12 @@ SYM_CODE_START_LOCAL(record_mmu_state) ret /* - * Set the correct endianness early so all memory accesses issued - * before init_kernel_el() occur in the correct byte order. Note that - * this means the MMU must be disabled, or the active ID map will end - * up getting interpreted with the wrong byte order. + * Force little-endian early so all memory accesses issued before + * init_kernel_el() occur in the correct byte order. Note that this + * means the MMU must be disabled, or the active ID map will end up + * getting interpreted with the wrong byte order. */ -1: eor x19, x19, #SCTLR_ELx_EE +1: bic x19, x19, #SCTLR_ELx_EE bic x19, x19, #SCTLR_ELx_M b.ne 2f pre_disable_mmu_workaround
Re: [PATCH 06/12] arm64: assembler: Remove endianness helper macros
Quoted 21 lines · Will Deacon
Quoted 20 lines · Will Deacon
Quoted 18 lines · Ard Biesheuvel
Quoted 5 lines · Will Deacon
arch/arm64/kernel/head.S +0
-0arch/arm64/kernel/head.S SYM_CODE_START_LOCAL(record_mmu_state) · line 144
Quoted 9 lines
arch/arm64/kernel/head.S +1
-2@@ -138,8 +138,7 @@ SYM_CODE_START_LOCAL(record_mmu_state) b.ne 0f mrs x19, sctlr_el2 0: -CPU_LE( tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f ) -CPU_BE( tbz x19, #SCTLR_ELx_EE_SHIFT, 1f ) + tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f tst x19, #SCTLR_ELx_C // Z := (C == 0) and x19, x19, #SCTLR_ELx_M // isolate M bit csel x19, xzr, x19, eq // clear x19 if ZThere is some more code that can be removed here - see
2ced0f30a426c7301350681f838344d5aea711e3
Quoted 7 lines
Quoted 1 line
Good spot, thanks! I'll do some more surgery at -rc1.
Looking at this again, I'm not sure we can remove much here. I think we probably still want to force little-endian (i.e. clear the EE bit) if we're entered as big-endian. I've changed the following EOR to a BIC (see below), but I think that's about all we can do?
Well, the only case where we allow an active ID map is when doing EFI boot, which is guaranteed to be little-endian. Since the kernel is now also guaranteed to be little-endian, we should be able to simply kick the CPU in LE mode right at the start, no? And simply ignore the case of a BE bootloader entering with the MMU and caches enabled?
Will Deacon
maintainerRe: [PATCH 06/12] arm64: assembler: Remove endianness helper macros
Quoted 31 lines · Ard Biesheuvel
Quoted 21 lines · Will Deacon
Quoted 20 lines · Will Deacon
Quoted 18 lines · Ard Biesheuvel
Quoted 5 lines · Will Deacon
arch/arm64/kernel/head.S +0
-0arch/arm64/kernel/head.S SYM_CODE_START_LOCAL(record_mmu_state) · line 144
Quoted 9 lines
arch/arm64/kernel/head.S +1
-2@@ -138,8 +138,7 @@ SYM_CODE_START_LOCAL(record_mmu_state) b.ne 0f mrs x19, sctlr_el2 0: -CPU_LE( tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f ) -CPU_BE( tbz x19, #SCTLR_ELx_EE_SHIFT, 1f ) + tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f tst x19, #SCTLR_ELx_C // Z := (C == 0) and x19, x19, #SCTLR_ELx_M // isolate M bit csel x19, xzr, x19, eq // clear x19 if ZThere is some more code that can be removed here - see
2ced0f30a426c7301350681f838344d5aea711e3Quoted 7 lines
Quoted 1 line
Good spot, thanks! I'll do some more surgery at -rc1.
Looking at this again, I'm not sure we can remove much here. I think we probably still want to force little-endian (i.e. clear the EE bit) if we're entered as big-endian. I've changed the following EOR to a BIC (see below), but I think that's about all we can do?
Quoted 5 lines
Well, the only case where we allow an active ID map is when doing EFI boot, which is guaranteed to be little-endian. Since the kernel is now also guaranteed to be little-endian, we should be able to simply kick the CPU in LE mode right at the start, no? And simply ignore the case of a BE bootloader entering with the MMU and caches enabled?
Hmm, so why did we support this in the first place given that EFI is guaranteed to be little-endian? Or was that just because we wanted to handle the case of a big-endian kernel being loaded by EFI?
Will
Re: [PATCH 06/12] arm64: assembler: Remove endianness helper macros
Quoted 38 lines · Will Deacon
Quoted 31 lines · Ard Biesheuvel
Quoted 21 lines · Will Deacon
Quoted 20 lines · Will Deacon
Quoted 18 lines · Ard Biesheuvel
Quoted 5 lines · Will Deacon
arch/arm64/kernel/head.S +0
-0arch/arm64/kernel/head.S SYM_CODE_START_LOCAL(record_mmu_state) · line 144
Quoted 9 lines
arch/arm64/kernel/head.S +1
-2@@ -138,8 +138,7 @@ SYM_CODE_START_LOCAL(record_mmu_state) b.ne 0f mrs x19, sctlr_el2 0: -CPU_LE( tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f ) -CPU_BE( tbz x19, #SCTLR_ELx_EE_SHIFT, 1f ) + tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f tst x19, #SCTLR_ELx_C // Z := (C == 0) and x19, x19, #SCTLR_ELx_M // isolate M bit csel x19, xzr, x19, eq // clear x19 if ZThere is some more code that can be removed here - see
2ced0f30a426c7301350681f838344d5aea711e3Quoted 7 lines
Quoted 1 line
Good spot, thanks! I'll do some more surgery at -rc1.
Looking at this again, I'm not sure we can remove much here. I think we probably still want to force little-endian (i.e. clear the EE bit) if we're entered as big-endian. I've changed the following EOR to a BIC (see below), but I think that's about all we can do?
Quoted 5 lines
Well, the only case where we allow an active ID map is when doing EFI boot, which is guaranteed to be little-endian. Since the kernel is now also guaranteed to be little-endian, we should be able to simply kick the CPU in LE mode right at the start, no? And simply ignore the case of a BE bootloader entering with the MMU and caches enabled?
Quoted 4 lines
Hmm, so why did we support this in the first place given that EFI is guaranteed to be little-endian? Or was that just because we wanted to handle the case of a big-endian kernel being loaded by EFI?
The original report is here:
https://lore.kernel.org/linux-arm-kernel/[email protected]/
So it would probably have been sufficient at the time to just kick the CPU into LE mode - I don't remember why I added the additional logic tbh.
Will Deacon
maintainerRe: [PATCH 06/12] arm64: assembler: Remove endianness helper macros
Quoted 46 lines · Ard Biesheuvel
Quoted 38 lines · Will Deacon
Quoted 31 lines · Ard Biesheuvel
Quoted 21 lines · Will Deacon
Quoted 20 lines · Will Deacon
Quoted 18 lines · Ard Biesheuvel
Quoted 5 lines · Will Deacon
arch/arm64/kernel/head.S +0
-0arch/arm64/kernel/head.S SYM_CODE_START_LOCAL(record_mmu_state) · line 144
Quoted 9 lines
arch/arm64/kernel/head.S +1
-2@@ -138,8 +138,7 @@ SYM_CODE_START_LOCAL(record_mmu_state) b.ne 0f mrs x19, sctlr_el2 0: -CPU_LE( tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f ) -CPU_BE( tbz x19, #SCTLR_ELx_EE_SHIFT, 1f ) + tbnz x19, #SCTLR_ELx_EE_SHIFT, 1f tst x19, #SCTLR_ELx_C // Z := (C == 0) and x19, x19, #SCTLR_ELx_M // isolate M bit csel x19, xzr, x19, eq // clear x19 if ZThere is some more code that can be removed here - see
2ced0f30a426c7301350681f838344d5aea711e3Quoted 7 lines
Quoted 1 line
Good spot, thanks! I'll do some more surgery at -rc1.
Looking at this again, I'm not sure we can remove much here. I think we probably still want to force little-endian (i.e. clear the EE bit) if we're entered as big-endian. I've changed the following EOR to a BIC (see below), but I think that's about all we can do?
Quoted 5 lines
Well, the only case where we allow an active ID map is when doing EFI boot, which is guaranteed to be little-endian. Since the kernel is now also guaranteed to be little-endian, we should be able to simply kick the CPU in LE mode right at the start, no? And simply ignore the case of a BE bootloader entering with the MMU and caches enabled?
Quoted 4 lines
Hmm, so why did we support this in the first place given that EFI is guaranteed to be little-endian? Or was that just because we wanted to handle the case of a big-endian kernel being loaded by EFI?
Quoted 6 lines
The original report is here:
https://lore.kernel.org/linux-arm-kernel/[email protected]/So it would probably have been sufficient at the time to just kick the CPU into LE mode - I don't remember why I added the additional logic tbh.
Okey doke. I'll do it in v2, but as a standalone patch rather than folding it in with this one..
Will
Will Deacon
maintainerPATCH 7/12 arm64: vdso32: Always build compat vDSO object as little-endian
In reply to Will DeaconBig-endian support on arm64 depends on BROKEN. In preparation for removing the dead code altogether, remove support for building a big-endian 32-bit vDSO.
--- arch/arm64/kernel/vdso32/Makefile | 4 ---- 1 file changed, 4 deletions(-)
arch/arm64/kernel/vdso32/Makefile +0 -4
@@ -45,11 +45,7 @@ endif # From arm Makefile VDSO_CAFLAGS += $(call cc32-option,-fno-dwarf2-cfi-asm) VDSO_CAFLAGS += -mabi=aapcs-linux -mfloat-abi=soft -ifeq ($(CONFIG_CPU_BIG_ENDIAN), y) -VDSO_CAFLAGS += -mbig-endian -else VDSO_CAFLAGS += -mlittle-endian -endif # From arm vDSO Makefile VDSO_CAFLAGS += -fPIC -fno-builtin -fno-stack-protector
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Will Deacon
maintainerPATCH 8/12 KVM: arm64: Remove support for a big-endian hypervisor object
In reply to Will DeaconBig-endian support on arm64 depends on BROKEN. In preparation for removing the dead code altogether, remove the support for generating ELF relocations for a big-endian hypervisor object and drop the unused big-endian spinlock definition from nVHE.
--- arch/arm64/kvm/hyp/include/nvhe/spinlock.h | 4 ---- arch/arm64/kvm/hyp/nvhe/gen-hyprel.c | 16 ---------------- 2 files changed, 20 deletions(-)
arch/arm64/kvm/hyp/include/nvhe/spinlock.h +0 -4
@@ -20,11 +20,7 @@typedef union hyp_spinlock {u32 __val;struct { -#ifdef __AARCH64EB__ -u16 next, owner; -#else u16 owner, next; -#endif }; }hyp_spinlock_t ;
arch/arm64/kvm/hyp/nvhe/gen-hyprel.c +0 -16
@@ -139,28 +139,12 @@ static struct {const char *sh_string; } elf; -#if defined(CONFIG_CPU_LITTLE_ENDIAN ) -#define elf16toh (x) le16toh(x)#define elf32toh (x) le32toh(x)#define elf64toh (x) le64toh(x)#define ELFENDIAN ELFDATA2LSB -#elif defined(CONFIG_CPU_BIG_ENDIAN ) - -#define elf16toh (x) be16toh(x) -#define elf32toh (x) be32toh(x) -#define elf64toh (x) be64toh(x) - -#define ELFENDIAN ELFDATA2MSB - -#else - -#error PDP-endian sadly unsupported... - -#endif -#define fatal_error (fmt, ...) \ ({ \ fprintf(stderr, "error: %s: " fmt "\n", \
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Will Deacon
maintainerPATCH 9/12 arm64: Remove all usage of CONFIG_CPU_BIG_ENDIAN
In reply to Will DeaconBig-endian support on arm64 depends on BROKEN. In preparation for removing the dead code altogether, remove all usage of CONFIG_CPU_BIG_ENDIAN from the arm64 kernel port.
--- arch/arm64/include/asm/processor.h | 2 -- arch/arm64/include/asm/ptrace.h | 6 ---- arch/arm64/include/asm/sysreg.h | 50 ++++++++-------------------- arch/arm64/include/asm/thread_info.h | 5 --- arch/arm64/kernel/fpsimd.c | 21 ++---------- arch/arm64/kernel/image.h | 18 ++-------- arch/arm64/kernel/kexec_image.c | 5 ++- arch/arm64/kernel/kgdb.c | 3 -- arch/arm64/kernel/ptrace.c | 8 ++--- arch/arm64/kernel/signal32.c | 3 -- arch/arm64/kernel/sys32.c | 5 --- 11 files changed, 22 insertions(+), 104 deletions(-)
arch/arm64/include/asm/processor.h +0 -2
@@ -351,8 +351,6 @@ static inline void compat_start_thread(struct pt_regs *regs, unsigned long pc,unsigned long pstate =PSR_AA32_MODE_USR ;if (pc &1 ) pstate |=PSR_AA32_T_BIT ; -if (IS_ENABLED (CONFIG_CPU_BIG_ENDIAN )) - pstate |=PSR_AA32_E_BIT ;start_thread_common (regs, pc, pstate);spectre_v4_enable_task_mitigation (current);
arch/arm64/include/asm/ptrace.h +0 -6
@@ -68,12 +68,6 @@#define PSR_AA32_IT_MASK 0x0600fc00/* If-Then execution state mask */ #define PSR_AA32_GE_MASK 0x000f0000 -#ifdef CONFIG_CPU_BIG_ENDIAN -#define PSR_AA32_ENDSTATE PSR_AA32_E_BIT -#else -#define PSR_AA32_ENDSTATE 0 -#endif -/* AArch32 CPSR bits, as seen in AArch32 */ #define COMPAT_PSR_DIT_BIT 0x00200000
arch/arm64/include/asm/sysreg.h +14 -36
72 lines not on this page · raw message
arch/arm64/include/asm/thread_info.h +0 -5
@@ -29,13 +29,8 @@ struct thread_info {union {u64 preempt_count;/* 0 => preemptible, <0 => bug */ struct { -#ifdef CONFIG_CPU_BIG_ENDIAN -u32 need_resched; -u32 count; -#else u32 count;u32 need_resched; -#endif } preempt; };#ifdef CONFIG_SHADOW_CALL_STACK
arch/arm64/kernel/fpsimd.c +2 -19
@@ -621,23 +621,6 @@ static int __init sme_sysctl_init(void) { return 0; }#define ZREG (sve_state, vq, n) ((char *)(sve_state) + \ (SVE_SIG_ZREG_OFFSET(vq, n) - SVE_SIG_REGS_OFFSET)) -#ifdef CONFIG_CPU_BIG_ENDIAN -static __uint128_t arm64_cpu_to_le128 (__uint128_t x) -{ -u64 a =swab64 (x); -u64 b =swab64 (x >>64 ); - -return ((__uint128_t )a <<64 ) | b; -} -#else -static __uint128_t arm64_cpu_to_le128 (__uint128_t x) -{ -return x; -} -#endif - -#define arm64_le128_to_cpu (x) arm64_cpu_to_le128(x) -static void __fpsimd_to_sve (struct arm64_sve_state *sst,struct user_fpsimd_state const *fst,unsigned int vq)
@@ -647,7 +630,7 @@ static void __fpsimd_to_sve(struct arm64_sve_state *sst,for (i =0 ; i <SVE_NUM_ZREGS ; ++i) { p = (__uint128_t *)ZREG (sst, vq, i); - *p =arm64_cpu_to_le128 (fst->vregs[i]); + *p = fst->vregs[i]; } }
@@ -702,7 +685,7 @@ static inline void sve_to_fpsimd(struct task_struct *task) vq =sve_vq_from_vl (vl);for (i =0 ; i <SVE_NUM_ZREGS ; ++i) { p = (__uint128_t const *)ZREG (sst, vq, i); - fst->vregs[i] =arm64_le128_to_cpu (*p); + fst->vregs[i] = *p; } }
arch/arm64/kernel/image.h +2 -16
@@ -24,28 +24,14 @@* when PIE is in effect. So we need to split them up in 32-bit high and low * words. */ -#ifdef CONFIG_CPU_BIG_ENDIAN -#define DATA_LE32 (data) \ - ((((data) & 0x000000ff) << 24) | \ - (((data) & 0x0000ff00) << 8) | \ - (((data) & 0x00ff0000) >> 8) | \ - (((data) & 0xff000000) >> 24)) -#else -#define DATA_LE32 (data) ((data) & 0xffffffff) -#endif -#define DEFINE_IMAGE_LE64 (sym, data) \ - sym##_lo32 = DATA_LE32((data) & 0xffffffff); \ - sym##_hi32 = DATA_LE32((data) >> 32) + sym##_lo32 = (data) & 0xffffffff; \ + sym##_hi32 = (data) >> 32#define __HEAD_FLAG (field) (__HEAD_FLAG_##field << \ ARM64_IMAGE_FLAG_##field##_SHIFT) -#ifdef CONFIG_CPU_BIG_ENDIAN -#define __HEAD_FLAG_BE ARM64_IMAGE_FLAG_BE -#else #define __HEAD_FLAG_BE ARM64_IMAGE_FLAG_LE -#endif #define __HEAD_FLAG_PAGE_SIZE ((PAGE_SHIFT - 10) / 2)
arch/arm64/kernel/kexec_image.c +2 -3
@@ -40,7 +40,7 @@ static void *image_load(struct kimage *image, {struct arm64_image_header *h;u64 flags, value; -bool be_image, be_kernel; +bool be_image;struct kexec_buf kbuf = {};unsigned long text_offset, kernel_segment_number;struct kexec_segment *kernel_segment;
@@ -58,8 +58,7 @@ static void *image_load(struct kimage *image,/* Check cpu features */ flags =le64_to_cpu (h->flags); be_image =arm64_image_flag_field (flags,ARM64_IMAGE_FLAG_BE ); - be_kernel =IS_ENABLED (CONFIG_CPU_BIG_ENDIAN ); -if ((be_image != be_kernel) && !system_supports_mixed_endian ()) +if (be_image && !system_supports_mixed_endian ())return ERR_PTR (-EINVAL ); value =arm64_image_flag_field (flags,ARM64_IMAGE_FLAG_PAGE_SIZE );
arch/arm64/kernel/kgdb.c +0 -3
@@ -61,9 +61,6 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = {* detail. */ {"pstate" ,4 , offsetof(struct pt_regs , pstate) -#ifdef CONFIG_CPU_BIG_ENDIAN - + 4 -#endif }, { "v0", 16, -1 }, { "v1", 16, -1 },
arch/arm64/kernel/ptrace.c +2 -6
@@ -2467,12 +2467,8 @@ static int valid_compat_regs(struct user_pt_regs *regs) { regs->pstate &= ~SPSR_EL1_AARCH32_RES0_BITS ; -if (!system_supports_mixed_endian_el0 ()) { -if (IS_ENABLED (CONFIG_CPU_BIG_ENDIAN )) - regs->pstate |=PSR_AA32_E_BIT ; -else - regs->pstate &= ~PSR_AA32_E_BIT ; - } +if (!system_supports_mixed_endian_el0 ()) + regs->pstate &= ~PSR_AA32_E_BIT ; if (user_mode(regs) && (regs->pstate & PSR_MODE32_BIT) && (regs->pstate & PSR_AA32_A_BIT) == 0 &&
arch/arm64/kernel/signal32.c +0 -3
@@ -334,9 +334,6 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka,/* The IT state must be cleared for both ARM and Thumb-2 */ spsr &= ~PSR_AA32_IT_MASK ; -/* Restore the original endianness */ - spsr |=PSR_AA32_ENDSTATE ; -if (ka->sa.sa_flags &SA_RESTORER ) { retcode =ptr_to_compat (ka->sa.sa_restorer); }else {
arch/arm64/kernel/sys32.c +0 -5
@@ -59,12 +59,7 @@ COMPAT_SYSCALL_DEFINE6(aarch32_mmap2, unsigned long, addr, unsigned long, len,return ksys_mmap_pgoff (addr, len, prot, flags, fd, off_4k); } -#ifdef CONFIG_CPU_BIG_ENDIAN -#define arg_u32p (name) u32, name##_hi, u32, name##_lo -#else #define arg_u32p (name) u32, name##_lo, u32, name##_hi -#endif -#define arg_u64 (name) (((u64)name##_hi << 32) | name##_lo) COMPAT_SYSCALL_DEFINE6(aarch32_pread64, unsigned int, fd, char __user *, buf,
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Marc Zyngier
maintainerRe: [PATCH 09/12] arm64: Remove all usage of CONFIG_CPU_BIG_ENDIAN
Quoted 6 lines · Will Deacon
Big-endian support on arm64 depends on BROKEN. In preparation for removing the dead code altogether, remove all usage of
CONFIG_CPU_BIG_ENDIANfrom the arm64 kernel port.Signed-off-by Will Deacon <[email protected]>
[...]
arch/arm64/kernel/kgdb.c struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = { · line 64
Quoted 12 lines
arch/arm64/kernel/kgdb.c +0
-3@@ -61,9 +61,6 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = {* detail. */ {"pstate" ,4 , offsetof(struct pt_regs , pstate) -#ifdef CONFIG_CPU_BIG_ENDIAN - + 4 -#endif },
nit: this reads a bit odd now, and could be brought together on a single line.
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Will Deacon
maintainerPATCH 10/12 arm64: Remove all usage of __AARCH64EB__
In reply to Will DeaconBig-endian support on arm64 depends on BROKEN. In preparation for removing the dead code altogether, remove all usage of __AARCH64EB__ from the arm64 kernel port.
--- arch/arm64/include/asm/compat.h | 14 -------------- arch/arm64/include/asm/elf.h | 12 ------------ arch/arm64/include/asm/word-at-a-time.h | 6 ------ arch/arm64/include/uapi/asm/byteorder.h | 4 ---- arch/arm64/kernel/signal32.c | 10 ---------- arch/arm64/mm/extable.c | 5 ----- 6 files changed, 51 deletions(-)
arch/arm64/include/asm/compat.h +0 -14
@@ -28,34 +28,20 @@ typedef u16 compat_ipc_pid_t;#include <linux/sched.h> #include <linux/sched/task_stack.h> -#ifdef __AARCH64EB__ -#define COMPAT_UTS_MACHINE "armv8b\0\0" -#else #define COMPAT_UTS_MACHINE "armv8l\0\0" -#endif typedef u16 __compat_uid16_t ;typedef u16 __compat_gid16_t ;typedef s32 compat_nlink_t ;struct compat_stat { -#ifdef __AARCH64EB__ -short st_dev; -short __pad1; -#else compat_dev_t st_dev; -#endif compat_ino_t st_ino;compat_mode_t st_mode;compat_ushort_t st_nlink;__compat_uid16_t st_uid;__compat_gid16_t st_gid; -#ifdef __AARCH64EB__ -short st_rdev; -short __pad2; -#else compat_dev_t st_rdev; -#endif compat_off_t st_size;compat_off_t st_blksize;compat_off_t st_blocks;
arch/arm64/include/asm/elf.h +0 -12
@@ -72,11 +72,7 @@* These are used to set parameters in the core dumps. */ #define ELF_CLASS ELFCLASS64 -#ifdef __AARCH64EB__ -#define ELF_DATA ELFDATA2MSB -#else #define ELF_DATA ELFDATA2LSB -#endif #define ELF_ARCH EM_AARCH64/*
@@ -85,11 +81,7 @@* intent than poking at uname or /proc/cpuinfo. */ #define ELF_PLATFORM_SIZE 16 -#ifdef __AARCH64EB__ -#define ELF_PLATFORM ("aarch64_be") -#else #define ELF_PLATFORM ("aarch64") -#endif /* * This is used to ensure we don't load something for the wrong architecture.
@@ -195,11 +187,7 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,#define STACK_RND_MASK (0x3ffff >> (PAGE_SHIFT - 12))#endif -#ifdef __AARCH64EB__ -#define COMPAT_ELF_PLATFORM ("v8b") -#else #define COMPAT_ELF_PLATFORM ("v8l") -#endif /* AArch32 registers. */ #define COMPAT_ELF_NGREG 18
arch/arm64/include/asm/word-at-a-time.h +0 -6
@@ -7,8 +7,6 @@#include <linux/uaccess.h> -#ifndef __AARCH64EB__ -#include <linux/bitops.h> #include <linux/wordpart.h>
@@ -36,10 +34,6 @@ static inline unsigned long zero_bytemask(unsigned long bits)return bits >>7 ; } -#else /* __AARCH64EB__ */ -#include <asm-generic/word-at-a-time.h> -#endif -/* * Load an unaligned word from kernel space. *
arch/arm64/include/uapi/asm/byteorder.h +0 -4
@@ -17,10 +17,6 @@#ifndef __ASM_BYTEORDER_H#define __ASM_BYTEORDER_H -#ifdef __AARCH64EB__ -#include <linux/byteorder/big_endian.h> -#else #include <linux/byteorder/little_endian.h> -#endif #endif /* __ASM_BYTEORDER_H */
arch/arm64/kernel/signal32.c +0 -10
@@ -70,22 +70,12 @@ static inline int get_sigset_t(sigset_t *set,/* * VFP save/restore code. -* -* We have to be careful with endianness, since the fpsimd context-switch -* code operates on 128-bit (Q) register values whereas the compat ABI -* uses an array of 64-bit (D) registers. Consequently, we need to swap -* the two halves of each Q register when running on a big-endian CPU. */ union __fpsimd_vreg {__uint128_t raw;struct { -#ifdef __AARCH64EB__ -u64 hi; -u64 lo; -#else u64 lo;u64 hi; -#endif }; };
arch/arm64/mm/extable.c +0 -5
@@ -79,12 +79,7 @@ ex_handler_load_unaligned_zeropad(const struct exception_table_entry *ex, addr &= ~0x7UL ; data = *(unsigned long *)addr; - -#ifndef __AARCH64EB__ data >>=8 * offset; -#else - data <<=8 * offset; -#endif pt_regs_write_reg (regs, reg_data, data);
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Will Deacon
maintainerPATCH 11/12 arm64: image: Remove endianness handling for generating image header
In reply to Will DeaconSince big-endian support for arm64 depends on BROKEN, we don't need to bother jumping through hoops to generate a little-endian kernel image header for a big-endian target. We can just ignore the possibility instead.
--- arch/arm64/include/asm/assembler.h | 11 ----------- arch/arm64/kernel/head.S | 4 ++-- arch/arm64/kernel/image.h | 24 ++---------------------- 3 files changed, 4 insertions(+), 35 deletions(-)
arch/arm64/include/asm/assembler.h +0 -11
@@ -525,17 +525,6 @@ alternative_else_nop_endif#define EXPORT_SYMBOL_NOKASAN (name) EXPORT_SYMBOL(name)#endif -/* -* Emit a 64-bit absolute little endian symbol reference in a way that -* ensures that it will be resolved at build time, even when building a -* PIE binary. This requires cooperation from the linker script, which -* must emit the lo32/hi32 halves individually. -*/ - .macro le64sym, sym - .long \sym\()_lo32 - .long \sym\()_hi32 - .endm -/* * mov_q - move an immediate constant into a 64-bit register using * between 2 and 4 movz/movk instructions (depending on the
arch/arm64/kernel/head.S +2 -2
@@ -61,8 +61,8 @@ efi_signature_nop // special NOP to identity as PE/COFF executable b primary_entry // branch to kernel start, magic .quad 0 // Image load offset from start of RAM, little-endian - le64sym _kernel_size_le // Effective size of kernel image, little-endian - le64sym _kernel_flags_le // Informative flags, little-endian + .quad _kernel_size_le // Effective size of kernel image, little-endian + .quad _kernel_flags_le // Informative flags, little-endian .quad 0 // reserved .quad 0 // reserved .quad 0 // reserved
arch/arm64/kernel/image.h +2 -22
@@ -13,21 +13,6 @@#include <asm/image.h> -/* -* There aren't any ELF relocations we can use to endian-swap values known only -* at link time (e.g. the subtraction of two symbol addresses), so we must get -* the linker to endian-swap certain values before emitting them. -* -* Note that, in order for this to work when building the ELF64 PIE executable -* (for KASLR), these values should not be referenced via R_AARCH64_ABS64 -* relocations, since these are fixed up at runtime rather than at build time -* when PIE is in effect. So we need to split them up in 32-bit high and low -* words. -*/ -#define DEFINE_IMAGE_LE64 (sym, data) \ - sym##_lo32 = (data) & 0xffffffff; \ - sym##_hi32 = (data) >> 32 -#define __HEAD_FLAG (field) (__HEAD_FLAG_##field << \ ARM64_IMAGE_FLAG_##field##_SHIFT)
@@ -41,13 +26,8 @@ __HEAD_FLAG(PAGE_SIZE) | \ __HEAD_FLAG(PHYS_BASE)) -/* -* These will output as part of the Image header, which should be little-endian -* regardless of the endianness of the kernel. While constant values could be -* endian swapped in head.S, all are done here for consistency. -*/ #define HEAD_SYMBOLS \ - DEFINE_IMAGE_LE64(_kernel_size_le, _end - _text); \ - DEFINE_IMAGE_LE64(_kernel_flags_le, __HEAD_FLAGS); + _kernel_size_le = _end - _text; \ + _kernel_flags_le = __HEAD_FLAGS;#endif /* __ARM64_KERNEL_IMAGE_H */
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Will Deacon
maintainerPATCH 12/12 arm64: Kbuild: Remove vestigial big-endian support
In reply to Will DeaconSince 1cf89b6bf660 ("arm64: Kconfig: Make CPU_BIG_ENDIAN depend on BROKEN"), CONFIG_CPU_BIG_ENDIAN has depended on BROKEN for arm64.
Remove the last traces of its existence and unconditionally force a little-endian kernel build.
--- arch/arm64/Kconfig | 35 ++++------------------------------- arch/arm64/Makefile | 12 ++---------- 2 files changed, 6 insertions(+), 41 deletions(-)
arch/arm64/Kconfig +4 -31
@@ -73,7 +73,7 @@ config ARM64 select ARCH_SUPPORTS_HUGETLBFS select ARCH_SUPPORTS_MEMORY_FAILURE select ARCH_SUPPORTS_SHADOW_CALL_STACK if CC_HAVE_SHADOW_CALL_STACK - select ARCH_SUPPORTS_LTO_CLANG if CPU_LITTLE_ENDIAN + select ARCH_SUPPORTS_LTO_CLANG select ARCH_SUPPORTS_LTO_CLANG_THIN select ARCH_SUPPORTS_CFI select ARCH_SUPPORTS_ATOMIC_RMW
@@ -223,7 +223,7 @@ config ARM64 select HAVE_FUNCTION_ARG_ACCESS_API select MMU_GATHER_RCU_TABLE_FREE select HAVE_RSEQ - select HAVE_RUST if RUSTC_SUPPORTS_ARM64 + select HAVE_RUST select HAVE_STACKPROTECTOR select HAVE_STATIC_CALL if CFI select HAVE_SYSCALL_TRACEPOINTS
@@ -262,10 +262,6 @@ config ARM64 help ARM 64-bit (AArch64) Linux support. -config RUSTC_SUPPORTS_ARM64 - def_bool y - depends on CPU_LITTLE_ENDIAN - config CLANG_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS def_bool CC_IS_CLANG # https://github.com/ClangBuiltLinux/linux/issues/1507
@@ -1542,28 +1538,6 @@ config ARM64_LPA2 def_bool y depends on ARM64_PA_BITS_52 && !ARM64_64K_PAGES -choice - prompt "Endianness" - default CPU_LITTLE_ENDIAN - help - Select the endianness of data accesses performed by the CPU. Userspace - applications will need to be compiled and linked for the endianness - that is selected here. - -config CPU_BIG_ENDIAN - bool "Build big-endian kernel" - depends on BROKEN - help - Say Y if you plan on running a kernel with a big-endian userspace. - -config CPU_LITTLE_ENDIAN - bool "Build little-endian kernel" - help - Say Y if you plan on running a kernel with a little-endian userspace. - This is usually the case for distributions targeting arm64. - -endchoice - config NR_CPUS int "Maximum number of CPUs (2-4096)" range 2 4096
@@ -1801,7 +1775,6 @@ config KUSER_HELPERS config COMPAT_VDSO bool "Enable vDSO for 32-bit applications" - depends on !CPU_BIG_ENDIAN depends on (CC_IS_CLANG && LD_IS_LLD) || "$(CROSS_COMPILE_COMPAT)" != "" default y help
@@ -2263,7 +2236,7 @@ menu "ARMv9.6 architectural features" config ARM64_LSUI bool "Support Unprivileged Load Store Instructions (LSUI)" default y - depends on AS_HAS_LSUI && !CPU_BIG_ENDIAN + depends on AS_HAS_LSUI help The Unprivileged Load Store Instructions (LSUI) provides variants load/store instructions that access user-space memory
@@ -2468,7 +2441,7 @@ config EFI_STUB config EFI bool "UEFI runtime support" - depends on OF && !CPU_BIG_ENDIAN + depends on OF depends on KERNEL_MODE_NEON select ARCH_SUPPORTS_ACPI select LIBFDT
arch/arm64/Makefile +2 -10
@@ -119,20 +119,12 @@ KBUILD_CFLAGS += -ffixed-x18 KBUILD_RUSTFLAGS += -Zfixed-x18 endif -ifeq ($(CONFIG_CPU_BIG_ENDIAN), y) -KBUILD_CPPFLAGS += -mbig-endian -CHECKFLAGS += -D__AARCH64EB__ -# Prefer the baremetal ELF build target, but not all toolchains include -# it so fall back to the standard linux version if needed. -KBUILD_LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb -z norelro) -UTS_MACHINE := aarch64_be -else KBUILD_CPPFLAGS += -mlittle-endian CHECKFLAGS += -D__AARCH64EL__ -# Same as above, prefer ELF but fall back to linux target if needed. +# Prefer the baremetal ELF build target, but not all toolchains include +# it so fall back to the standard linux version if needed. KBUILD_LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux -z norelro) UTS_MACHINE := aarch64 -endif ifeq ($(CONFIG_LD_IS_LLD), y) KBUILD_LDFLAGS += -z norelro
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
Quoted 13 lines · Will Deacon
Hi folks,
Big-endian support on arm64 (
CONFIG_CPU_BIG_ENDIAN) has depended on BROKEN since1cf89b6bf660("arm64:Kconfig: MakeCPU_BIG_ENDIANdepend on BROKEN") and has already seen some clean-up patches removing some of the unused support code (e.g.5276ea17a23c("lib/crc: arm64: Assume a little-endian kernel")).Finish the job, and remove the remaining big-endian support code from arm64. Note that the SETEND emulation for 32-bit tasks remains and so some of the mixed-endian EL0 helpers are retained.
Quoted 5 lines
I've broken this down into fairly coarse chunks, as it seemed a lot easier to manage than one giant patch (even with the
Kconfigbeing effectively disabled already) and not all of it is just mindless deletion. Despite that, I'm anticipating the whole thing going via the arm64 tree.
FWIW:
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Quoted 11 lines · Will Deacon
Hi folks,
Big-endian support on arm64 (
CONFIG_CPU_BIG_ENDIAN) has depended on BROKEN since1cf89b6bf660("arm64:Kconfig: MakeCPU_BIG_ENDIANdepend on BROKEN") and has already seen some clean-up patches removing some of the unused support code (e.g.5276ea17a23c("lib/crc: arm64: Assume a little-endian kernel")).Finish the job, and remove the remaining big-endian support code from arm64. Note that the SETEND emulation for 32-bit tasks remains and so some of the mixed-endian EL0 helpers are retained.
I had not expected the removal to come this soon, but I'm not complaining about that. I assume you are planning this for 7.4, leaving 7.3-LTS to still have the code in case someone wants to still use it, right?
Not sure if you saw
so for 7.3, we have marked big-endian mode in arm32 as deprecated as well, and also managed to get ixp4xx working again in little-endian mode, which was slightly broken for a few years. It may be good to add a reference to your series for context.
My suggestions there was to possibly remove arm32 big-endian mode at the same time as on arm64, but that does feel a little rushed if ixp4xx only has one release of supporting both, and removing be8 but leaving be32 for a little while longer is probably not worth it.
Quoted 5 lines
I've broken this down into fairly coarse chunks, as it seemed a lot easier to manage than one giant patch (even with the
Kconfigbeing effectively disabled already) and not all of it is just mindless deletion. Despite that, I'm anticipating the whole thing going via the arm64 tree.
I would have done even larger patches, this does already feel fairly fine-grained to me ;-). I had a look at the individual patches to make sure this all makes sense, and I found nothing wrong here.
For a 7.4 (or later) merge:
There are also a few arm64 specific drivers that I think no longer need a dependency, but none of that is important:
drivers/crypto/hisilicon/Kconfig +0 -1
@@ -53,7 +53,6 @@ config CRYPTO_DEV_HISI_ZIP tristate "Support for HiSilicon ZIP accelerator" depends on PCI_MSI depends on ARM64 || (COMPILE_TEST && 64BIT) - depends on !CPU_BIG_ENDIAN || COMPILE_TEST depends on UACCE || UACCE=n depends on ACPI select CRYPTO_DEV_HISI_QM
drivers/firmware/qcom/Kconfig +0 -1
@@ -18,7 +18,6 @@ config QCOM_PAS_TEE tristate "Qualcomm PAS TEE interface driver" select QCOM_PAS depends on TEE - depends on !CPU_BIG_ENDIAN default m if ARCH_QCOM help Enable the generic Peripheral Authentication Service (PAS) provided
drivers/firmware/tegra/Kconfig +0 -1
@@ -14,7 +14,6 @@ config TEGRA_IVC config TEGRA_BPMP bool "Tegra BPMP driver" depends on ARCH_TEGRA && TEGRA_HSP_MBOX - depends on !CPU_BIG_ENDIAN select TEGRA_IVC help BPMP (Boot and Power Management Processor) is designed to off-loading
drivers/soc/tegra/Kconfig +0 -5
@@ -102,7 +102,6 @@ config ARCH_TEGRA_210_SOC config ARCH_TEGRA_186_SOC bool "NVIDIA Tegra186 SoC" default ARCH_TEGRA - depends on !CPU_BIG_ENDIAN select PINCTRL_TEGRA186 select MAILBOX select SOC_TEGRA_PMC
@@ -117,7 +116,6 @@ config ARCH_TEGRA_186_SOC config ARCH_TEGRA_194_SOC bool "NVIDIA Tegra194 SoC" default ARCH_TEGRA - depends on !CPU_BIG_ENDIAN select MAILBOX select PINCTRL_TEGRA194 select SOC_TEGRA_PMC
@@ -127,7 +125,6 @@ config ARCH_TEGRA_194_SOC config ARCH_TEGRA_234_SOC bool "NVIDIA Tegra234 SoC" default ARCH_TEGRA - depends on !CPU_BIG_ENDIAN select MAILBOX select PINCTRL_TEGRA234 select SOC_TEGRA_PMC
@@ -137,7 +134,6 @@ config ARCH_TEGRA_234_SOC config ARCH_TEGRA_238_SOC bool "NVIDIA Tegra238 SoC" default ARCH_TEGRA - depends on !CPU_BIG_ENDIAN select MAILBOX select SOC_TEGRA_PMC help
@@ -152,7 +148,6 @@ config ARCH_TEGRA_241_SOC config ARCH_TEGRA_264_SOC bool "NVIDIA Tegra264 SoC" default ARCH_TEGRA - depends on !CPU_BIG_ENDIAN select MAILBOX select SOC_TEGRA_PMC help
drivers/tee/qcomtee/Kconfig +0 -1
@@ -3,7 +3,6 @@ config QCOMTEE tristate "Qualcomm TEE Support" depends on ARCH_QCOM || COMPILE_TEST - depends on !CPU_BIG_ENDIAN select QCOM_SCM select QCOM_TZMEM_MODE_SHMBRIDGE help
Will Deacon
maintainerHi Arnd,
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · Will Deacon
Big-endian support on arm64 (
CONFIG_CPU_BIG_ENDIAN) has depended on BROKEN since1cf89b6bf660("arm64:Kconfig: MakeCPU_BIG_ENDIANdepend on BROKEN") and has already seen some clean-up patches removing some of the unused support code (e.g.5276ea17a23c("lib/crc: arm64: Assume a little-endian kernel")).
Quoted 8 lines
Quoted 3 lines
Finish the job, and remove the remaining big-endian support code from arm64. Note that the SETEND emulation for 32-bit tasks remains and so some of the mixed-endian EL0 helpers are retained.
I had not expected the removal to come this soon, but I'm not complaining about that. I assume you are planning this for 7.4, leaving 7.3-LTS to still have the code in case someone wants to still use it, right?
Yes, this is for 7.4.
Quoted 10 lines
Not sure if you saw
so for 7.3, we have marked big-endian mode in arm32 as deprecated as well, and also managed to get ixp4xx working again in little-endian mode, which was slightly broken for a few years. It may be good to add a reference to your series for context.
Thanks, I'll do that!
Quoted 4 lines
My suggestions there was to possibly remove arm32 big-endian mode at the same time as on arm64, but that does feel a little rushed if ixp4xx only has one release of supporting both, and removing be8 but leaving be32 for a little while longer is probably not worth it.
Yeah, maybe give it another LTS on the arm32 side? I think arm64 going first is ok, though.
Quoted 9 lines
Quoted 5 lines
I've broken this down into fairly coarse chunks, as it seemed a lot easier to manage than one giant patch (even with the
Kconfigbeing effectively disabled already) and not all of it is just mindless deletion. Despite that, I'm anticipating the whole thing going via the arm64 tree.I would have done even larger patches, this does already feel fairly fine-grained to me ;-). I had a look at the individual patches to make sure this all makes sense, and I found nothing wrong here.
If it was just a sed script or similar, I think I'd would've done a giant patch, but some of it is surprisingly error-prone (e.g. when you have a file with a load of '#ifdef CPU_BIG_ENDIAN' and then an '#ifndef CPU_BIG_ENDIAN' hiding in the middle of it all).
Quoted 6 lines
For a 7.4 (or later) merge:
Acked-by Arnd Bergmann <[email protected]>There are also a few arm64 specific drivers that I think no longer need a dependency, but none of that is important:
I think there might also be some logic in the SMMUv3 driver which could go. Perhaps I'll add a driver patch on the end of the next version to pick this up.
Cheers,
Will
Quoted 10 lines · Will Deacon
Quoted 6 lines · Arnd Bergmann
On Tue, Aug 11, 2026, at 16:01, Will Deacon wrote:
My suggestions there was to possibly remove arm32 big-endian mode at the same time as on arm64, but that does feel a little rushed if ixp4xx only has one release of supporting both, and removing be8 but leaving be32 for a little while longer is probably not worth it.
Yeah, maybe give it another LTS on the arm32 side? I think arm64 going first is ok, though.
Right, one more LTS for 32-bit is probably good. We'll see how the OpenWRT/ixp4xx conversion goes for users.
My feeling so far is that running ixp4xx in LE mode is probably fine (there may still be driver bugs), but flashing a running system from one mode to the other is a bit risky and BE32 mode makes this more confusing the BE8.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
I've broken this down into fairly coarse chunks, as it seemed a lot easier to manage than one giant patch (even with the
Kconfigbeing effectively disabled already) and not all of it is just mindless deletion. Despite that, I'm anticipating the whole thing going via the arm64 tree.
Quoted 8 lines
Quoted 3 lines
I would have done even larger patches, this does already feel fairly fine-grained to me ;-). I had a look at the individual patches to make sure this all makes sense, and I found nothing wrong here.
If it was just a sed script or similar, I think I'd would've done a giant patch, but some of it is surprisingly error-prone (e.g. when you have a file with a load of '#ifdef
CPU_BIG_ENDIAN' and then an '#ifndefCPU_BIG_ENDIAN' hiding in the middle of it all).
Yes, definitely, I've found out the hard way during other feature removal before.
scripts/unifdef.c should be able to help with this, but I never remember that this is a thing.
Arnd
Will Deacon
maintainerQuoted 35 lines · Arnd Bergmann
Quoted 10 lines · Will Deacon
Quoted 6 lines · Arnd Bergmann
On Tue, Aug 11, 2026, at 16:01, Will Deacon wrote:
My suggestions there was to possibly remove arm32 big-endian mode at the same time as on arm64, but that does feel a little rushed if ixp4xx only has one release of supporting both, and removing be8 but leaving be32 for a little while longer is probably not worth it.
Yeah, maybe give it another LTS on the arm32 side? I think arm64 going first is ok, though.
Right, one more LTS for 32-bit is probably good. We'll see how the OpenWRT/ixp4xx conversion goes for users.
My feeling so far is that running ixp4xx in LE mode is probably fine (there may still be driver bugs), but flashing a running system from one mode to the other is a bit risky and BE32 mode makes this more confusing the BE8.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
I've broken this down into fairly coarse chunks, as it seemed a lot easier to manage than one giant patch (even with the
Kconfigbeing effectively disabled already) and not all of it is just mindless deletion. Despite that, I'm anticipating the whole thing going via the arm64 tree.Quoted 8 lines
Quoted 3 lines
I would have done even larger patches, this does already feel fairly fine-grained to me ;-). I had a look at the individual patches to make sure this all makes sense, and I found nothing wrong here.
If it was just a sed script or similar, I think I'd would've done a giant patch, but some of it is surprisingly error-prone (e.g. when you have a file with a load of '#ifdef
CPU_BIG_ENDIAN' and then an '#ifndefCPU_BIG_ENDIAN' hiding in the middle of it all).
Quoted 5 lines
Yes, definitely, I've found out the hard way during other feature removal before.
scripts/unifdef.cshould be able to help with this, but I never remember that this is a thing.
I didn't even know about that! I'll see if it spots anything I missed...
Will
Eric Biggers
Acked-byQuoted 4 lines · Arnd Bergmann
I had not expected the removal to come this soon, but I'm not complaining about that. I assume you are planning this for 7.4, leaving 7.3-LTS to still have the code in case someone wants to still use it, right?
It's already been BROKEN (and thus is dead code) since v6.18. Some of that dead code has already been removed. Other code never actually worked correctly on big endian in the first place and no one ever cared.
- Eric
Quoted 11 lines · Will Deacon
Hi folks,
Big-endian support on arm64 (
CONFIG_CPU_BIG_ENDIAN) has depended on BROKEN since1cf89b6bf660("arm64:Kconfig: MakeCPU_BIG_ENDIANdepend on BROKEN") and has already seen some clean-up patches removing some of the unused support code (e.g.5276ea17a23c("lib/crc: arm64: Assume a little-endian kernel")).Finish the job, and remove the remaining big-endian support code from arm64. Note that the SETEND emulation for 32-bit tasks remains and so some of the mixed-endian EL0 helpers are retained.