[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a1gn5KFur-Vs9wCW4odLyJ=WbWjcHb7bgEBgUjETG4VEA@mail.gmail.com>
Date: Thu, 25 Jan 2018 14:59:34 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Yury Norov <ynorov@...iumnetworks.com>
Cc: Linux ARM <linux-arm-kernel@...ts.infradead.org>,
linux-arch <linux-arch@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"open list:HARDWARE RANDOM NUMBER GENERATOR CORE"
<linux-crypto@...r.kernel.org>, Al Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Andrew Pinski <Andrew.Pinski@...ium.com>,
Catalin Marinas <catalin.marinas@....com>,
"David S . Miller" <davem@...emloft.net>,
Geethasowjanya Akula <Geethasowjanya.Akula@...ium.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ingo Molnar <mingo@...nel.org>,
Kees Cook <keescook@...omium.org>,
Laura Abbott <labbott@...hat.com>,
Nicholas Piggin <npiggin@...il.com>,
Sunil Goutham <Sunil.Goutham@...ium.com>,
Will Deacon <will.deacon@....com>,
Jeffrey Walton <noloader@...il.com>
Subject: Re: [PATCH RFC 0/3] API for 128-bit IO access
On Thu, Jan 25, 2018 at 12:38 PM, Yury Norov <ynorov@...iumnetworks.com> wrote:
> On Wed, Jan 24, 2018 at 11:28:55AM +0100, Arnd Bergmann wrote:
>> On Wed, Jan 24, 2018 at 10:05 AM, Yury Norov <ynorov@...iumnetworks.com> wrote:
> Thanks for doing this test. Looking at this I realize that this is
> not the architecture feature but compiler feature. So if we add
> 128-bit interface, it would be reasonable to add it for all targets
> that compiled with toolchain supporting 128-bit accesses.
>
> There's already the option ARCH_SUPPORTS_INT128 that is enabled for
> x86_64 in arch/x86/Kconfig and conditionally enabled for arm64 in
> arch/arm64/Makefile:
> KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128)
>
> It is used in include/linux/math64.h and in lib/ubsan.c, not so wide.
>
> So I find things little messed. Crypto code ignores compilers' ability
> to operate with 128-bit numbers. Ubsan and math64 relies on compiler
> version (at least for arm64, and I doubt it would work correctly with clang).
> And now I introduce HAVE_128BIT_ACCESS with the same meaning for memory
> access.
>
> I think it's time to unify 128-bit code:
> - enable CONFIG_ARCH_SUPPORTS_INT128 if compiler supports it, ie check
> it like you do below;
> - declare u128 as structure or typedef depending on ARCH_SUPPORTS_INT128
> in generic include/linux/int128.h, as you suggest here;
> - switch this series to ARCH_SUPPORTS_INT128.
>
> Does it sound reasonable?
The CONFIG_* symbol namespace should not be set dynamically. However, you
can define a symbol with another name, e.g. ARCH_SUPPORTS_INT128 (without
CONFIG_ prefix) in linux/compiler-gcc.h based on the version and BITS_PER_LONG.
Arnd
Powered by blists - more mailing lists