From patchwork Sat Apr 6 00:26:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 13619613 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD0CFA50 for ; Sat, 6 Apr 2024 00:28:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712363285; cv=none; b=TGrKkONuldE+bHR6+t2N1SIOTfmSJLZbBUxMM/N6ekhfUuuAXE1bYqDD+oeLTRM1jc5h4MS8v2m4WUm9bB9Ut0vLrLMI1JlTk7eVI4JGYWPfo0kkiiWyL8vF3EnDP9FqpX2SdcFtPmws0gpcs6EICoe5BMGA6dKFwGPbnhMBvrE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712363285; c=relaxed/simple; bh=aOzuonNLlnJXwWBEwSgEzvclltWB5nPogY4JWBW1pH8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dWU/hGMcQ5uHBkHkAXA4X6KJJulTTViJvG5oSEgaVdlIcllkErMoM6fZbqzt22szpQZI3zE37+EW8VqGSpdF4SzILj81j2/MKXs9WGVFg0UoSpwhTq6gIv/DVIfEYx6tY+UXtWfYC4aRDXEYRUhXOuhO7HEOaHDV0taO/ES6Ha4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cTO2WAk3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cTO2WAk3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41DA4C43394; Sat, 6 Apr 2024 00:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712363285; bh=aOzuonNLlnJXwWBEwSgEzvclltWB5nPogY4JWBW1pH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cTO2WAk3em3FSnaF/wPo3bwxFCVaGIMotrc++Bz1leL1NRLreOSWgEwnlER2UcLhq vHvZfeW18oheooXKChi38rRZulctSlB/aTdyJnExSBSkqCsOxmDfsR9kqTDfJTJL2g uZX86oLFhPb0QLHFgct1BYd2nLyny/Rnq+8bEWDYOueF/x6MUFRbfWhOicr2qHCvIU pv6C7+LhWO5OAUzzEtDeMQhV++UJJhNqxL6kvWuNLaIYJkwV+NuXuUxHeQRgfvEMyz ke3BC8MmSbO3i7CrtMMsYKUwRloooaA9Tum4Bgi6IyUat02coQXLXB3ceWjZtqr9pR VDU5PjWZhxf9w== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: x86@kernel.org, Tim Chen Subject: [PATCH 1/3] crypto: x86/nh-avx2 - add missing vzeroupper Date: Fri, 5 Apr 2024 20:26:08 -0400 Message-ID: <20240406002610.37202-2-ebiggers@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240406002610.37202-1-ebiggers@kernel.org> References: <20240406002610.37202-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Eric Biggers Since nh_avx2() uses ymm registers, execute vzeroupper before returning from it. This is necessary to avoid reducing the performance of SSE code. Fixes: 0f961f9f670e ("crypto: x86/nhpoly1305 - add AVX2 accelerated NHPoly1305") Signed-off-by: Eric Biggers Acked-by: Tim Chen --- arch/x86/crypto/nh-avx2-x86_64.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/crypto/nh-avx2-x86_64.S b/arch/x86/crypto/nh-avx2-x86_64.S index ef73a3ab8726..791386d9a83a 100644 --- a/arch/x86/crypto/nh-avx2-x86_64.S +++ b/arch/x86/crypto/nh-avx2-x86_64.S @@ -152,7 +152,8 @@ SYM_TYPED_FUNC_START(nh_avx2) vpaddq T5, T4, T4 vpaddq T1, T0, T0 vpaddq T4, T0, T0 vmovdqu T0, (HASH) + vzeroupper RET SYM_FUNC_END(nh_avx2) From patchwork Sat Apr 6 00:26:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 13619614 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A1E51879 for ; Sat, 6 Apr 2024 00:28:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712363286; cv=none; b=HtPIhaKEty311i7eXGut3d3Prm4MmHGXfEKRLXly5f/Ke9DEMIwolwaNDZ+OdU4hCacwdKOnbprfDuZrBx+Clkp1fBxUDPffWr5XQtwTOlcUrSXVgNL95+cZb1Tb+5NjBFyMA6+vpnj6Wudbsp8wiBu2Y0ZMI7qnysnFhqGirAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712363286; c=relaxed/simple; bh=IK2GT9BV3++m+qSw9PNeNHZP43zJpPO86nVMwRDr8+Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K+LImcbRk3a9RbG7jV/0gZNTdAucBOZ9qI1WKB2+gemysxXgfw6VCbtSZU6Ti4QabDdCCMNwvgt/T+APqGs+lEEG8/DXxHxKBActtZIWSK56ZhsoUSCEQSoJtO/+qe3l/mdLWSH3pLRyt5QzkHwt+ZLrcFw7uAD5qYJp8irbhpY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YR23UDKd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YR23UDKd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9A3EC43399; Sat, 6 Apr 2024 00:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712363286; bh=IK2GT9BV3++m+qSw9PNeNHZP43zJpPO86nVMwRDr8+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YR23UDKd99WMDqwJL9gOdPjj+GlLnXewTH1UHaINs5ihpRKQNdXhlnpjXpgjvQtjg EUCFiADFJMp0OAUPaJI2ikM33Mlv4iUHlMnpSif7mrVSIKkoyNATQPxuDH1xs3cDA6 H2KgH/wgT0IzWtgxNaw0oSLqZ4lDUAhbYWZReGrRNpNCDB/6feV37/5veWlPZGLuFS LndCkRgWV6TvbvEqBA7OkC+/7g1HrgFhDmZJQ+m4h8tufZ8EhAbat0d7u4RgCzwTiC OLmM0WAJIGcZMAZtOzBPF1ViHweeB93LMPCNHP0uzJ04kx0xhTG8i5IKZhq3Tar2/B GJSTSmEKSlj/A== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: x86@kernel.org, Tim Chen Subject: [PATCH 2/3] crypto: x86/sha256-avx2 - add missing vzeroupper Date: Fri, 5 Apr 2024 20:26:09 -0400 Message-ID: <20240406002610.37202-3-ebiggers@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240406002610.37202-1-ebiggers@kernel.org> References: <20240406002610.37202-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Eric Biggers Since sha256_transform_rorx() uses ymm registers, execute vzeroupper before returning from it. This is necessary to avoid reducing the performance of SSE code. Fixes: d34a460092d8 ("crypto: sha256 - Optimized sha256 x86_64 routine using AVX2's RORX instructions") Signed-off-by: Eric Biggers Acked-by: Tim Chen --- arch/x86/crypto/sha256-avx2-asm.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/crypto/sha256-avx2-asm.S b/arch/x86/crypto/sha256-avx2-asm.S index 9918212faf91..0ffb072be956 100644 --- a/arch/x86/crypto/sha256-avx2-asm.S +++ b/arch/x86/crypto/sha256-avx2-asm.S @@ -714,10 +714,11 @@ SYM_TYPED_FUNC_START(sha256_transform_rorx) popq %r15 popq %r14 popq %r13 popq %r12 popq %rbx + vzeroupper RET SYM_FUNC_END(sha256_transform_rorx) .section .rodata.cst512.K256, "aM", @progbits, 512 .align 64 From patchwork Sat Apr 6 00:26:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 13619615 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E44BB2CAB for ; Sat, 6 Apr 2024 00:28:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712363287; cv=none; b=mh2gmzAIBPOjv117KAhhS0u9GWnThti5mh4LI/bKTAooU5/RAmZA1rm6rKoEWSdQFd9UNGC55jiU0ZN5nIOwNUN8QyuZQ8CI6m8u0L8olv8EI8/CjGcAIU4LajFvqU2ySQ2dIB1xvxM10gBOiLuXujuYdpDixezSS3Ljfuudmeg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712363287; c=relaxed/simple; bh=HyTNCHwRiyVtvVQuLZycGw9jDb9+G3ZiYKXX8g+LLzg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Gw0PRxU3fD1KKTbbS6IyHhSl6MvV5ayKizxZRiiWf7Pcx0t6ARnfxyIxEVum5P4mDZ+raOFvMSgTp19xpdFXSmf4/lQS2/Oqm2twb1AnTS2Av2TpPAJgDcmz6NQmnpbeknPWMVTnewOXPuUphH5DM6nf3r/k0leOqDrvRAR2hbw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oiG72Znk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oiG72Znk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C740C433C7; Sat, 6 Apr 2024 00:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712363286; bh=HyTNCHwRiyVtvVQuLZycGw9jDb9+G3ZiYKXX8g+LLzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oiG72Znkk++15W67rpieOoJVY/oNvdA7TZirv9GYFzvoI2eXccs8zWoT0uvvMdBi3 9S3etXilgrjDUY6SEYR7qzxF/1SGpy1n1dC1rdD/2Mpc5GCtKk8EevaUdEcnDSaVOY sLR1ltkRjBSBEI8iUOInl5vD1zSVP9duEr9UfXqUbqepBMx1v7LOkJTAjvsSXCeAUF 1YLMpApKmUXUk/XB4QRtPKXazLPzlvdgbVpuukS3Jmg2w3mf+vA34AA+t6t5G9JKbC fdsj/0jnBnIFWFSSwBH4zwO7YhYlWlMPsCO/D67NaoQLdRTAiPPF8/4hW6lkzgA+TZ tWP/m1IBdzS0Q== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: x86@kernel.org, Tim Chen Subject: [PATCH 3/3] crypto: x86/sha512-avx2 - add missing vzeroupper Date: Fri, 5 Apr 2024 20:26:10 -0400 Message-ID: <20240406002610.37202-4-ebiggers@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240406002610.37202-1-ebiggers@kernel.org> References: <20240406002610.37202-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Eric Biggers Since sha512_transform_rorx() uses ymm registers, execute vzeroupper before returning from it. This is necessary to avoid reducing the performance of SSE code. Fixes: e01d69cb0195 ("crypto: sha512 - Optimized SHA512 x86_64 assembly routine using AVX instructions.") Signed-off-by: Eric Biggers Acked-by: Tim Chen --- arch/x86/crypto/sha512-avx2-asm.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/crypto/sha512-avx2-asm.S b/arch/x86/crypto/sha512-avx2-asm.S index f08496cd6870..24973f42c43f 100644 --- a/arch/x86/crypto/sha512-avx2-asm.S +++ b/arch/x86/crypto/sha512-avx2-asm.S @@ -678,10 +678,11 @@ SYM_TYPED_FUNC_START(sha512_transform_rorx) pop %r14 pop %r13 pop %r12 pop %rbx + vzeroupper RET SYM_FUNC_END(sha512_transform_rorx) ######################################################################## ### Binary Data