[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a033a402-e3c5-4982-9fff-b6a4c55817ae@kernel.org>
Date: Fri, 2 Jan 2026 13:53:22 -0800
From: Vineet Gupta <vgupta@...nel.org>
To: Arnd Bergmann <arnd@...db.de>,
Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
Vineet Gupta <vgupta@...nel.org>, Russell King <linux@...linux.org.uk>,
Dinh Nguyen <dinguyen@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>
Cc: linux-snps-arc@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 1/5] ARC: uapi: Stop leaking CONFIG_ARC_HAS_SWAPE
reference to userspace
Hi Arnd,
Long time no see. Happy New Year !
On 12/30/25 13:23, Arnd Bergmann wrote:
> On Tue, Dec 30, 2025, at 08:10, Thomas Weißschuh wrote:
>> UAPI headers are not supposed to leak references to kconfig symbols.
>> These won't be set when building userspace. Hide the kconfig reference
>> behind 'if defined(__KERNEL__)', so it will be stripped by
>> headers_install.sh. The result for userspace will be the same, but the
>> exception in headers_install.sh can also be removed.
>>
>> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
> Acked-by: Arnd Bergmann <arnd@...db.de>
>
> Same as for the nios2 version, I think the nicer solution would
> be to use the asm-generic header for uapi and move this one
> to arch/arc/include/asm/swab.h for kernel-internal use.
>
> In theory, using 'select ARCH_USE_BUILTIN_BSWAP' in Kconfig should
> let the compiler pick the best swap instruction, which would
> be even less code, but I'm not sure if there was a reason that
> nios2 and arc don't already do this.
The builtins didn't exist when the insns were first rolled out in hw.
It seems ARCH_USE_BUILTIN_BSWAP assumes 16,32,64 variants to be available which
surprisingly seems to be true.
foo32:
j_s.d [blink]
swape r0,r0
foo16:
exth_s r0,r0
asl r2,r0,8
lsr_s r0,r0,8
or_s r0,r0,r2
j_s.d [blink]
exth_s r0,r0
foo64:
mov_s r2,r1 ;4
swape r1,r0
j_s.d [blink]
swape r0,r2
And as you said, since all upstream cores support SWAPE, we can really get rid
of all the legacy stuff and just rely on builtins.
Thx,
-Vineet
Powered by blists - more mailing lists