Received: by 10.223.176.46 with SMTP id f43csp2211474wra; Thu, 25 Jan 2018 06:37:21 -0800 (PST) X-Google-Smtp-Source: AH8x224LMrvms1p9YQnHdERAHdTcy0uU9Y9FKeaejf7oLkSfGavYS/bESgX2Xh/SN8ByYF15Lq3W X-Received: by 2002:a17:902:2bc5:: with SMTP id l63-v6mr4260121plb.108.1516891041708; Thu, 25 Jan 2018 06:37:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516891041; cv=none; d=google.com; s=arc-20160816; b=Lyptjy95S+4+T9lAHfxuCoZWHInrNrtQBtkYc7m8rnQ2iwNUK8KG/fx5SQj49Kvm7b spAaD8H8zjCbjK6RsUXZ+/SeuRLUgVyOC1f/hJNbSJpN4F27I0RfpXbvr/3dqeSE4Xyo ePCsG8Mtdt0gr5UJ37zF237nG66D5jmq02mAZDc4eHfQFZMzzXujUL702cGXE0pzUehv UvXMv3100LAkzPKdRqiqlwTn2HF9CsKE4l59AEbFPVs0NCevbsDf91zYIxV8aoB2zwpI 8AJyDakHtvdHeTqDXY5kGq8dAE6oCWWuczutwuMoHIO+j+G2KNTcz7Sxf+4/OxDnVerJ FIvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=E6Pd7IKnfUkdcQ/nmJl29jYFstGnVT07D1enlqGay/0=; b=xvirTZpGZeQ0rAnHD6aWE+NzZIoyzp5iR1fkqyQpNxi4zpU5nvU6pg3OI98rfE4SM5 nr+JrOVLYq+VO6lvjt906BtSE1EymP4n6Wj/NzIh7KIurUU90qFD4h8OcWbbrYJg3gKh k+U+nBq4YaUEH3KxTsfKrxegGO2RIzjhGOseRLlZUKYWprkNJqC69UbyAts1Af8AEape THY1J5jyP59PKM9quRWNn3MhDn2whJ9qf2Mja29w3mO1PhAAwbfU5AHPsYcqZbLS8TEG NB4WlKunyWWjjw2M+Og5+S77WM6/l0d62HUfAM9jhsIjfX/OgJoafPbeXblYpCrfv2oV PvZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=af6p0Jgu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d37-v6si2059045plb.293.2018.01.25.06.37.07; Thu, 25 Jan 2018 06:37:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=af6p0Jgu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751421AbeAYN7i (ORCPT + 99 others); Thu, 25 Jan 2018 08:59:38 -0500 Received: from mail-ot0-f195.google.com ([74.125.82.195]:41121 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750980AbeAYN7g (ORCPT ); Thu, 25 Jan 2018 08:59:36 -0500 Received: by mail-ot0-f195.google.com with SMTP id 44so6740202otk.8; Thu, 25 Jan 2018 05:59:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=E6Pd7IKnfUkdcQ/nmJl29jYFstGnVT07D1enlqGay/0=; b=af6p0JguGG4I1y2PVrIfO9Hqy09te2LedUULfTtJMZ6Nachk8zsFFkBo2rmmdLlP38 pG5ss6hW41sRMzEZKRIuDMsJjU+yuklMybDHxCtcKKLOKZSn5VE1VnX/w3MWDjn4jUio 9VHgrVMcrliuU067TaoBTS/32EAoi0IHAOOKLS+ggVK63GgYzZ9jn7RXI4m6SytA5+l+ KbNep+377Blk11gC/w5nMWtU7caoO1YCDFTTMWCpGVIBmBXKmR7YqpykGiNJprN9KzwO qVmXxSidMTKg25Xif402lRTVDnb9EwRrWGPlvUcreShDHbs4rgV6osQIADuZRk173H3N tj4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=E6Pd7IKnfUkdcQ/nmJl29jYFstGnVT07D1enlqGay/0=; b=kSXjEwzH4sq2ODVYerXJWHK04ZDG9bZNfPo/BDhTMsK1odcOcbcNzWj1OuASorA8ZY o4Ri+AuT1UfobYqCJOvZ/OZgUQEyuCAw02WM9aNGi6xwiU2LimF/tGaQyybBhcc3u8So JB2A+ZD+I+6zVWqbzbn6aQbSPQq7Ae78tPJesTlv8WLB18AcgP/l136tcI90iUlXrDuW cMe+5VR+8i79L9olk0UMi2zGFWS4P/1U5jf15VaezqKqljMKHPcmPFr3ByE/SwIhA6fE 2t2gj3dk6EHlm86j2k9TXr9Kd0ybLWHsGKZao1M6xjsXA+f25by18c+TbkyP8bDP0HWX 8Rdg== X-Gm-Message-State: AKwxyte5FmFTxdzFBwYOHk5g3Ecz0qvJNEuzQKLcaxn3KQsCTppNH3l/ JKJOhDsvM3Rp9vVNNgIPMbg4qXihqzAUzzgiEVw= X-Received: by 10.157.69.67 with SMTP id p3mr12330496oti.351.1516888774418; Thu, 25 Jan 2018 05:59:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.68.119 with HTTP; Thu, 25 Jan 2018 05:59:34 -0800 (PST) In-Reply-To: <20180125113843.vgv6kyp7qjd75qif@yury-thinkpad> References: <20180125113843.vgv6kyp7qjd75qif@yury-thinkpad> From: Arnd Bergmann Date: Thu, 25 Jan 2018 14:59:34 +0100 X-Google-Sender-Auth: qwWoHvAQx0weybCyOjiGD-BLOUU Message-ID: Subject: Re: [PATCH RFC 0/3] API for 128-bit IO access To: Yury Norov Cc: Linux ARM , linux-arch , Linux Kernel Mailing List , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Al Viro , Andrew Morton , Andrew Pinski , Catalin Marinas , "David S . Miller" , Geethasowjanya Akula , Greg Kroah-Hartman , Ingo Molnar , Kees Cook , Laura Abbott , Nicholas Piggin , Sunil Goutham , Will Deacon , Jeffrey Walton Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 25, 2018 at 12:38 PM, Yury Norov 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 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