From patchwork Tue Mar 24 08:48:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 197945 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A96E2C54FCF for ; Tue, 24 Mar 2020 08:51:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7EBB1208CA for ; Tue, 24 Mar 2020 08:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585039883; bh=ZGQunMWG2zWvXeH8QdOHrss1nr5uCJXv+n5KXe2k6DI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=R+OMbs2F4Xu707soIXRcYrJa2EMKek+PWWIrEiPaxrVP2EujBBdeid9Nr4ysVqxPo sbamS4DIjX85NZuQicOpsDyYtntFH+JvTJTfuqjJjaj8k3105ykyCpE46mYSfg2TZW RGb77CIT9Ggzqc23hmIUEF2+65sOMioXLEGuI7ZQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727383AbgCXIvW (ORCPT ); Tue, 24 Mar 2020 04:51:22 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:17573 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727261AbgCXIvV (ORCPT ); Tue, 24 Mar 2020 04:51:21 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id 02O8mgsY011219; Tue, 24 Mar 2020 17:48:44 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 02O8mgsY011219 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1585039725; bh=Zh5UxR06uJCD24GzekHGCCPt3LyuPsfIaph9vVkw9LY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L4sWk0ZSK1bL75s+iro4Oe0VKEyW1SvlGGCTKWdN1nBVsPxmYqwrxQfyjFxQaETHM go03QH7hFsgQLyNun1Hz2mW/RPsnUeXbeweeUBW0foMKkvHNbVWyPT1gUjsPX3Ym4w yoCNo1MgEG49wUjpbkm9r669Va9PeMEEWC9twGMDdT5wZdQTrEYY+fjO8mHKXpz3y9 Eh8xTWXNFDQM2txV7oyU/uNRFx1UAlJw68aPnpBwB7TJtn1mSaw8GKY44cp3u3cLP1 mgGQaGH7gF4qWq5cyw+LvzJjpbA8KA97NAGmwzXWt2KF3pqTbL5IkiP9uB9Tb5jVDQ s3/1a5k0KcYDw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kernel@vger.kernel.org Cc: "David S . Miller" , Linus Torvalds , Kees Cook , clang-built-linux@googlegroups.com, Herbert Xu , linux-crypto@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Borislav Petkov , Peter Zijlstra , "H . Peter Anvin" , x86@kernel.org, linux-kbuild@vger.kernel.org, Masahiro Yamada , Jim Kukunas , NeilBrown , Yuanhan Liu Subject: [PATCH 01/16] lib/raid6/test: fix build on distros whose /bin/sh is not bash Date: Tue, 24 Mar 2020 17:48:06 +0900 Message-Id: <20200324084821.29944-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324084821.29944-1-masahiroy@kernel.org> References: <20200324084821.29944-1-masahiroy@kernel.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org You can test raid6 library code from user-space, like this: $ cd lib/raid6/test $ make The command in $(shell ...) function is evaluated by /bin/sh by default. (or, you can change the default shell by setting 'SHELL' in Makefile) Currently '>&/dev/null' is used to sink both stdout and stderr. Because this code is bash-ism, it only works when /bin/sh is a symbolic link to bash (this is the case on RHEL etc.) This does not work on Ubuntu where /bin/sh is a symbolic link to dash. I see lots of /bin/sh: 1: Syntax error: Bad fd number and warning "your version of binutils lacks ... support" Replace it with portable '>/dev/null 2>&1'. Fixes: 4f8c55c5ad49 ("lib/raid6: build proper files on corresponding arch") Signed-off-by: Masahiro Yamada Acked-by: H. Peter Anvin (Intel) --- lib/raid6/test/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile index 3ab8720aa2f8..b9e6c3648be1 100644 --- a/lib/raid6/test/Makefile +++ b/lib/raid6/test/Makefile @@ -35,13 +35,13 @@ endif ifeq ($(IS_X86),yes) OBJS += mmx.o sse1.o sse2.o avx2.o recov_ssse3.o recov_avx2.o avx512.o recov_avx512.o CFLAGS += $(shell echo "pshufb %xmm0, %xmm0" | \ - gcc -c -x assembler - >&/dev/null && \ + gcc -c -x assembler - >/dev/null 2>&1 && \ rm ./-.o && echo -DCONFIG_AS_SSSE3=1) CFLAGS += $(shell echo "vpbroadcastb %xmm0, %ymm1" | \ - gcc -c -x assembler - >&/dev/null && \ + gcc -c -x assembler - >/dev/null 2>&1 && \ rm ./-.o && echo -DCONFIG_AS_AVX2=1) CFLAGS += $(shell echo "vpmovm2b %k1, %zmm5" | \ - gcc -c -x assembler - >&/dev/null && \ + gcc -c -x assembler - >/dev/null 2>&1 && \ rm ./-.o && echo -DCONFIG_AS_AVX512=1) else ifeq ($(HAS_NEON),yes) OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o From patchwork Tue Mar 24 08:48:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 197942 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6F55C4332B for ; Tue, 24 Mar 2020 08:51:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B463520870 for ; Tue, 24 Mar 2020 08:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585039915; bh=455t6cY2M3Sn5xO4HvO67N47m+c9+6bUFhEVm0CfiJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iN1uQJVzIhsbFqDlznge6c0gGM8tzlCoflGMEM2u++wmqnzW4Ai+97Lf+RUIv7pei D/tIzWZfFD7Wm8HVmdTnoQq+uBMIsgwUZpXPydOzpklAC7N/fYqmzhgVi4otNHdzlL dcKgbAIsN/3cdwZUjp/6o3bjPR8pRhqzQ9yUsIOU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727361AbgCXIvU (ORCPT ); Tue, 24 Mar 2020 04:51:20 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:17207 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727256AbgCXIvL (ORCPT ); Tue, 24 Mar 2020 04:51:11 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id 02O8mgsa011219; Tue, 24 Mar 2020 17:48:47 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 02O8mgsa011219 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1585039728; bh=rh1pQBmt9vmEvu9Z/Jx+j0VJLFTZ8OkR38V/FPsXekA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rCOwUiAwRlUbNyVNFv+BZGazH/Emh8BtIxcUstWKX3Sd2wqAWI3zwxDoxm3d+MWCq z2JV4AD3Z1kLGKrG9S28WzhYjfiRvMT4gDPQWd3bXWQ7Ioi0Im+yt+RLTkvD0LSce+ XEFKGb8iVr8AahyqwwVhsWstVFU1WhSNb15BpfeX3pbG8389l0ua+MDBYksjeUUBb3 WhVsNdUOXwvez2r4g5jgVkNVbMkiRJfjpqgzXCkNqNQaAl9doheT5cXE8LjIPe918Q nk7qBqNq20wQG4qM0gWHDxZ3OuRt+7q1CtiCS0bPgbdRQLjw5AORdt6/jJJ2C4MZVQ BmOGQ6sc2uPWQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kernel@vger.kernel.org Cc: "David S . Miller" , Linus Torvalds , Kees Cook , clang-built-linux@googlegroups.com, Herbert Xu , linux-crypto@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Borislav Petkov , Peter Zijlstra , "H . Peter Anvin" , x86@kernel.org, linux-kbuild@vger.kernel.org, Masahiro Yamada Subject: [PATCH 03/16] x86: remove always-defined CONFIG_AS_CFI Date: Tue, 24 Mar 2020 17:48:08 +0900 Message-Id: <20200324084821.29944-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324084821.29944-1-masahiroy@kernel.org> References: <20200324084821.29944-1-masahiroy@kernel.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org CONFIG_AS_CFI was introduced by commit e2414910f212 ("[PATCH] x86: Detect CFI support in the assembler at runtime"), and extended by commit f0f12d85af85 ("x86_64: Check for .cfi_rel_offset in CFI probe"). We raise the minimal supported binutils version from time to time. The last bump was commit 1fb12b35e5ff ("kbuild: Raise the minimum required binutils version to 2.21"). I confirmed the code in $(call as-instr,...) can be assembled by the binutils 2.21 assembler and also by LLVM integrated assembler. Remove CONFIG_AS_CFI, which is always defined. Signed-off-by: Masahiro Yamada Acked-by: Jason A. Donenfeld Reviewed-by: Nick Desaulniers --- If this series is applied, we can hard-code the assembler code, and delete CFI_* macros entirely. arch/x86/Makefile | 10 ++-------- arch/x86/include/asm/dwarf2.h | 36 ----------------------------------- 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 513a55562d75..72f8f744ebd7 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -177,12 +177,6 @@ ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1) KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,) endif -# Stackpointer is addressed different for 32 bit and 64 bit x86 -sp-$(CONFIG_X86_32) := esp -sp-$(CONFIG_X86_64) := rsp - -# do binutils support CFI? -cfi := $(call as-instr,.cfi_startproc\n.cfi_rel_offset $(sp-y)$(comma)0\n.cfi_endproc,-DCONFIG_AS_CFI=1) # is .cfi_signal_frame supported too? cfi-sigframe := $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1) cfi-sections := $(call as-instr,.cfi_sections .debug_frame,-DCONFIG_AS_CFI_SECTIONS=1) @@ -196,8 +190,8 @@ sha1_ni_instr :=$(call as-instr,sha1msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA1_NI= sha256_ni_instr :=$(call as-instr,sha256msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA256_NI=1) adx_instr := $(call as-instr,adox %r10$(comma)%r10,-DCONFIG_AS_ADX=1) -KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr) -KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr) +KBUILD_AFLAGS += $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr) +KBUILD_CFLAGS += $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr) KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE) diff --git a/arch/x86/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h index 5a0502212bc5..90807583cad7 100644 --- a/arch/x86/include/asm/dwarf2.h +++ b/arch/x86/include/asm/dwarf2.h @@ -6,15 +6,6 @@ #warning "asm/dwarf2.h should be only included in pure assembly files" #endif -/* - * Macros for dwarf2 CFI unwind table entries. - * See "as.info" for details on these pseudo ops. Unfortunately - * they are only supported in very new binutils, so define them - * away for older version. - */ - -#ifdef CONFIG_AS_CFI - #define CFI_STARTPROC .cfi_startproc #define CFI_ENDPROC .cfi_endproc #define CFI_DEF_CFA .cfi_def_cfa @@ -55,31 +46,4 @@ #endif #endif -#else - -/* - * Due to the structure of pre-exisiting code, don't use assembler line - * comment character # to ignore the arguments. Instead, use a dummy macro. - */ -.macro cfi_ignore a=0, b=0, c=0, d=0 -.endm - -#define CFI_STARTPROC cfi_ignore -#define CFI_ENDPROC cfi_ignore -#define CFI_DEF_CFA cfi_ignore -#define CFI_DEF_CFA_REGISTER cfi_ignore -#define CFI_DEF_CFA_OFFSET cfi_ignore -#define CFI_ADJUST_CFA_OFFSET cfi_ignore -#define CFI_OFFSET cfi_ignore -#define CFI_REL_OFFSET cfi_ignore -#define CFI_REGISTER cfi_ignore -#define CFI_RESTORE cfi_ignore -#define CFI_REMEMBER_STATE cfi_ignore -#define CFI_RESTORE_STATE cfi_ignore -#define CFI_UNDEFINED cfi_ignore -#define CFI_ESCAPE cfi_ignore -#define CFI_SIGNAL_FRAME cfi_ignore - -#endif - #endif /* _ASM_X86_DWARF2_H */ From patchwork Tue Mar 24 08:48:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 197948 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4F3EC10DCE for ; Tue, 24 Mar 2020 08:51:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B4D3C20870 for ; Tue, 24 Mar 2020 08:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585039863; bh=tamNtwnC+yOYL9Yj1QScIVBjshx39K9c/wgSFqiu+eU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=bYd1guljQWn9DPhgJ5ONs4SHg+sbON1/lpPgT9oU+0feTKvRyaiXwmP9Kt0P9TK4h ECblygkCkY+ffdCQw1KQw5wEzxD6vcJHrutoamzvLZf4M9+L5M1OrYUbUJ8WahpIqX NjWDueF6nXrSbPrW9PXeqHISy5lCUB1yYYIWhbCc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726524AbgCXIvD (ORCPT ); Tue, 24 Mar 2020 04:51:03 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:16890 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727119AbgCXIvC (ORCPT ); Tue, 24 Mar 2020 04:51:02 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id 02O8mgsb011219; Tue, 24 Mar 2020 17:48:49 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 02O8mgsb011219 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1585039729; bh=0iYh3JlnuBFF7Uur9DV4v9IZOkYzn33VL647mADyAyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qhHw2Kmx5u5yCMsCIZagqpsLAvHsuAuPlfCvUABn6OKBgECvqgp4x2KfLYfPrzomY QQcjycJMi090EaUNh0LKu4vx9HeBRhd6OPUXS9Kcc6P9wIN1EXYLG89SXNh/WvVXC6 2kq/ZmmZpptrAkQYvUHU2+5jJ0mWO/cDdSmIByBOpNhHOSBXoZP9R8MED3vCANawsX D/nNPFh3hgfkxn19efZghZvAtxdgf8d6lTdVs5eMqnj4vqe3PKCuhCJBQqkgLTA5K0 9vVJURmJS4jQou1eBEcgVEW8VJ+eQivAzdMqjfMmybRa9RWm8oH6v9x/eMVpGigKtR 5re+JcLbYI2ng== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kernel@vger.kernel.org Cc: "David S . Miller" , Linus Torvalds , Kees Cook , clang-built-linux@googlegroups.com, Herbert Xu , linux-crypto@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Borislav Petkov , Peter Zijlstra , "H . Peter Anvin" , x86@kernel.org, linux-kbuild@vger.kernel.org, Masahiro Yamada Subject: [PATCH 04/16] x86: remove unneeded (CONFIG_AS_)CFI_SIGNAL_FRAME Date: Tue, 24 Mar 2020 17:48:09 +0900 Message-Id: <20200324084821.29944-5-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324084821.29944-1-masahiroy@kernel.org> References: <20200324084821.29944-1-masahiroy@kernel.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Commit 131484c8da97 ("x86/debug: Remove perpetually broken, unmaintainable dwarf annotations") removes all the users of CFI_SIGNAL_FRAME. Remove the CFI_SIGNAL_FRAME and CONFIG_AS_CFI_SIGNAL_FRAME. Signed-off-by: Masahiro Yamada Acked-by: Jason A. Donenfeld --- arch/x86/Makefile | 6 ++---- arch/x86/include/asm/dwarf2.h | 6 ------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 72f8f744ebd7..dd275008fc59 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -177,8 +177,6 @@ ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1) KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,) endif -# is .cfi_signal_frame supported too? -cfi-sigframe := $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1) cfi-sections := $(call as-instr,.cfi_sections .debug_frame,-DCONFIG_AS_CFI_SECTIONS=1) # does binutils support specific instructions? @@ -190,8 +188,8 @@ sha1_ni_instr :=$(call as-instr,sha1msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA1_NI= sha256_ni_instr :=$(call as-instr,sha256msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA256_NI=1) adx_instr := $(call as-instr,adox %r10$(comma)%r10,-DCONFIG_AS_ADX=1) -KBUILD_AFLAGS += $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr) -KBUILD_CFLAGS += $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr) +KBUILD_AFLAGS += $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr) +KBUILD_CFLAGS += $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr) KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE) diff --git a/arch/x86/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h index 90807583cad7..f440790f09f9 100644 --- a/arch/x86/include/asm/dwarf2.h +++ b/arch/x86/include/asm/dwarf2.h @@ -21,12 +21,6 @@ #define CFI_UNDEFINED .cfi_undefined #define CFI_ESCAPE .cfi_escape -#ifdef CONFIG_AS_CFI_SIGNAL_FRAME -#define CFI_SIGNAL_FRAME .cfi_signal_frame -#else -#define CFI_SIGNAL_FRAME -#endif - #if defined(CONFIG_AS_CFI_SECTIONS) #ifndef BUILD_VDSO /* From patchwork Tue Mar 24 08:48:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 197947 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE2A3C41621 for ; Tue, 24 Mar 2020 08:51:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A0191208C3 for ; Tue, 24 Mar 2020 08:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585039869; bh=CapmDDq+DEQ/uX/xUf3VhIOP+7/Tw+B0qe8PUUAMk6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SbqxOJ7jm7z0NRy7Q5nBUkBaN7r5aVgcKSLECcgaHYaF7Q/iCG4aBZrEF6B7mPWem 8wgKnYfQynkBb7QboZLbajV3mm7r/3hz59l1GcRe8k8/SQC1zC7Y7Txn5XkldoJIbk lvHisnJdJIAoId+Pl5Ft6bXOOs+ygnMinLelDxSw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727257AbgCXIvI (ORCPT ); Tue, 24 Mar 2020 04:51:08 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:17144 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727239AbgCXIvI (ORCPT ); Tue, 24 Mar 2020 04:51:08 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id 02O8mgsf011219; Tue, 24 Mar 2020 17:48:53 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 02O8mgsf011219 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1585039734; bh=0n2SNVTASAHLSUpoQ5+c9e3R+yizJV+PNdqURrTAbRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vdr/w1ERj7s9sh0xtaMeTFMbLkW/1musxOa2cnHwWWSdZP7PvU8KmssioszE69Uv9 JJNyLcQi+0FbPRnDgIGtiSH/IciTEtRDm2MVeymDzI1JuaQ7Hgd30TzwIoqNHXj97Y f/wv2FyG2EMdR8gyKleb5He9HNnrXYOM7MLE+hEUg+trWz4Bq/A+YaysfvSc9IE5sv sNdWuKd/PJVwZ0/HT/W9ANcRQbgVwfBA8khb0Lq2aqATsAXHUhluPP+um0k/4OJP6h AfUkvbRlTMJ8gHayVzW0M2EbXaqWHS2TjPNG+AMaSgGCf0Xco0co3H7qR2vw60bwyQ 46xbabDUwtKUg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kernel@vger.kernel.org Cc: "David S . Miller" , Linus Torvalds , Kees Cook , clang-built-linux@googlegroups.com, Herbert Xu , linux-crypto@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Borislav Petkov , Peter Zijlstra , "H . Peter Anvin" , x86@kernel.org, linux-kbuild@vger.kernel.org, Masahiro Yamada Subject: [PATCH 08/16] x86: add comments about the binutils version to support code in as-instr Date: Tue, 24 Mar 2020 17:48:13 +0900 Message-Id: <20200324084821.29944-9-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324084821.29944-1-masahiroy@kernel.org> References: <20200324084821.29944-1-masahiroy@kernel.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org We raise the minimal supported binutils version from time to time. The last bump was commit 1fb12b35e5ff ("kbuild: Raise the minimum required binutils version to 2.21"). We need to keep these as-instr checks because binutils 2.21 does not support them. I hope this will be a good hint which one can be dropped when we bump the minimal binutils version next time. As for the Clang/LLVM builds, we require very new LLVM version, so the LLVM integrated assembler supports all of them. Signed-off-by: Masahiro Yamada Acked-by: Jason A. Donenfeld --- arch/x86/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index f32ef7b8d5ca..4c57cb3018fb 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -178,10 +178,15 @@ ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1) endif # does binutils support specific instructions? +# binutils >= 2.22 avx2_instr :=$(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1) +# binutils >= 2.25 avx512_instr :=$(call as-instr,vpmovm2b %k1$(comma)%zmm5,-DCONFIG_AS_AVX512=1) +# binutils >= 2.24 sha1_ni_instr :=$(call as-instr,sha1msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA1_NI=1) +# binutils >= 2.24 sha256_ni_instr :=$(call as-instr,sha256msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA256_NI=1) +# binutils >= 2.23 adx_instr := $(call as-instr,adox %r10$(comma)%r10,-DCONFIG_AS_ADX=1) KBUILD_AFLAGS += $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr) From patchwork Tue Mar 24 08:48:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 197946 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC5ACC54EEB for ; Tue, 24 Mar 2020 08:51:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 937D4208C3 for ; Tue, 24 Mar 2020 08:51:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585039880; bh=YVvmkCLCXCoqvAzyrM1aSW9D4XNZnwkyS3j34tdSHBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AvM9gLCADqu/0CPna/Ad4+1lncobgSBq5GcTyvWJHz1xE4CSj/HnN4QgWWvHMtViW OyelEkd3tfvoNQdq96/nx0ED1QfFn5zPsQ0m/LaEDsh1NcIZRdgtblf9Ps4zOutyk1 7OE72zivcoahlYKedlBnM565klu0NkPjvNma6k6k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727316AbgCXIvN (ORCPT ); Tue, 24 Mar 2020 04:51:13 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:17232 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727261AbgCXIvL (ORCPT ); Tue, 24 Mar 2020 04:51:11 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id 02O8mgsg011219; Tue, 24 Mar 2020 17:48:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 02O8mgsg011219 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1585039735; bh=/3RvcKd5y5/yj7b6stGrp33Eo6/OCU1GSvYDWjedZ6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yld4oUJzbJJ7DewjSP1zDEiAlz7eHKryqrjlmvRRkZlsD7LMv6C/90hrW5l/wZHyD TRgXxX6a9pI+EJlsMIq9zx01zDWBCzWWZudXhw+PIWWTkOhwSz0wPebJb5vXrvvupB KR//53lufr+YJbTzQdrK3dhurNLleVQrPmAdplR7S3ZIviDe3qX6iI5bfBOw2CwBiT 4HrM9aH15Sa0GUznoHphQCncADsxPwQ2ICtNaQOtjusKImYAAO8Yp/R5JDWKpgqFEw Gu31V307o2pW7YJmcVrJRV3beOcbkisrCuH3iJ/kv/wxs1MbmiNtamS82VJ9BewsEb P4mGQ2ZkSb7dQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kernel@vger.kernel.org Cc: "David S . Miller" , Linus Torvalds , Kees Cook , clang-built-linux@googlegroups.com, Herbert Xu , linux-crypto@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Borislav Petkov , Peter Zijlstra , "H . Peter Anvin" , x86@kernel.org, linux-kbuild@vger.kernel.org, Masahiro Yamada Subject: [PATCH 09/16] x86: replace arch macros from compiler with CONFIG_X86_{32, 64} Date: Tue, 24 Mar 2020 17:48:14 +0900 Message-Id: <20200324084821.29944-10-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324084821.29944-1-masahiroy@kernel.org> References: <20200324084821.29944-1-masahiroy@kernel.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org If the intention is to check i386/x86_64 excluding UML, testing CONFIG_X86_{32,64} is simpler. The reason for checking __i386__ / __x86_64__ was perhaps because lib/raid6/algos.c is built not only for the kernel but also for testing the library code from userspace. However, lib/raid6/test/Makefile passes -DCONFIG_X86_{32,64} for this case. So, I do not see a reason to not use CONFIG option here. Signed-off-by: Masahiro Yamada Acked-by: H. Peter Anvin (Intel) --- kernel/signal.c | 2 +- lib/raid6/algos.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index 5b2396350dd1..db557e1629e5 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1246,7 +1246,7 @@ static void print_fatal_signal(int signr) struct pt_regs *regs = signal_pt_regs(); pr_info("potentially unexpected fatal signal %d.\n", signr); -#if defined(__i386__) && !defined(__arch_um__) +#ifdef CONFIG_X86_32 pr_info("code at %08lx: ", regs->ip); { int i; diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c index df08664d3432..b5a02326cfb7 100644 --- a/lib/raid6/algos.c +++ b/lib/raid6/algos.c @@ -29,7 +29,7 @@ struct raid6_calls raid6_call; EXPORT_SYMBOL_GPL(raid6_call); const struct raid6_calls * const raid6_algos[] = { -#if defined(__i386__) && !defined(__arch_um__) +#ifdef CONFIG_X86_32 #ifdef CONFIG_AS_AVX512 &raid6_avx512x2, &raid6_avx512x1, @@ -45,7 +45,7 @@ const struct raid6_calls * const raid6_algos[] = { &raid6_mmxx2, &raid6_mmxx1, #endif -#if defined(__x86_64__) && !defined(__arch_um__) +#ifdef CONFIG_X86_64 #ifdef CONFIG_AS_AVX512 &raid6_avx512x4, &raid6_avx512x2, From patchwork Tue Mar 24 08:48:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 197943 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 362ECC41621 for ; Tue, 24 Mar 2020 08:51:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E8BA208CA for ; Tue, 24 Mar 2020 08:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585039909; bh=tLU3ZmLLsZhZPEPgbIaz014yDU2wtivSkjfS8HT9yJQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=GDg/Xk0jKwyiCVwrxnD7LOKtkKLVx/vIXMntNl93NBc6gbLKf7KO7sm7Cn0QrAyXO fh5cwziOEqaAxA4wrPxDdccmZz8CubWSbq/at4vi9vEVP8gg8NQkQcv3t0a41cQphP nIEmRqdlFajo9gvC09eGqOGfaNCe4zm8jSGj59MU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727495AbgCXIvh (ORCPT ); Tue, 24 Mar 2020 04:51:37 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:17904 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727388AbgCXIvc (ORCPT ); Tue, 24 Mar 2020 04:51:32 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id 02O8mgsh011219; Tue, 24 Mar 2020 17:48:56 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 02O8mgsh011219 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1585039737; bh=EKZjb7DWYR4s7jGHGhFrynB+pQ1ESbu9YqfclUuLIXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RaI62uUSi+TuYSdITao9E3pXoHm2kJAxRS4RfxbanuNPHrpbByYoL80qrDDy7sGwN X90uq2aHoq+UrCHqF/zRPDNyc2wcAi7eGIP9Za62TV1/Qk5WmUs0sivkGCQYemyS41 DuGp3FECM267nLNoF2k25NF4L/hRred/vjOCXO2A0G6iYvj4uNJPZwCVgshLTUcXJE n9bb49Yjr5vOBpd6ANIxTfyZw6+JEmzr6/m1RkcqgwljDqtKPzM3Zinl1epQbBWZpN qZDG0Ji5Nhyv8Q6+miY/EJuJdt7GGFe4hxi2NcSwqPNsH19b/IriHr/RQC9Dve7o3m o1UOYoQEjzHOQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kernel@vger.kernel.org Cc: "David S . Miller" , Linus Torvalds , Kees Cook , clang-built-linux@googlegroups.com, Herbert Xu , linux-crypto@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Borislav Petkov , Peter Zijlstra , "H . Peter Anvin" , x86@kernel.org, linux-kbuild@vger.kernel.org, Masahiro Yamada , Daniel Vetter , David Airlie , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [PATCH 10/16] drm/i915: remove always-defined CONFIG_AS_MOVNTDQA Date: Tue, 24 Mar 2020 17:48:15 +0900 Message-Id: <20200324084821.29944-11-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324084821.29944-1-masahiroy@kernel.org> References: <20200324084821.29944-1-masahiroy@kernel.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org CONFIG_AS_MOVNTDQA was introduced by commit 0b1de5d58e19 ("drm/i915: Use SSE4.1 movntdqa to accelerate reads from WC memory"). We raise the minimal supported binutils version from time to time. The last bump was commit 1fb12b35e5ff ("kbuild: Raise the minimum required binutils version to 2.21"). I confirmed the code in $(call as-instr,...) can be assembled by the binutils 2.21 assembler and also by LLVM integrated assembler. Remove CONFIG_AS_MOVNTDQA, which is always defined. Signed-off-by: Masahiro Yamada Reviewed-by: Nick Desaulniers --- drivers/gpu/drm/i915/Makefile | 3 --- drivers/gpu/drm/i915/i915_memcpy.c | 5 ----- 2 files changed, 8 deletions(-) diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index a1f2411aa21b..e559e53fc634 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -28,9 +28,6 @@ subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init) CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init) -subdir-ccflags-y += \ - $(call as-instr,movntdqa (%eax)$(comma)%xmm0,-DCONFIG_AS_MOVNTDQA) - subdir-ccflags-y += -I$(srctree)/$(src) # Please keep these build lists sorted! diff --git a/drivers/gpu/drm/i915/i915_memcpy.c b/drivers/gpu/drm/i915/i915_memcpy.c index fdd550405fd3..7b3b83bd5ab8 100644 --- a/drivers/gpu/drm/i915/i915_memcpy.c +++ b/drivers/gpu/drm/i915/i915_memcpy.c @@ -35,7 +35,6 @@ static DEFINE_STATIC_KEY_FALSE(has_movntdqa); -#ifdef CONFIG_AS_MOVNTDQA static void __memcpy_ntdqa(void *dst, const void *src, unsigned long len) { kernel_fpu_begin(); @@ -93,10 +92,6 @@ static void __memcpy_ntdqu(void *dst, const void *src, unsigned long len) kernel_fpu_end(); } -#else -static void __memcpy_ntdqa(void *dst, const void *src, unsigned long len) {} -static void __memcpy_ntdqu(void *dst, const void *src, unsigned long len) {} -#endif /** * i915_memcpy_from_wc: perform an accelerated *aligned* read from WC From patchwork Tue Mar 24 08:48:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 197944 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AA5FC10DCE for ; Tue, 24 Mar 2020 08:51:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 410B0208CA for ; Tue, 24 Mar 2020 08:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585039899; bh=XP2txLbqU1idKy32wWuardHR/llWS+Cx9bGBnAL2L4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AzbytsiOV4nPfHtDuOi/SRuosn/0jcbiQuTqA6H+LBTnPtYMESfGB9ns6XjmSbsVJ tV0Uj8/OoepppMnBpVRebp0g8FWe3hCIOBF9vqV5T9qrXEAf74+d30nAen3iNACkSN +EWdAmAxSYAtjPBoR+xSP3m+DbSxP+H9nIr56UqE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727501AbgCXIvi (ORCPT ); Tue, 24 Mar 2020 04:51:38 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:17988 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727467AbgCXIve (ORCPT ); Tue, 24 Mar 2020 04:51:34 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id 02O8mgsi011219; Tue, 24 Mar 2020 17:48:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 02O8mgsi011219 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1585039738; bh=JqtixBVE5LvKs0Tzf5JjzcEl4PHKG6BuoyaSQFvvj58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VT7u0p7jFX8rcAUgYEMLvfDun1br1MHBhbeua/d+C+39d4WsxGHO76aT3w95RqiNk 7xw79J9Q8VThK+U0QGRwUovrbUbWBLwp7ocgOirKqBVBG54afPcz62tZMTHYQuPZsi WA/uA/+aHULGz9ptJNxGcIzBMMBkwPU7m360SCPMJsm9YAg46rOsnqgnFnnxQtpBYi MLghhO2/qsDEzoll1AmUXrCPFmz8I9MoSYWBWG/3YidFnHa1ZClqVlpGdy7PcrT0h5 bLc21XxTv7MvSU4yXYXWRAy+GE6Kr8lJnv7FvUjm0NegsqhJudnvGPdLutlLehQPMy Utz983OFQpHGw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kernel@vger.kernel.org Cc: "David S . Miller" , Linus Torvalds , Kees Cook , clang-built-linux@googlegroups.com, Herbert Xu , linux-crypto@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Borislav Petkov , Peter Zijlstra , "H . Peter Anvin" , x86@kernel.org, linux-kbuild@vger.kernel.org, "Jason A. Donenfeld" , Masahiro Yamada Subject: [PATCH 11/16] x86: probe assembler capabilities via kconfig instead of makefile Date: Tue, 24 Mar 2020 17:48:16 +0900 Message-Id: <20200324084821.29944-12-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324084821.29944-1-masahiroy@kernel.org> References: <20200324084821.29944-1-masahiroy@kernel.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: "Jason A. Donenfeld" Doing this probing inside of the Makefiles means we have a maze of ifdefs inside the source code and child Makefiles that need to make proper decisions on this too. Instead, we do it at Kconfig time, like many other compiler and assembler options, which allows us to set up the dependencies normally for full compilation units. In the process, the ADX test changes to use %eax instead of %r10 so that it's valid in both 32-bit and 64-bit mode. Signed-off-by: Jason A. Donenfeld Signed-off-by: Masahiro Yamada --- arch/x86/Kconfig | 2 ++ arch/x86/Kconfig.assembler | 22 ++++++++++++++++++++++ arch/x86/Makefile | 15 --------------- 3 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 arch/x86/Kconfig.assembler diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index beea77046f9b..707673227837 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2935,3 +2935,5 @@ config HAVE_ATOMIC_IOMAP source "drivers/firmware/Kconfig" source "arch/x86/kvm/Kconfig" + +source "arch/x86/Kconfig.assembler" diff --git a/arch/x86/Kconfig.assembler b/arch/x86/Kconfig.assembler new file mode 100644 index 000000000000..46868ec7b723 --- /dev/null +++ b/arch/x86/Kconfig.assembler @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2020 Jason A. Donenfeld . All Rights Reserved. + +# binutils >= 2.22 +config AS_AVX2 + def_bool $(as-instr,vpbroadcastb %xmm0$(comma)%ymm1) + +# binutils >= 2.25 +config AS_AVX512 + def_bool $(as-instr,vpmovm2b %k1$(comma)%zmm5) + +# binutils >= 2.24 +config AS_SHA1_NI + def_bool $(as-instr,sha1msg1 %xmm0$(comma)%xmm1) + +# binutils >= 2.24 +config AS_SHA256_NI + def_bool $(as-instr,sha256msg1 %xmm0$(comma)%xmm1) + +# binutils >= 2.23 +config AS_ADX + def_bool $(as-instr,adox %eax$(comma)%eax) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 4c57cb3018fb..b65ec63c7db7 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -177,21 +177,6 @@ ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1) KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,) endif -# does binutils support specific instructions? -# binutils >= 2.22 -avx2_instr :=$(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1) -# binutils >= 2.25 -avx512_instr :=$(call as-instr,vpmovm2b %k1$(comma)%zmm5,-DCONFIG_AS_AVX512=1) -# binutils >= 2.24 -sha1_ni_instr :=$(call as-instr,sha1msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA1_NI=1) -# binutils >= 2.24 -sha256_ni_instr :=$(call as-instr,sha256msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA256_NI=1) -# binutils >= 2.23 -adx_instr := $(call as-instr,adox %r10$(comma)%r10,-DCONFIG_AS_ADX=1) - -KBUILD_AFLAGS += $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr) -KBUILD_CFLAGS += $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr) - KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE) # From patchwork Tue Mar 24 08:48:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 197941 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B511C10DCE for ; Tue, 24 Mar 2020 08:52:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DA83520936 for ; Tue, 24 Mar 2020 08:52:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585039922; bh=XhGrz0KaH3A+sTBk/900ZFWQ6UAw62bQTFo4V+TOyrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tIzG+pX0FqpL/CfeGP2rtYxkyD3wkYHgDrXAPiJD+8df0Yb1jWb4IfIX4M1TdKO7X D7/1Im61/6nhpqhtMcL8kYCSqYNMT5kPNiTyH+w6SRik6N9nSFabQpdBLMvuD0Y+am 02PvMM3DNe3XI5KeCc5KkaGuLHPxoeSK3iCvvoXo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727054AbgCXIv5 (ORCPT ); Tue, 24 Mar 2020 04:51:57 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:17199 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727253AbgCXIvK (ORCPT ); Tue, 24 Mar 2020 04:51:10 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id 02O8mgsn011219; Tue, 24 Mar 2020 17:49:03 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 02O8mgsn011219 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1585039744; bh=wo4v6sLSkF3zJEtLmurbhlkARw0fSZMgaGV3bKygv0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xUZZ70B8uhAJkLWLusQssl/Vf5mJTcGCO61GcA9/TTu8hRi5i0D70gaZTmiStGjJ/ p5m7p3EOP/58XcO1P2/9mGMIpwwDtwtEeMtUbDgeRgWqKJCMEUbFqC6M1VXxBK3zNR yjhA5WT8KXTH+yVkhjdeurlm1dmlTAXG8vptHguUWQXo4GysYZkCuAN8q7Om+M2R2Y eb5M8ayg0Pj17XVwgad/CvVzUZGjohpFOAC5LhvQImZxgZ56f9m6Kt3LIYwvGLfwQS LBqwzcnDZRWaot7GcgAPKezCYuoW4I69MukhJGM2Zm81Hv5kZhF+X9h0teLmLsJfJ2 cbI6TtQnac5AA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kernel@vger.kernel.org Cc: "David S . Miller" , Linus Torvalds , Kees Cook , clang-built-linux@googlegroups.com, Herbert Xu , linux-crypto@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Borislav Petkov , Peter Zijlstra , "H . Peter Anvin" , x86@kernel.org, linux-kbuild@vger.kernel.org, Masahiro Yamada Subject: [PATCH 16/16] crypto: x86 - clean up poly1305-x86_64-cryptogams.S by 'make clean' Date: Tue, 24 Mar 2020 17:48:21 +0900 Message-Id: <20200324084821.29944-17-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324084821.29944-1-masahiroy@kernel.org> References: <20200324084821.29944-1-masahiroy@kernel.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org poly1305-x86_64-cryptogams.S is a generated file, so it should be cleaned up by 'make clean'. Assigning it to the variable 'targets' teaches Kbuild that it is a generated file. However, this line is not evaluated while cleaning because scripts/Makefile.clean does not include include/config/auto.conf. Removing the ifneq-conditional, so this file is correctly cleaned up. Signed-off-by: Masahiro Yamada --- arch/x86/crypto/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile index 928aad453c72..a31de0c6ccde 100644 --- a/arch/x86/crypto/Makefile +++ b/arch/x86/crypto/Makefile @@ -83,9 +83,7 @@ crct10dif-pclmul-y := crct10dif-pcl-asm_64.o crct10dif-pclmul_glue.o obj-$(CONFIG_CRYPTO_POLY1305_X86_64) += poly1305-x86_64.o poly1305-x86_64-y := poly1305-x86_64-cryptogams.o poly1305_glue.o -ifneq ($(CONFIG_CRYPTO_POLY1305_X86_64),) targets += poly1305-x86_64-cryptogams.S -endif obj-$(CONFIG_CRYPTO_NHPOLY1305_SSE2) += nhpoly1305-sse2.o nhpoly1305-sse2-y := nh-sse2-x86_64.o nhpoly1305-sse2-glue.o