From patchwork Wed Mar 25 11:41:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11457573 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2A8414B4 for ; Wed, 25 Mar 2020 11:41:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 888E52076A for ; Wed, 25 Mar 2020 11:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585136476; bh=8KLdrbtUe7tOHJWaYztQY17PQBXg8G2PxmpA8ckecVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=MWlg2Tf6gpZrcgD2RHtl8XOLS7z8n0rI2YqjUZYRibG9Bnh4E05THe8CQBB1lsTnS IMhB3b+TR7Ka8hTQKqk4QDdecff9yxVVQrr2JZNaaIQhQcP4P8Uygcaxp5FFdGvbIP hg4TgBMJtsR2KzPK9lA771dYK46qB8gSjiZ0bepA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727137AbgCYLlQ (ORCPT ); Wed, 25 Mar 2020 07:41:16 -0400 Received: from foss.arm.com ([217.140.110.172]:47176 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726658AbgCYLlP (ORCPT ); Wed, 25 Mar 2020 07:41:15 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7CD6E31B; Wed, 25 Mar 2020 04:41:15 -0700 (PDT) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 014E13F71F; Wed, 25 Mar 2020 04:41:14 -0700 (PDT) From: Mark Brown To: Catalin Marinas , Will Deacon , Eric Biggers , Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, Mark Brown Subject: [PATCH 1/3] arm64: asm: Provide macro to control enabling architecture extensions Date: Wed, 25 Mar 2020 11:41:08 +0000 Message-Id: <20200325114110.23491-2-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200325114110.23491-1-broonie@kernel.org> References: <20200325114110.23491-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Currently several assembler files override the default architecture to enable extensions in order to allow them to implement optimised routines for systems with those extensions. Since inserting BTI landing pads into assembler functions will require us to change the default architecture we need a way to enable extensions without hard coding the architecture. The assembler has the .arch_extension feature but this was introduced for arm64 in gas 2.26 which is too modern for us to rely on it. We could just update the base architecture used by these assembler files but this would mean the assembler would no longer catch attempts to use newer instructions so instead introduce a macro which sets the default architecture centrally. Doing this will also make our use of .arch and .cpu to select the base architecture more consistent. Signed-off-by: Mark Brown --- arch/arm64/include/asm/linkage.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/include/asm/linkage.h b/arch/arm64/include/asm/linkage.h index ebee3113a62f..e5856c75720b 100644 --- a/arch/arm64/include/asm/linkage.h +++ b/arch/arm64/include/asm/linkage.h @@ -20,4 +20,10 @@ SYM_FUNC_END(x); \ SYM_FUNC_END_ALIAS(__pi_##x) +/* + * Enable additional architecture extensions (eg, for optimized asm + * routines). + */ +#define ARM64_EXTENSIONS(x) .arch armv8-a+x + #endif From patchwork Wed Mar 25 11:41:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11457575 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DEDAB14B4 for ; Wed, 25 Mar 2020 11:41:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BEBE72076A for ; Wed, 25 Mar 2020 11:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585136478; bh=/utdjAOROBXe+ztowGIx5MDm2JtI/c+EWXT0oT3FuUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vsKp9wqCaCARiJ+Qw57SG7STdeHPvRVL9fGnWgZGNTwzf4xwulkN+Y7UIsvkqY0eW Z8rGpKEJjhbzucsShUPY8cdMKYuas3fespj45t/Y2RcokolT3lGNCJ1a+fSNdLrlRn xsOOdYfiMR6bg4tlFyZIHPU3skUfimlR+M+TJ5dg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727174AbgCYLlS (ORCPT ); Wed, 25 Mar 2020 07:41:18 -0400 Received: from foss.arm.com ([217.140.110.172]:47188 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727158AbgCYLlS (ORCPT ); Wed, 25 Mar 2020 07:41:18 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B6F6931B; Wed, 25 Mar 2020 04:41:17 -0700 (PDT) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 39D513F71F; Wed, 25 Mar 2020 04:41:17 -0700 (PDT) From: Mark Brown To: Catalin Marinas , Will Deacon , Eric Biggers , Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, Mark Brown Subject: [PATCH 2/3] arm64: lib: Use ARM64_EXTENSIONS() Date: Wed, 25 Mar 2020 11:41:09 +0000 Message-Id: <20200325114110.23491-3-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200325114110.23491-1-broonie@kernel.org> References: <20200325114110.23491-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Use the newly introduced ARM64_EXTENSIONS() macro to enable the CRC instructions. Signed-off-by: Mark Brown --- arch/arm64/lib/crc32.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/lib/crc32.S b/arch/arm64/lib/crc32.S index 243e107e9896..0fd9ef030ab1 100644 --- a/arch/arm64/lib/crc32.S +++ b/arch/arm64/lib/crc32.S @@ -9,7 +9,7 @@ #include #include - .cpu generic+crc +ARM64_EXTENSIONS(crc) .macro __crc32, c cmp x2, #16 From patchwork Wed Mar 25 11:41:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11457577 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39BA914B4 for ; Wed, 25 Mar 2020 11:41:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1B5B220775 for ; Wed, 25 Mar 2020 11:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585136481; bh=PR+Ef+7MiScmj+xulyg7hZRwHI5bfGFmYsxdEn4YQhs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=JPfmdIwmw+5z8J3B/ASw0ovP+UA1kHRA3qh15NqD50oAPPLb1fepDhySzYaVuNHzy YVafmcWEY655T/B14QFUGylyT0sSFxNs77CNCb4qKAzwSORXTs8ZHFpu2Lhyyw/pbp W+wTxVKsFWjpz8Wb6KUv9Vc5y/sgvHHZpgs9gGMw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727259AbgCYLlU (ORCPT ); Wed, 25 Mar 2020 07:41:20 -0400 Received: from foss.arm.com ([217.140.110.172]:47200 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727158AbgCYLlU (ORCPT ); Wed, 25 Mar 2020 07:41:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F251D31B; Wed, 25 Mar 2020 04:41:19 -0700 (PDT) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7513D3F71F; Wed, 25 Mar 2020 04:41:19 -0700 (PDT) From: Mark Brown To: Catalin Marinas , Will Deacon , Eric Biggers , Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, Mark Brown Subject: [PATCH 3/3] arm64: crypto: Use ARM64_EXTENSIONS() Date: Wed, 25 Mar 2020 11:41:10 +0000 Message-Id: <20200325114110.23491-4-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200325114110.23491-1-broonie@kernel.org> References: <20200325114110.23491-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Use the newly introduced ARM64_EXTENSIONS() macro to enable the crypto extensions. Signed-off-by: Mark Brown --- arch/arm64/crypto/aes-ce-ccm-core.S | 3 ++- arch/arm64/crypto/aes-ce-core.S | 2 +- arch/arm64/crypto/aes-ce.S | 2 +- arch/arm64/crypto/crct10dif-ce-core.S | 3 ++- arch/arm64/crypto/ghash-ce-core.S | 3 ++- arch/arm64/crypto/sha1-ce-core.S | 3 ++- arch/arm64/crypto/sha2-ce-core.S | 3 ++- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/arch/arm64/crypto/aes-ce-ccm-core.S b/arch/arm64/crypto/aes-ce-ccm-core.S index 99a028e298ed..bb6d85c2a260 100644 --- a/arch/arm64/crypto/aes-ce-ccm-core.S +++ b/arch/arm64/crypto/aes-ce-ccm-core.S @@ -9,7 +9,8 @@ #include .text - .arch armv8-a+crypto + +ARM64_EXTENSIONS(crypto) /* * void ce_aes_ccm_auth_data(u8 mac[], u8 const in[], u32 abytes, diff --git a/arch/arm64/crypto/aes-ce-core.S b/arch/arm64/crypto/aes-ce-core.S index e52e13eb8fdb..a8291111f68d 100644 --- a/arch/arm64/crypto/aes-ce-core.S +++ b/arch/arm64/crypto/aes-ce-core.S @@ -6,7 +6,7 @@ #include #include - .arch armv8-a+crypto +ARM64_EXTENSIONS(crypto) SYM_FUNC_START(__aes_ce_encrypt) sub w3, w3, #2 diff --git a/arch/arm64/crypto/aes-ce.S b/arch/arm64/crypto/aes-ce.S index 1dc5bbbfeed2..6493a8e8d8d0 100644 --- a/arch/arm64/crypto/aes-ce.S +++ b/arch/arm64/crypto/aes-ce.S @@ -12,7 +12,7 @@ #define AES_FUNC_START(func) SYM_FUNC_START(ce_ ## func) #define AES_FUNC_END(func) SYM_FUNC_END(ce_ ## func) - .arch armv8-a+crypto +ARM64_EXTENSIONS(crypto) xtsmask .req v16 cbciv .req v16 diff --git a/arch/arm64/crypto/crct10dif-ce-core.S b/arch/arm64/crypto/crct10dif-ce-core.S index 5a95c2628fbf..bb6f3a14e9e8 100644 --- a/arch/arm64/crypto/crct10dif-ce-core.S +++ b/arch/arm64/crypto/crct10dif-ce-core.S @@ -66,7 +66,8 @@ #include .text - .cpu generic+crypto + +ARM64_EXTENSIONS(crypto) init_crc .req w19 buf .req x20 diff --git a/arch/arm64/crypto/ghash-ce-core.S b/arch/arm64/crypto/ghash-ce-core.S index 6b958dcdf136..85839b701c83 100644 --- a/arch/arm64/crypto/ghash-ce-core.S +++ b/arch/arm64/crypto/ghash-ce-core.S @@ -57,7 +57,8 @@ HH34 .req v19 .text - .arch armv8-a+crypto + +ARM64_EXTENSIONS(crypto) .macro __pmull_p64, rd, rn, rm pmull \rd\().1q, \rn\().1d, \rm\().1d diff --git a/arch/arm64/crypto/sha1-ce-core.S b/arch/arm64/crypto/sha1-ce-core.S index 92d0d2753e81..8fa2d920be36 100644 --- a/arch/arm64/crypto/sha1-ce-core.S +++ b/arch/arm64/crypto/sha1-ce-core.S @@ -9,7 +9,8 @@ #include .text - .arch armv8-a+crypto + +ARM64_EXTENSIONS(crypto) k0 .req v0 k1 .req v1 diff --git a/arch/arm64/crypto/sha2-ce-core.S b/arch/arm64/crypto/sha2-ce-core.S index 3f9d0f326987..d8680b43a3fd 100644 --- a/arch/arm64/crypto/sha2-ce-core.S +++ b/arch/arm64/crypto/sha2-ce-core.S @@ -9,7 +9,8 @@ #include .text - .arch armv8-a+crypto + +ARM64_EXTENSIONS(crypto) dga .req q20 dgav .req v20