From patchwork Sun Jan 23 09:47:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harsha X-Patchwork-Id: 12720892 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C17CC433FE for ; Sun, 23 Jan 2022 09:47:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236116AbiAWJrz (ORCPT ); Sun, 23 Jan 2022 04:47:55 -0500 Received: from mail-dm3nam07on2047.outbound.protection.outlook.com ([40.107.95.47]:14465 "EHLO NAM02-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236113AbiAWJrw (ORCPT ); Sun, 23 Jan 2022 04:47:52 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C8KMLU3nILmIG+kqkhl0Tr+w5fBrUwVy23E1vqtz9efcNPHjeZSKFn0+CzkTnQY9ijDW79PKx0jBEyWQ9HTpEmeNb41dv5V88qkf2SzS0+NcBbAN/kxM5mPTFyxSO8hzIOPXdAAuERWlVso38ScQ3OAr9ew6LqD6nt8vQop2pmcRJVNAO2nwyUzI7YMCYY7PiDZKZH27lx6LVyEEdpCQQnBbi1QVR2c6pqS18qklM79+XtYs2q9aAK9IbsLvWZYZ4OMkQcMhgGjCtAx4xceQqACqhEuLGwDFQXPCVDzvq2Fypy+QmMZdIW/bWFgqGXMyIsCOuz3VHKlf+ZVdk2NCMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gU76c8YXqyjJqYId7CBqPxg7Qp74rkLTsrT6kIdQTbE=; b=PF4jc7xbUMWehkSzsknCfxixlD5RKIwf5ARFg2seNwY2wIEw1fkOtqF6uPDREaATxtgVgN+IRnvj2YgHARaSebDAyFQ8pgdZIHoupCMERxFh8jyGaprg3blfjTx2kyktVq4Zz031bQJwmjt60sL4uthkHxZe+/VDd4nHN3A4kKAfB50rQSFPFTvTY9RyD3Zd9a+em4KZd8mQF/cBEKJKVHTd3gpjoBSGvXqkj7eE8XMyiRrbS3Lx06j9DzWvnWnnXa1PwA8jBjCbb17lcXJeQzUE0QrO2kJuekolvC7FCZAtQencmEQVJca4MFkQyrU9a08yINGDE16mWyaIdtwKKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gU76c8YXqyjJqYId7CBqPxg7Qp74rkLTsrT6kIdQTbE=; b=Z1tD7GijFSdaJXrgreFF+idCraCGBLZI8EoxRRNu59nabUPS5fvMA2GxkFAewD6NBfSHHzjkb9lKSMLj9Yi5Pev+iGrSM9cJkt9LeiE3CHX9kvdZnf2ixoXhCmOdLVC4CaLbEWZrBUcg5ySAi/7SAH1y0z9evbNyZq2Bl/JgoCI= Received: from DM5PR19CA0014.namprd19.prod.outlook.com (2603:10b6:3:151::24) by SN4PR0201MB3533.namprd02.prod.outlook.com (2603:10b6:803:4a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.12; Sun, 23 Jan 2022 09:47:49 +0000 Received: from DM3NAM02FT007.eop-nam02.prod.protection.outlook.com (2603:10b6:3:151:cafe::51) by DM5PR19CA0014.outlook.office365.com (2603:10b6:3:151::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.17 via Frontend Transport; Sun, 23 Jan 2022 09:47:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT007.mail.protection.outlook.com (10.13.4.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4909.8 via Frontend Transport; Sun, 23 Jan 2022 09:47:48 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Sun, 23 Jan 2022 01:47:47 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Sun, 23 Jan 2022 01:47:47 -0800 Envelope-to: git@xilinx.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robh+dt@kernel.org, devicetree@vger.kernel.org Received: from [10.140.6.15] (port=60078 helo=xhdharshah40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nBZTP-0001bj-2v; Sun, 23 Jan 2022 01:47:47 -0800 From: Harsha To: , , , , , , , CC: , , , Harsha Subject: [PATCH 1/4] drivers: crypto: Updated Makefile for xilinx subdirectory Date: Sun, 23 Jan 2022 15:17:04 +0530 Message-ID: <1642931227-20706-2-git-send-email-harsha.harsha@xilinx.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1642931227-20706-1-git-send-email-harsha.harsha@xilinx.com> References: <1642931227-20706-1-git-send-email-harsha.harsha@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ebd9becf-d46b-495e-a94c-08d9de556a2f X-MS-TrafficTypeDiagnostic: SN4PR0201MB3533:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j4WEydejnzuFmKQCb3aBX9jFAgur96O2sMwtgWI8HGcnrZC8lvnig6x2hRalx2uNR4g/L9HHWDzvYlEGr6+pLIQB2s/1uBvHjMwVM11F26vVgk7OcxNRQLa0o6QeIDO9EE/LX4GOtILlGiA7kDdzO2+tAmBkzZ+6EKAEVpFyZ3GA8K5s5StCWMiQHzud0Uy3iIPNKkranA4D1cq1sOZ4Z5dTEgIGtiwaZNQTSpCm+N3mYu8IVIE/D/ddqUBteee5SfvZG5HBpwsP2yeL2ZWTuvTdppQ3ApGiLQOeCl/nfYIXdfkzSipxvejdnSGa4qOiZYrhcOv2TsFe9Fyw3Tt82VLuIucA8Up6oh2qHQWuiBHtxEaTzz9Y3+6gtiAe+SzZzD2onTGsUD6n/NLvlX3yJr2MJYLqCXey06MC9gjsabDzt5Xn3mj2GM0k0ioKfCB07UIilXKlHIZAxh0q+aBUYOeuoAxhYEHqhns+kiOn8vvxCjKU+elYNib8f3x9bI9sbvq6YfQ9FYB5DS8WJXps7j5GL2de5t2s1NCFQCt2L0GBkqPGtO1n2oTh9ILv8Y9H97sPvXTG5trSxKsMLGlQCGKJU0QjTzfThT7ys+78ifOuymUgjyD0UHtzKY6VtptwLSNWY4EvqujKCWJCUuTm+XmjmNASVtw4eQxvBhNZq89AOZbuJTcrP1Cp2rxSST0q2IlmJ7YM5VM3+iO33QPNA5hzLK3smidBEHXGQxunBGc= X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(8936002)(426003)(7636003)(8676002)(26005)(2906002)(70206006)(336012)(15650500001)(356005)(5660300002)(47076005)(54906003)(110136005)(83380400001)(9786002)(70586007)(316002)(82310400004)(508600001)(7696005)(36860700001)(2616005)(36756003)(107886003)(4326008)(6666004)(186003)(4744005)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2022 09:47:48.3793 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ebd9becf-d46b-495e-a94c-08d9de556a2f X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT007.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0201MB3533 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This patch updates the Makefile for xilinx subdirectory. CONFIG_CRYPTO_DEV_ZYNQMP_AES protects zynqmp-aes-gcm.o and it is used twice (in drivers/crypto/Makefile and drivers/crypto/xilinx/Makefile) and it is enough to use it once. Signed-off-by: Harsha Reviewed-by: Michal Simek --- drivers/crypto/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile index 1fe5120..0a4fff2 100644 --- a/drivers/crypto/Makefile +++ b/drivers/crypto/Makefile @@ -47,7 +47,7 @@ obj-$(CONFIG_CRYPTO_DEV_VMX) += vmx/ obj-$(CONFIG_CRYPTO_DEV_BCM_SPU) += bcm/ obj-$(CONFIG_CRYPTO_DEV_SAFEXCEL) += inside-secure/ obj-$(CONFIG_CRYPTO_DEV_ARTPEC6) += axis/ -obj-$(CONFIG_CRYPTO_DEV_ZYNQMP_AES) += xilinx/ +obj-y += xilinx/ obj-y += hisilicon/ obj-$(CONFIG_CRYPTO_DEV_AMLOGIC_GXL) += amlogic/ obj-y += keembay/ From patchwork Sun Jan 23 09:47:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harsha X-Patchwork-Id: 12720893 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 312B5C433F5 for ; Sun, 23 Jan 2022 09:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235396AbiAWJsN (ORCPT ); Sun, 23 Jan 2022 04:48:13 -0500 Received: from mail-dm6nam11on2047.outbound.protection.outlook.com ([40.107.223.47]:2848 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231782AbiAWJsM (ORCPT ); Sun, 23 Jan 2022 04:48:12 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a/GEVEvxfKkUN1tFCqzpbqDUsHCLha/O7AwtKaFpXE+rDwQ5ekTQygc5qGAVEfZAhSJfcjSBH0yn8mgzDQS5Y/8nWg96E6v3O6LB9IMW7x6motMUK0UxrFVq9l9N0miDGW2VSIFUGGog7h0iCkZH9k+9xJSpwvheqSlv+lLyBebP2JxPComkS1GhlzS2E7wQqTe9J9mwrGdtkUCJaLvmQuyreEbUZUoV8SulmTUjvA3KZAHS0njQZj9RfwKsWGgnAyr6+EN1sPhqus4wzV/CkLvOlWyitVm5dChcRYYnWvqnW3pmyoaUj/jE6+8c+6TUHCaE15DBh7LvM5WV1k5oww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=o8KsoEK/E5flaUtXpeiB1VxfXCpdMm2TkAxCfqtb1SQ=; b=jbf7aDfoFXmXkUHBhHPzYQqU3IWl48F56HwwOTw631Ux2r65AYiqloTDc7v1GQslIFUnH7UfqHnj8QFhCM16EaBHJ0ooD8/XeOEC0eQmSTkSVN9216pbln9UIDQBAe4Hvmj9+/ldFjJpcMVghdLSl9sX4N1hzRsnsv3yboZFgehJq3b+AkJRI/m4rAbIuWjMwVZHuVQsQ/lDzD8Yp6ldPqEf9B4pNWrwA5hNfHhlWvqLjT5dIt9NjL4WzvgQqXxIi63cX1ptLM5yz76fMYdHxkTusocqRW2yWTmzKGEutgUN0ABaeLGZpjUWmZ8PjiT5YNif9LtmIz/fuCsAIF5yHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o8KsoEK/E5flaUtXpeiB1VxfXCpdMm2TkAxCfqtb1SQ=; b=TILBZvcH8eOMqosWUQaqWIACbib/g2t1cxnhuQpVg51LTIvDpr2JVx4FN7litG56oa/hbZNmg/JyYUaCUgajJUZKugOZ3l5CKnFaORZH1JrrBLyrCYyJphmIGNIDmWdl2hbOmjjzlrWr0Eusxd0t+y5tMwAFUy+uQCAL0lmX0oE= Received: from BN6PR19CA0076.namprd19.prod.outlook.com (2603:10b6:404:133::14) by CH2PR02MB6327.namprd02.prod.outlook.com (2603:10b6:610:b::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.7; Sun, 23 Jan 2022 09:48:09 +0000 Received: from BN1NAM02FT040.eop-nam02.prod.protection.outlook.com (2603:10b6:404:133:cafe::c8) by BN6PR19CA0076.outlook.office365.com (2603:10b6:404:133::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.15 via Frontend Transport; Sun, 23 Jan 2022 09:48:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BN1NAM02FT040.mail.protection.outlook.com (10.13.2.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4909.8 via Frontend Transport; Sun, 23 Jan 2022 09:48:08 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Sun, 23 Jan 2022 01:47:51 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Sun, 23 Jan 2022 01:47:51 -0800 Envelope-to: git@xilinx.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robh+dt@kernel.org, devicetree@vger.kernel.org Received: from [10.140.6.15] (port=60078 helo=xhdharshah40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nBZTS-0001bj-Fc; Sun, 23 Jan 2022 01:47:50 -0800 From: Harsha To: , , , , , , , CC: , , , Harsha Subject: [PATCH 2/4] firmware: xilinx: Add ZynqMP SHA API for SHA3 functionality Date: Sun, 23 Jan 2022 15:17:05 +0530 Message-ID: <1642931227-20706-3-git-send-email-harsha.harsha@xilinx.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1642931227-20706-1-git-send-email-harsha.harsha@xilinx.com> References: <1642931227-20706-1-git-send-email-harsha.harsha@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76f377bd-a7f3-4c83-8c45-08d9de5575ed X-MS-TrafficTypeDiagnostic: CH2PR02MB6327:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hPC+CCLpxwUOjmDVsMqnyYeVzy79zcDYApiCgVcDrONwg7WfXbmZDBZDQMVEQOsQbh3a5FaJcSPB46CJ3wpHuPKOWGg7/znonUX54mYsRYxH6zBRcZALtsigIY6fJ2aMIdyYXOJ/VpBVC7K3GZDGZCxN+AtzhEFMpfD4fjttYFwFrkI3zngquQl1kILvq+SmXF5tcCaPDDRvpNVS6hZj5RpyXlvSYCVlpIo/hWDOFJlc68M9A63SwJxQ6WywJzBIsZZuEvxcoKOOe37coHIuCprXalT1vh52xvGT7qmAZOb4AHT24QeHSMlYVbfUOAMqfwdC0iTbZtf3BQbvOqrMMH+sCrURQ+RRCBsSaFCZw4iyB0pSP2X3sail0GxX4DkzKDbmIdxx/NN3MADsFnj/DJirgaOqnrZgNun4lcp/ZGuqKpcc+7XnoJBrHLb3DqNeDTS5d8ZJLRNUSXEl1RI0x1zfOBKR73QgRtKRwqXTuxSv4FYUDBMf67qJzXBoXsv2GJio/Q0NGTv3H74R63FKSHg7pRYbgVkOwP3gptFTnkWqPH8zbeVc79nfgLCv0MYBLGd6kUNKk1k5qLjpRBjaX0Rl9K7xpkeJYEW5QCL0/ja3JSp6SQP/m9rBSYRu4J3xmrVuvxKHtqzHDCpn8hAyy0J019AP4m1ePLbh6ijH8t2mcIeDS5HscHli0o/Hx6O9MM0h9JGKwZePtel8qE6jJfnizfUsw1h/LQLbNZTk4Co= X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(316002)(36756003)(9786002)(336012)(508600001)(4326008)(426003)(2616005)(2906002)(110136005)(54906003)(6666004)(83380400001)(356005)(26005)(8936002)(7696005)(7636003)(82310400004)(5660300002)(36860700001)(186003)(70206006)(107886003)(70586007)(47076005)(8676002)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2022 09:48:08.0318 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76f377bd-a7f3-4c83-8c45-08d9de5575ed X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT040.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR02MB6327 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This patch adds zynqmp_pm_sha_hash API in the ZynqMP firmware to compute SHA3 hash of given data. Signed-off-by: Harsha --- drivers/firmware/xilinx/zynqmp.c | 26 ++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 8 ++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 3dd45a7..a84c5ea 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -1117,6 +1117,32 @@ int zynqmp_pm_aes_engine(const u64 address, u32 *out) EXPORT_SYMBOL_GPL(zynqmp_pm_aes_engine); /** + * zynqmp_pm_sha_hash - Access the SHA engine to calculate the hash + * @address: Address of the data/ Address of output buffer where + * hash should be stored. + * @size: Size of the data. + * @flags: + * BIT(0) - for initializing csudma driver and SHA3(Here address + * and size inputs can be NULL). + * BIT(1) - to call Sha3_Update API which can be called multiple + * times when data is not contiguous. + * BIT(2) - to get final hash of the whole updated data. + * Hash will be overwritten at provided address with + * 48 bytes. + * + * Return: Returns status, either success or error code. + */ +int zynqmp_pm_sha_hash(const u64 address, const u32 size, const u32 flags) +{ + u32 lower_addr = lower_32_bits(address); + u32 upper_addr = upper_32_bits(address); + + return zynqmp_pm_invoke_fn(PM_SECURE_SHA, upper_addr, lower_addr, + size, flags, NULL); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_sha_hash); + +/** * zynqmp_pm_system_shutdown - PM call to request a system shutdown or restart * @type: Shutdown or restart? 0 for shutdown, 1 for restart * @subtype: Specifies which system should be restarted or shut down diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 47fd4e5..38ef708 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -78,6 +78,7 @@ enum pm_api_id { PM_FPGA_LOAD = 22, PM_FPGA_GET_STATUS = 23, PM_GET_CHIPID = 24, + PM_SECURE_SHA = 26, PM_PINCTRL_REQUEST = 28, PM_PINCTRL_RELEASE = 29, PM_PINCTRL_GET_FUNCTION = 30, @@ -410,6 +411,7 @@ int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities, const u32 qos, const enum zynqmp_pm_request_ack ack); int zynqmp_pm_aes_engine(const u64 address, u32 *out); +int zynqmp_pm_sha_hash(const u64 address, const u32 size, const u32 flags); int zynqmp_pm_fpga_load(const u64 address, const u32 size, const u32 flags); int zynqmp_pm_fpga_get_status(u32 *value); int zynqmp_pm_write_ggs(u32 index, u32 value); @@ -581,6 +583,12 @@ static inline int zynqmp_pm_aes_engine(const u64 address, u32 *out) return -ENODEV; } +static inline int zynqmp_pm_sha_hash(const u64 address, const u32 size, + const u32 flags) +{ + return -ENODEV; +} + static inline int zynqmp_pm_fpga_load(const u64 address, const u32 size, const u32 flags) { From patchwork Sun Jan 23 09:47:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harsha X-Patchwork-Id: 12720900 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 375BFC4332F for ; Sun, 23 Jan 2022 09:48:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231782AbiAWJs3 (ORCPT ); Sun, 23 Jan 2022 04:48:29 -0500 Received: from mail-bn7nam10on2071.outbound.protection.outlook.com ([40.107.92.71]:7776 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235947AbiAWJsV (ORCPT ); Sun, 23 Jan 2022 04:48:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eknxuKYcwQKUDx/QIirmThhEPlj1RpZsqCsuSg56bzmXIJa/V1/75dYvuMYfakvpKozphwoY6Bt2WE64yYYAsfE5X5p8xOWLXFVH9BT2NYWjTxx3AOJpPrNtEWq/AfvmEfReJiECg5J3XHZPY60y3fXyq7Y64cvBdgJ/Cw4AihlUT5yH6t9GPvPGXoTm5x3j036TN3WEGbAfS2aU1/scepn8ceQ228L/Via+QqG/BfXu6YT20H817UA15Y0qJmFB1Ay0RlffPEsLqc6vLBeA8lxw7Z4f1vYwjZ+p7+U89ww0sVawEIJDe6cjySaiB9ddxFnACkVrb9tFt9v61CYWTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p9BDdGuWJXrrhAbP3GtAxvdWo+Oing5b7HXBiIgGVJk=; b=guhdqTj+d4eiOenr6gVosg1tuk1O+YeJ8fhoe552OEk7A2Ci6xOn6ocpffu0Ef6G0HPd2tZeKAyVUEJdbIwZk8u+7rBv/bqwWewfJIvMV7Cp2mfNWfUftinaB69WKXGg05N0qDGPK5s2LLYRspcAikrsU3d2h9X1SJcd/DhkvxYqArFh+Zd7648eza/HX3coOygvsC3e3+BUvDxXXyF8FPFpPq/i64k3+hr3zFCPBpF4lVkdEaSU/aWeSJQkYRUuHUWez83FfjgNCWVsR5rOpL1KWWEJ/jxo60i9LQxCd3V8YADDytZtTlq8mEcmVDN8B2U/BHeGRiMdSu+DxAhOnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p9BDdGuWJXrrhAbP3GtAxvdWo+Oing5b7HXBiIgGVJk=; b=MrJB5ZPjFyXeSnh3MXXNE1OhxFmuYEczxTYgxGSZintTNb7mH/D+XtO1xuWsNAHiAUobnxnpXoK07fCvnVPBviqMroB4OxlutO/GH2p4+eWJ/ynTZjQltRtxahiSScSR5zN/aykb0HD4zuw6F5KfbDtrTI+WCdjQgdWj6RPzu3U= Received: from BN6PR17CA0057.namprd17.prod.outlook.com (2603:10b6:405:75::46) by DM6PR02MB6138.namprd02.prod.outlook.com (2603:10b6:5:1fd::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.8; Sun, 23 Jan 2022 09:48:17 +0000 Received: from BN1NAM02FT049.eop-nam02.prod.protection.outlook.com (2603:10b6:405:75:cafe::d) by BN6PR17CA0057.outlook.office365.com (2603:10b6:405:75::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.17 via Frontend Transport; Sun, 23 Jan 2022 09:48:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BN1NAM02FT049.mail.protection.outlook.com (10.13.2.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4909.8 via Frontend Transport; Sun, 23 Jan 2022 09:48:15 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Sun, 23 Jan 2022 01:47:54 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Sun, 23 Jan 2022 01:47:54 -0800 Envelope-to: git@xilinx.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robh+dt@kernel.org, devicetree@vger.kernel.org Received: from [10.140.6.15] (port=60078 helo=xhdharshah40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nBZTV-0001bj-SN; Sun, 23 Jan 2022 01:47:54 -0800 From: Harsha To: , , , , , , , CC: , , , Harsha Subject: [PATCH 3/4] crypto: xilinx: Add Xilinx SHA3 driver Date: Sun, 23 Jan 2022 15:17:06 +0530 Message-ID: <1642931227-20706-4-git-send-email-harsha.harsha@xilinx.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1642931227-20706-1-git-send-email-harsha.harsha@xilinx.com> References: <1642931227-20706-1-git-send-email-harsha.harsha@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4dba61bc-878b-493a-5db1-08d9de557aa0 X-MS-TrafficTypeDiagnostic: DM6PR02MB6138:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7z2ZW7gMRra1jXAkb22C480rymCG+jBBvZYUTCPGFeWWRzcuawTbyaO9kAS8h7QaNn2YyiedJG+Uf7LJFFbjvLcwOsKK9B1yo9EnHxSvyNtbHSaikDnlirs8v/sRH1KgUglzm/f1dWopNuWy4mg9C4RIeKXkx9Xzpn5fAAdUUXY/OhMIeDBTH+OqWxVVkgFygSrwwxBNe1Gw+3N+SrU5crleBTaPGsXg5Smt9RpK+itgEtr6WUpdC+WQDxY2R7JG8zQGE23lrV91hbq7nU4hCtdVLBNnE4CoRzC02N6US9qQb3pbDZEVf+XNC3WKItRXbuloJtuu8Tvg1y+05A2b7Ge0Scct+sWwFb/Py1xcHh6C2VRdJRQyyLpqCPSDAZKc83jaCnnh/1mlfDn6p5FIW7FIZuZ1TZCDk2tPFbkXVTVZ+8mcx7KLMYk6daZmGBipdo3Rmn3h3tEPvDIh7pw9m+sDxt3vHIvUKAh81sFWYZmNHnArkj34CkMjQSPdCHR2cQxDkiEfUPM2t+tcu/94yMbcpxA8MrSTcKASjhPR5yEgKwN0ncqQKpzpiGoi3NrxxDwZcnUXbj9n0xaHh0mQIvxo1WuJ8iQALqZKtjzSeXQIIaYvYQoiXtPJ/EVj8v71pp6chkNBqfX+CN6q+9JdS6LmYhD/kyvC3bPfYRS00kbBFdpXLVS36dkZf5UMwCxyb9QpCzaFs74N5JtZyA9xj8KdiPRU7qXlR2TjhejO2I0= X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(426003)(356005)(83380400001)(4326008)(6666004)(186003)(508600001)(26005)(7636003)(7696005)(82310400004)(36756003)(2906002)(70586007)(70206006)(47076005)(9786002)(36860700001)(107886003)(336012)(5660300002)(2616005)(316002)(110136005)(54906003)(8936002)(8676002)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2022 09:48:15.9146 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4dba61bc-878b-493a-5db1-08d9de557aa0 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT049.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6138 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This patch adds SHA3 driver support for the Xilinx ZynqMP SoC. Xilinx ZynqMP SoC has SHA3 engine used for secure hash calculation. The flow is SHA3 request from Userspace -> SHA3 driver-> ZynqMp driver-> Firmware -> SHA3 HW Engine SHA3 HW engine in Xilinx ZynqMP SoC, does not support parallel processing of 2 hash requests. Therefore, software fallback is being used for init, update, final, export and import in the ZynqMP SHA driver For digest, the calculation of SHA3 hash is done by the hardened SHA3 accelerator in Xilinx ZynqMP SoC. Signed-off-by: Harsha Reported-by: kernel test robot --- drivers/crypto/Kconfig | 10 ++ drivers/crypto/xilinx/Makefile | 1 + drivers/crypto/xilinx/zynqmp-sha.c | 285 +++++++++++++++++++++++++++++++++++++ 3 files changed, 296 insertions(+) create mode 100644 drivers/crypto/xilinx/zynqmp-sha.c diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 51690e7..2e43f11 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -796,6 +796,16 @@ config CRYPTO_DEV_ZYNQMP_AES accelerator. Select this if you want to use the ZynqMP module for AES algorithms. +config CRYPTO_DEV_ZYNQMP_SHA3 + bool "Support for Xilinx ZynqMP SHA3 hardware accelerator" + depends on ARCH_ZYNQMP || COMPILE_TEST + select CRYPTO_SHA3 + help + Xilinx ZynqMP has SHA3 engine used for secure hash calculation. + This driver interfaces with SHA3 hardware engine. + Select this if you want to use the ZynqMP module + for SHA3 hash computation. + source "drivers/crypto/chelsio/Kconfig" source "drivers/crypto/virtio/Kconfig" diff --git a/drivers/crypto/xilinx/Makefile b/drivers/crypto/xilinx/Makefile index 534e32d..730feff 100644 --- a/drivers/crypto/xilinx/Makefile +++ b/drivers/crypto/xilinx/Makefile @@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_CRYPTO_DEV_ZYNQMP_AES) += zynqmp-aes-gcm.o +obj-$(CONFIG_CRYPTO_DEV_ZYNQMP_SHA3) += zynqmp-sha.o diff --git a/drivers/crypto/xilinx/zynqmp-sha.c b/drivers/crypto/xilinx/zynqmp-sha.c new file mode 100644 index 0000000..11f103c --- /dev/null +++ b/drivers/crypto/xilinx/zynqmp-sha.c @@ -0,0 +1,285 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Xilinx ZynqMP SHA Driver. + * Copyright (c) 2022 Xilinx Inc. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ZYNQMP_DMA_BIT_MASK 32U +#define ZYNQMP_DMA_ALLOC_FIXED_SIZE 0x1000U + +enum zynqmp_sha_op { + ZYNQMP_SHA3_INIT = 1, + ZYNQMP_SHA3_UPDATE = 2, + ZYNQMP_SHA3_FINAL = 4, +}; + +struct zynqmp_sha_drv_ctx { + struct shash_alg sha3_384; + struct device *dev; +}; + +struct zynqmp_sha_tfm_ctx { + struct device *dev; + struct crypto_shash *fbk_tfm; +}; + +struct zynqmp_sha_desc_ctx { + struct shash_desc fbk_req; +}; + +static dma_addr_t update_dma_addr, final_dma_addr; +static char *ubuf, *fbuf; + +static int zynqmp_sha_init_tfm(struct crypto_shash *hash) +{ + const char *fallback_driver_name = crypto_shash_alg_name(hash); + struct zynqmp_sha_tfm_ctx *tfm_ctx = crypto_shash_ctx(hash); + struct shash_alg *alg = crypto_shash_alg(hash); + struct crypto_shash *fallback_tfm; + struct zynqmp_sha_drv_ctx *drv_ctx; + + drv_ctx = container_of(alg, struct zynqmp_sha_drv_ctx, sha3_384); + tfm_ctx->dev = drv_ctx->dev; + + /* Allocate a fallback and abort if it failed. */ + fallback_tfm = crypto_alloc_shash(fallback_driver_name, 0, + CRYPTO_ALG_NEED_FALLBACK); + if (IS_ERR(fallback_tfm)) + return PTR_ERR(fallback_tfm); + + tfm_ctx->fbk_tfm = fallback_tfm; + hash->descsize += crypto_shash_descsize(tfm_ctx->fbk_tfm); + + return 0; +} + +static void zynqmp_sha_exit_tfm(struct crypto_shash *hash) +{ + struct zynqmp_sha_tfm_ctx *tfm_ctx = crypto_shash_ctx(hash); + + if (tfm_ctx->fbk_tfm) { + crypto_free_shash(tfm_ctx->fbk_tfm); + tfm_ctx->fbk_tfm = NULL; + } + + memzero_explicit(tfm_ctx, sizeof(struct zynqmp_sha_tfm_ctx)); +} + +static int zynqmp_sha_init(struct shash_desc *desc) +{ + struct zynqmp_sha_desc_ctx *dctx = shash_desc_ctx(desc); + struct zynqmp_sha_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm); + + dctx->fbk_req.tfm = tctx->fbk_tfm; + return crypto_shash_init(&dctx->fbk_req); +} + +static int zynqmp_sha_update(struct shash_desc *desc, const u8 *data, unsigned int length) +{ + struct zynqmp_sha_desc_ctx *dctx = shash_desc_ctx(desc); + + return crypto_shash_update(&dctx->fbk_req, data, length); +} + +static int zynqmp_sha_final(struct shash_desc *desc, u8 *out) +{ + struct zynqmp_sha_desc_ctx *dctx = shash_desc_ctx(desc); + + return crypto_shash_final(&dctx->fbk_req, out); +} + +static int zynqmp_sha_finup(struct shash_desc *desc, const u8 *data, unsigned int length, u8 *out) +{ + struct zynqmp_sha_desc_ctx *dctx = shash_desc_ctx(desc); + + return crypto_shash_finup(&dctx->fbk_req, data, length, out); +} + +static int zynqmp_sha_import(struct shash_desc *desc, const void *in) +{ + struct zynqmp_sha_desc_ctx *dctx = shash_desc_ctx(desc); + struct zynqmp_sha_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm); + + dctx->fbk_req.tfm = tctx->fbk_tfm; + return crypto_shash_import(&dctx->fbk_req, in); +} + +static int zynqmp_sha_export(struct shash_desc *desc, void *out) +{ + struct zynqmp_sha_desc_ctx *dctx = shash_desc_ctx(desc); + + return crypto_shash_export(&dctx->fbk_req, out); +} + +static int zynqmp_sha_digest(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) +{ + unsigned int remaining_len = len; + int update_size; + int ret; + + ret = zynqmp_pm_sha_hash(0, 0, ZYNQMP_SHA3_INIT); + if (ret) + return ret; + + while (remaining_len != 0) { + memset(ubuf, 0, ZYNQMP_DMA_ALLOC_FIXED_SIZE); + if (remaining_len >= ZYNQMP_DMA_ALLOC_FIXED_SIZE) { + update_size = ZYNQMP_DMA_ALLOC_FIXED_SIZE; + remaining_len -= ZYNQMP_DMA_ALLOC_FIXED_SIZE; + } else { + update_size = remaining_len; + remaining_len = 0; + } + memcpy(ubuf, data, update_size); + flush_icache_range((unsigned long)ubuf, (unsigned long)ubuf + update_size); + ret = zynqmp_pm_sha_hash(update_dma_addr, update_size, ZYNQMP_SHA3_UPDATE); + if (ret) + return ret; + + data += update_size; + } + + ret = zynqmp_pm_sha_hash(final_dma_addr, SHA3_384_DIGEST_SIZE, ZYNQMP_SHA3_FINAL); + memcpy(out, fbuf, SHA3_384_DIGEST_SIZE); + memset(fbuf, 0, SHA3_384_DIGEST_SIZE); + + return ret; +} + +static struct zynqmp_sha_drv_ctx sha3_drv_ctx = { + .sha3_384 = { + .init = zynqmp_sha_init, + .update = zynqmp_sha_update, + .final = zynqmp_sha_final, + .finup = zynqmp_sha_finup, + .digest = zynqmp_sha_digest, + .export = zynqmp_sha_export, + .import = zynqmp_sha_import, + .init_tfm = zynqmp_sha_init_tfm, + .exit_tfm = zynqmp_sha_exit_tfm, + .descsize = sizeof(struct zynqmp_sha_desc_ctx), + .statesize = sizeof(struct sha3_state), + .digestsize = SHA3_384_DIGEST_SIZE, + .base = { + .cra_name = "sha3-384", + .cra_driver_name = "zynqmp-sha3-384", + .cra_priority = 300, + .cra_flags = CRYPTO_ALG_KERN_DRIVER_ONLY | + CRYPTO_ALG_ALLOCATES_MEMORY | + CRYPTO_ALG_NEED_FALLBACK, + .cra_blocksize = SHA3_384_BLOCK_SIZE, + .cra_ctxsize = sizeof(struct zynqmp_sha_tfm_ctx), + .cra_alignmask = 3, + .cra_module = THIS_MODULE, + } + } +}; + +static int zynqmp_sha_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + int err; + + err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(ZYNQMP_DMA_BIT_MASK)); + if (err < 0) { + dev_err(dev, "No usable DMA configuration\n"); + return err; + } + + err = crypto_register_shash(&sha3_drv_ctx.sha3_384); + if (err < 0) { + dev_err(dev, "Failed to register shash alg.\n"); + return err; + } + + sha3_drv_ctx.dev = dev; + platform_set_drvdata(pdev, &sha3_drv_ctx); + + ubuf = dma_alloc_coherent(dev, ZYNQMP_DMA_ALLOC_FIXED_SIZE, &update_dma_addr, GFP_KERNEL); + if (!ubuf) { + err = -ENOMEM; + goto err_shash; + } + + fbuf = dma_alloc_coherent(dev, SHA3_384_DIGEST_SIZE, &final_dma_addr, GFP_KERNEL); + if (!fbuf) { + err = -ENOMEM; + goto err_mem; + } + + return 0; + +err_mem: + dma_free_coherent(sha3_drv_ctx.dev, ZYNQMP_DMA_ALLOC_FIXED_SIZE, ubuf, update_dma_addr); + +err_shash: + crypto_unregister_shash(&sha3_drv_ctx.sha3_384); + + return err; +} + +static int zynqmp_sha_remove(struct platform_device *pdev) +{ + sha3_drv_ctx.dev = platform_get_drvdata(pdev); + + dma_free_coherent(sha3_drv_ctx.dev, ZYNQMP_DMA_ALLOC_FIXED_SIZE, ubuf, update_dma_addr); + dma_free_coherent(sha3_drv_ctx.dev, SHA3_384_DIGEST_SIZE, fbuf, final_dma_addr); + crypto_unregister_shash(&sha3_drv_ctx.sha3_384); + + return 0; +} + +static struct platform_driver zynqmp_sha_driver = { + .probe = zynqmp_sha_probe, + .remove = zynqmp_sha_remove, + .driver = { + .name = "zynqmp-sha3-384", + }, +}; + +static int __init sha_driver_init(void) +{ + struct platform_device *pdev; + int ret; + + ret = platform_driver_register(&zynqmp_sha_driver); + if (ret) + return ret; + + pdev = platform_device_register_simple(zynqmp_sha_driver.driver.name, + 0, NULL, 0); + if (IS_ERR(pdev)) { + ret = PTR_ERR(pdev); + platform_driver_unregister(&zynqmp_sha_driver); + pr_info("Failed to register ZynqMP SHA3 dvixe %d\n", ret); + } + + return ret; +} + +device_initcall(sha_driver_init); + +static void __exit sha_driver_exit(void) +{ + platform_driver_unregister(&zynqmp_sha_driver); +} + +module_platform_driver(zynqmp_sha_driver); + +MODULE_DESCRIPTION("ZynqMP SHA3 hardware acceleration support."); +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Harsha "); From patchwork Sun Jan 23 09:47:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harsha X-Patchwork-Id: 12720899 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2711C433F5 for ; Sun, 23 Jan 2022 09:48:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235830AbiAWJs2 (ORCPT ); Sun, 23 Jan 2022 04:48:28 -0500 Received: from mail-dm6nam11on2089.outbound.protection.outlook.com ([40.107.223.89]:62784 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235974AbiAWJsX (ORCPT ); Sun, 23 Jan 2022 04:48:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XKIFo9h0mAGV9jxEKn34gVT58BbC14Kxu0PHrah6vxDTNfLnbgMLkCp6vsmxcNdiuc2A43NwMe0bLHZQmBMevy2pG9xEtz9EybtCUTkLkpH9uU9T7+3NuNkye2baHFerLS1z4ELMjzXL7vyzXcBJQTNrCixON8OQKEaFzR6sZC2AVjn0OW/X0GZvO3GWQ2aOok+yLZqlKMCY0bNZNRfsRU0dWbEIjq/AhO37FLuRTjStmk5oxrAJHB4G3G3rnWyTC6HsiPOysucoMshYbiTukbRWgznep0kofu7YVB2tAqVviwfyWqq+IrMFsVG8mufyBX7XU5pDbOJtydJlkpFv0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eVIPrBrkgmSchQG/nRiU0fxiSFlbnrJOu3wewXaT6Lk=; b=OAyQPdQ6MF9yej7WJBP/TCKID77gDEDYNQmqK9ghp81QQC5G24UiWD+JnqA2jlyiBYM5w2/Md0f0ykbzDJob88FK0twbNEGNl06ExD1vOCTFHDSONQPVmdUg+kY2Stt/gPpHuad4Gd9FgRVQ6giKmzEUpxgrV3jadLHQxip8WpkmrN+oVkq8rewTifCcDdY9NfUGg3zLbbjFIBxIUB0V5VGhnIrG0lJ8nJNX4FqedXmadlbbLLsuDqBk4wwWI0yT1gVRw8Qje25W/oX2ZZAtD7kvfJuZSIBzj5G5Bjsgh7cUPbNKBgTT2pDthqOnjylgqfiiatqNfgxcKRrriIWtAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eVIPrBrkgmSchQG/nRiU0fxiSFlbnrJOu3wewXaT6Lk=; b=iHNEzaEx9TSxcpXaLaHNj4lNmVjy/qoAERDLMplNJ4bBVCBsJSdb4shSFbcZQvvGkXMRqbLHb9dufV2HA4b+9riiYVMuqpTM3SLvOh5tHUaq5Nsrky+mCVPVswoFcYGd0JMO3QYwHwVP2wvn3LbjcIJPwUwTmmcm1LClKmXF40U= Received: from BN6PR17CA0053.namprd17.prod.outlook.com (2603:10b6:405:75::42) by BY5PR02MB6370.namprd02.prod.outlook.com (2603:10b6:a03:1b3::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.12; Sun, 23 Jan 2022 09:48:19 +0000 Received: from BN1NAM02FT049.eop-nam02.prod.protection.outlook.com (2603:10b6:405:75:cafe::e3) by BN6PR17CA0053.outlook.office365.com (2603:10b6:405:75::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.17 via Frontend Transport; Sun, 23 Jan 2022 09:48:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BN1NAM02FT049.mail.protection.outlook.com (10.13.2.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4909.8 via Frontend Transport; Sun, 23 Jan 2022 09:48:18 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Sun, 23 Jan 2022 01:47:57 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Sun, 23 Jan 2022 01:47:57 -0800 Envelope-to: git@xilinx.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robh+dt@kernel.org, devicetree@vger.kernel.org Received: from [10.140.6.15] (port=60078 helo=xhdharshah40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nBZTZ-0001bj-2M; Sun, 23 Jan 2022 01:47:57 -0800 From: Harsha To: , , , , , , , CC: , , , Harsha Subject: [PATCH 4/4] MAINTAINERS: Add maintainer for Xilinx ZynqMP SHA3 driver Date: Sun, 23 Jan 2022 15:17:07 +0530 Message-ID: <1642931227-20706-5-git-send-email-harsha.harsha@xilinx.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1642931227-20706-1-git-send-email-harsha.harsha@xilinx.com> References: <1642931227-20706-1-git-send-email-harsha.harsha@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 36784839-fdb9-4eb8-ac4d-08d9de557c67 X-MS-TrafficTypeDiagnostic: BY5PR02MB6370:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RQqWgy1yfltnZrVc53TTlbYycDyd7geYzm6keG3BzrtZpFqL2JmC3ML4KGOruoCbZ+3Ka83eND/LIKb3ma6v0jN3ulpHoj3Vtk2Xu1Ulko1z3WwJPyXxPzVmwEt03snS0BpkMiNCmtJ9BOsXoDiI9igv6a4jOGuaO77JbZwy87F73pZkq8CVAb9g64h65JyE54TMxqt3fMHY8F9ibFgCiD1fD5znjZrDX5Dk8xnk3hHF0E7zAmcB1luzz7zAc4jm1U99FhK3NxTP7n/VtS5bxtRubw7mO36RqfID/C9sQt/8if8IOtIyv5q9e8lIGeekMXE5F8CPc60SjgfhlD26oJOYyuQNt2kY3jspXPMWD7sSzZ7UV/zCmLcxf6KXCAkUB18Zhdp/fkYE6ZNcjBqoiHUJov/F6ZAaVI+NsCI20DZmrl1HUchYmDitb0KAumADX4ECqHmG/iT6SH3+10wAY5wr/S4neNvMXDtjatXFt1EU1k3YCC4ajGjw7Zd3bF9jbGxV8MFVYS8Z50XHon+fUnkqoUr/oktnqsuUtrAhFRP4mZ7mTAFtbUHJR+bnELKaOfpkqmB5zx2SdNXUKTYri7MGiS2lMsS3WveqKYPe2ILaeVLfswR9i6fQWxUsfbqWbMrVYoTIOBH+TOn7ElCzbHpV7BvL5+ppuL7p92gP7cclo3QpbpFtsvw5TOpwIE9wkW/CRyiZrHZ+J8MgZ5/pUQB924iEytyKZWggvHfMkcFkuYqsKKtqhIat473GrlTEQ1P8dgME1hWk+v4VEPOcHHwtTqLxK/2sP4Z5ZJuNjh9gvj/51tWfAiRBFZDC3lpC X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(7636003)(4744005)(356005)(966005)(2616005)(8676002)(426003)(8936002)(6666004)(186003)(316002)(336012)(36756003)(26005)(47076005)(9786002)(110136005)(54906003)(107886003)(7696005)(36860700001)(82310400004)(70206006)(5660300002)(2906002)(70586007)(4326008)(508600001)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2022 09:48:18.8985 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 36784839-fdb9-4eb8-ac4d-08d9de557c67 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT049.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6370 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This patch adds an entry for ZynqMP SHA3 driver in the list of Maintainers. Signed-off-by: Harsha --- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 4fb3a88..cf2da60 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20931,6 +20931,11 @@ T: git https://github.com/Xilinx/linux-xlnx.git F: Documentation/devicetree/bindings/phy/xlnx,zynqmp-psgtr.yaml F: drivers/phy/xilinx/phy-zynqmp.c +XILINX ZYNQMP SHA3 DRIVER +M: Harsha +S: Maintained +F: drivers/crypto/xilinx/zynqmp-sha.c + XILLYBUS DRIVER M: Eli Billauer L: linux-kernel@vger.kernel.org