From patchwork Sat Feb 18 05:38:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harsha Harsha X-Patchwork-Id: 654816 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 81635C6379F for ; Sat, 18 Feb 2023 05:38:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229664AbjBRFio (ORCPT ); Sat, 18 Feb 2023 00:38:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbjBRFim (ORCPT ); Sat, 18 Feb 2023 00:38:42 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2067.outbound.protection.outlook.com [40.107.244.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A5955CF1A; Fri, 17 Feb 2023 21:38:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IUhT2g9pcpG0fpHLeP/wT1vVG3NLY6bMnLmEVwB4v+Q3kQD9+TfE5n1aMqyHxBPGvs4aEcCs2FSHP4PX8mEcuzhdriZBrCM2pDAnASIzCAMLXlf+fBYi1nh4Cu6gi86O3w6lsnFr6CkG2GlFj+tcT3xq9jQLSUbHqym6M4FQhvdU9c75Z9EuCEYXtGS2fbHRLAUrd6wlozryK4hg5NaJ+Lttl7p5dI7XjZhIJyx9kC2XGHCeXoagAFYkB+pAWJ0/vd7mDoNcZXg7KUw6oaH7/MvwsIc+gL7BNIfN34ilVBfObtC8IHPXZ6EZ95t2/CA6ScRGBAfc9EYq/lS4+JwsiA== 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=em2WKHdphSWEBzT622szO6xsFNYNKys9bL7PGdNfLeo=; b=g9jkBEwEtJwWlo3JejZapbapYXh1d3lU2XikmfdWqsauLGRPUYJ4Sk7JM6BGjIqE0Ouhqo8nRjgN+izqj4HPaBxDtyaoC8+7dKXay3M7DFbWrF5SZmW6OXutfEm5jIMKkMcbFDt+dQvHYPRo8KfP23GLLZqqWh6INOEf2Ogjz8fX76d7fgV68UU8PuM5nXTd1w8iqQxPhLGagiPDxdhIgWKgJFdMtqxbLIFNniIqnfsrUNGwgaAXQzGtxtwXB04/uaz4gEiJVxDN2WKv5h/3/HoB5AondY3FBQ1S8uTeUhm/aLIpAazcuAMgZWRuXMmMyvP7vIg3MAZ0phTb/ayVpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=em2WKHdphSWEBzT622szO6xsFNYNKys9bL7PGdNfLeo=; b=LFUwxob4fkugwK/m9H8OkyEDWZMAk7Sy4PNGzf/wuUjUXNotkiqmFbIxxoZwwZAqhfC+7KmAYbed+cqG1HtV/VdP3IHZYxxmCERqUh7qjaMuFmXjBAt2PbCqjZDElzVUHFUHRohnmuJPylFoFKeNLKt2B9L9xCeUyn9lEz2bkFQ= Received: from BN9PR03CA0913.namprd03.prod.outlook.com (2603:10b6:408:107::18) by SA0PR12MB4493.namprd12.prod.outlook.com (2603:10b6:806:72::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Sat, 18 Feb 2023 05:38:38 +0000 Received: from BN8NAM11FT028.eop-nam11.prod.protection.outlook.com (2603:10b6:408:107:cafe::d1) by BN9PR03CA0913.outlook.office365.com (2603:10b6:408:107::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.15 via Frontend Transport; Sat, 18 Feb 2023 05:38:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT028.mail.protection.outlook.com (10.13.176.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6111.18 via Frontend Transport; Sat, 18 Feb 2023 05:38:37 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 17 Feb 2023 23:38:37 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 17 Feb 2023 21:38:36 -0800 Received: from xhdharshah40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Fri, 17 Feb 2023 23:38:34 -0600 From: Harsha Harsha To: , , , , , CC: , , Harsha Harsha , Dhaval Shah Subject: [PATCH 1/4] firmware: xilinx: Get the SoC family specific data for crypto operation Date: Sat, 18 Feb 2023 11:08:06 +0530 Message-ID: <20230218053809.1780-2-harsha.harsha@amd.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20230218053809.1780-1-harsha.harsha@amd.com> References: <20230218053809.1780-1-harsha.harsha@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT028:EE_|SA0PR12MB4493:EE_ X-MS-Office365-Filtering-Correlation-Id: c41f51ec-910a-441c-e931-08db11726261 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: USfUODFLBA6R69SowVZ855plhfkFPDSqTc8GJnhx2ZdoO7AWlzrahEJAP74i9viHrafBRbdzmmZbzTIBv56wSS9Fkbosh+MSaMV+LQJF/QbG+yDgPoewzpLRDT+EVjiUBaNnUNZoqQ1ZOsJ3+Ovk99zSUKdtA9Pd9mbd+O8yP/Hiyz0nSTIuSuSxWWHHCo/rrkSC5LiqJ5+h7saQGgwAnuktQokJXmyJd49priisLu+vHYpqO+dxH8mew2/VnpijHky/48woesbpK/hJ1P6rlZtkamZsJpUsLQkh7E7XN7tApGn1EaDXNXig0XMsAHYJwiFUp0I1BQ6fWKucQCt7n9wG6sUbVQrJnm0C0Eqezp2BdPOeZBKcjytB5Ew8T6FomWK/G+qbReEYmjIrKHmn2K1HMKBXi1Mtr2C/Z69Ic1+xq4mng+RBjxklhS6Niqs29YGaUS9fA62C82Mm3A0rLU4YsnvYGYLrh9Y1k6UPSyCuV7zkbJPvhMknS1SbQUkmSDMkvUhVvqgSPono+PmOSpsJs7IF3o/maTuCA23UiaKBmgsfti9b38t7VrwPCaNXLikqllbictsA/oup3sTMuiBLmfgmBniBOEH0DKDEGe/RitY83skdrnnpptYuCQXZDTcLNitohMttP2+PrM2K9MO8mmLCd2E9TUhK6izg70Hyc0nMPDic+98Q10uzOZFFmKRDoz+PT1W1U9fkznI3wqZ47sfdbMzmRAOqquY0a+SjpY6YUKHhXuVyIXpZQ6H8PLS5P4S+EbueE1RuTT1NvWlo6YYYc7mKifSTxMWcmDuMxZtPlVRR4LXqFmxWdOvO X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230025)(4636009)(136003)(396003)(346002)(39860400002)(376002)(451199018)(40470700004)(46966006)(36840700001)(82740400003)(36860700001)(356005)(86362001)(81166007)(36756003)(44832011)(5660300002)(2906002)(4326008)(8676002)(40480700001)(70586007)(70206006)(8936002)(1076003)(82310400005)(6666004)(2616005)(26005)(40460700003)(426003)(83380400001)(41300700001)(186003)(336012)(47076005)(110136005)(54906003)(316002)(478600001)(15583001)(2101003)(36900700001)(358055004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2023 05:38:37.7116 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c41f51ec-910a-441c-e931-08db11726261 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT028.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4493 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Get family type and sub-family type of SoC and on basis of that, return the data specific to the SoC which can be used for the required crypto operations. Signed-off-by: Harsha Harsha Co-developed-by: Dhaval Shah Signed-off-by: Dhaval Shah --- drivers/firmware/xilinx/zynqmp.c | 79 ++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 34 ++++++++++++ 2 files changed, 113 insertions(+) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 129f68d7a6f5..10ae42a2ae22 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -339,6 +339,8 @@ int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1, static u32 pm_api_version; static u32 pm_tz_version; +static u32 pm_family_code; +static u32 pm_sub_family_code; int zynqmp_pm_register_sgi(u32 sgi_num, u32 reset) { @@ -404,6 +406,78 @@ int zynqmp_pm_get_chipid(u32 *idcode, u32 *version) } EXPORT_SYMBOL_GPL(zynqmp_pm_get_chipid); +/** + * zynqmp_pm_get_family_info() - Get family info of platform + * @family: Returned family code value + * @subfamily: Returned sub-family code value + * + * Return: Returns status, either success or error+reason + */ +static int zynqmp_pm_get_family_info(u32 *family, u32 *subfamily) +{ + u32 ret_payload[PAYLOAD_ARG_CNT]; + u32 idcode; + int ret; + + /* Check is family or sub-family code already received */ + if (pm_family_code && pm_sub_family_code) { + *family = pm_family_code; + *subfamily = pm_sub_family_code; + return 0; + } + + ret = zynqmp_pm_invoke_fn(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload); + if (ret < 0) + return ret; + + idcode = ret_payload[1]; + pm_family_code = FIELD_GET(GENMASK(FAMILY_CODE_MSB, FAMILY_CODE_LSB), + idcode); + pm_sub_family_code = FIELD_GET(GENMASK(SUB_FAMILY_CODE_MSB, + SUB_FAMILY_CODE_LSB), idcode); + *family = pm_family_code; + *subfamily = pm_sub_family_code; + + return 0; +} + +/** + * xlnx_get_crypto_dev_data() - Get crypto dev data of platform + * @feature_map: List of available feature map of all platform + * + * Return: Returns crypto dev data, either address crypto dev or ERR PTR + */ +void *xlnx_get_crypto_dev_data(struct xlnx_feature *feature_map) +{ + struct xlnx_feature *feature; + u32 v, api_id; + int ret; + + ret = zynqmp_pm_get_api_version(&v); + if (ret) + return ERR_PTR(ret); + + feature = feature_map; + for (; feature->family; feature++) { + if (feature->family == pm_family_code && + (feature->subfamily == ALL_SUB_FAMILY_CODE || + feature->subfamily == pm_sub_family_code)) { + api_id = FIELD_GET(API_ID_MASK, feature->feature_id); + if (feature->family == ZYNQMP_FAMILY_CODE) { + ret = zynqmp_pm_feature(api_id); + if (ret < 0) + return ERR_PTR(ret); + } else { + return ERR_PTR(-ENODEV); + } + + return feature->data; + } + } + return ERR_PTR(-ENODEV); +} +EXPORT_SYMBOL_GPL(xlnx_get_crypto_dev_data); + /** * zynqmp_pm_get_trustzone_version() - Get secure trustzone firmware version * @version: Returned version value @@ -1855,6 +1929,11 @@ static int zynqmp_firmware_probe(struct platform_device *pdev) pr_info("%s Platform Management API v%d.%d\n", __func__, pm_api_version >> 16, pm_api_version & 0xFFFF); + /* Get the Family code and sub family code of platform */ + ret = zynqmp_pm_get_family_info(&pm_family_code, &pm_sub_family_code); + if (ret < 0) + return ret; + /* Check trustzone version number */ ret = zynqmp_pm_get_trustzone_version(&pm_tz_version); if (ret) diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index b986e267d149..cd5acfa29cbc 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -34,6 +34,20 @@ /* PM API versions */ #define PM_API_VERSION_2 2 +#define ZYNQMP_FAMILY_CODE 0x23 + +/* When all subfamily of platform need to support */ +#define ALL_SUB_FAMILY_CODE 0 +#define VERSAL_SUB_FAMILY_CODE 1 +#define VERSALNET_SUB_FAMILY_CODE 3 + +#define FAMILY_CODE_LSB 21 +#define FAMILY_CODE_MSB 27 +#define SUB_FAMILY_CODE_LSB 19 +#define SUB_FAMILY_CODE_MSB 20 + +#define API_ID_MASK GENMASK(7, 0) + /* ATF only commands */ #define TF_A_PM_REGISTER_SGI 0xa04 #define PM_GET_TRUSTZONE_VERSION 0xa03 @@ -475,12 +489,27 @@ struct zynqmp_pm_query_data { u32 arg3; }; +/** + * struct xlnx_feature - Feature data + * @family: Family code of platform + * @subfamily: Subfamily code of platform + * @feature_id: Feature id of module + * @data: Collection of all supported platform data + */ +struct xlnx_feature { + u32 family; + u32 subfamily; + u32 feature_id; + void *data; +}; + int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 *ret_payload); #if IS_REACHABLE(CONFIG_ZYNQMP_FIRMWARE) int zynqmp_pm_get_api_version(u32 *version); int zynqmp_pm_get_chipid(u32 *idcode, u32 *version); +void *xlnx_get_crypto_dev_data(struct xlnx_feature *feature_map); int zynqmp_pm_query_data(struct zynqmp_pm_query_data qdata, u32 *out); int zynqmp_pm_clock_enable(u32 clock_id); int zynqmp_pm_clock_disable(u32 clock_id); @@ -561,6 +590,11 @@ static inline int zynqmp_pm_get_chipid(u32 *idcode, u32 *version) return -ENODEV; } +static inline void *xlnx_get_crypto_dev_data(struct xlnx_feature *feature_map) +{ + return ERR_PTR(-ENODEV); +} + static inline int zynqmp_pm_query_data(struct zynqmp_pm_query_data qdata, u32 *out) { From patchwork Sat Feb 18 05:38:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harsha Harsha X-Patchwork-Id: 654930 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 5A15BC61DA4 for ; Sat, 18 Feb 2023 05:38:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229755AbjBRFiy (ORCPT ); Sat, 18 Feb 2023 00:38:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229694AbjBRFiq (ORCPT ); Sat, 18 Feb 2023 00:38:46 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2059.outbound.protection.outlook.com [40.107.223.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BB41474F4; Fri, 17 Feb 2023 21:38:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h5FsU2+Q7/LyEDfcTYEHEd1goBN6IscJYacMaykB9eHzMRDK6+0GJZNWRgyB/ntRnrs3/EdX7WgwJw8ruzZdEqL4CNQRQLKzfWG/0kfkuNKHd6Zd3+cXHVeQgRWtDVNRCL+1Eq86IMEUtFXpCdsGFGX/HbXXrKXMBhuMtsSE6ksrHpS1BSiocmj2OfpaZTN8qWewFbYv+tPXZOtZne0nwgxrqJZJWq1mNItrDXefoaYER8G0ei8ydtrXh0UoFkbIVh6OjWZSZJxKpnZmlzLyOcY+ebqH1+CqvLkD2kGlDmE0XQyfcVFi0oF1GWJGXRfQNOw5vJ4NeQUGWqV5WPsg8g== 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=8loD21eoObdxkdy1USh64SVrdam9+M2IedaBGHLJ0kI=; b=hdYAxrPAZaeVBNPLeWVMrzWlN/aFpoEA9wyBFe+b5Gx09hpAUuCvfoMB5vUCU0N5kvm0wU6ufj7mUsKRRYlasamsIPcnIM3U7DUMGmj62EgnGz6HGvPfScAjocAx1amKxFDWfKhg0SeYo4ZSmj13aFjR0jP1NVGFLSIkiHbX1+Rvcurh3dlV6u5gzLT28NRBo78dDPAHO799meFaG+DFVuycVjObIS6Hhndxz2wUT1exiSyBEHCrL1VmVZ5YAyHkH8DMFxmzagUNwkbogk6Xav1ArS+aN/B9urfaXaSfKMd1H9eKO8vLQVjwp6/xt3G2aYjTLwED4KADC8RJVuvM1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8loD21eoObdxkdy1USh64SVrdam9+M2IedaBGHLJ0kI=; b=JRDbIiyHOWfIQV9Opsyj72ow52ACr9nRee9v8n80XVrvJVNxmrhpc/JYovyT3CkMQH2hMbpbq0NXZ7Obr3lzkK4E3/ByWoBjU3R2mKC4v/8A6ObjJHIq5MLbvwBDdnwuHzlvTAqTguLCFC8P2tGdJqWAFzmU2fZkCAjQou2DdOU= Received: from BL0PR0102CA0046.prod.exchangelabs.com (2603:10b6:208:25::23) by LV2PR12MB5847.namprd12.prod.outlook.com (2603:10b6:408:174::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Sat, 18 Feb 2023 05:38:42 +0000 Received: from BL02EPF00010206.namprd05.prod.outlook.com (2603:10b6:208:25:cafe::18) by BL0PR0102CA0046.outlook.office365.com (2603:10b6:208:25::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17 via Frontend Transport; Sat, 18 Feb 2023 05:38:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BL02EPF00010206.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6134.14 via Frontend Transport; Sat, 18 Feb 2023 05:38:40 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 17 Feb 2023 23:38:40 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 17 Feb 2023 21:38:39 -0800 Received: from xhdharshah40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Fri, 17 Feb 2023 23:38:37 -0600 From: Harsha Harsha To: , , , , , CC: , , Harsha Harsha , Dhaval Shah Subject: [PATCH 2/4] firmware: xilinx: Add ZynqMP RSA API for RSA encrypt/decrypt operation Date: Sat, 18 Feb 2023 11:08:07 +0530 Message-ID: <20230218053809.1780-3-harsha.harsha@amd.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20230218053809.1780-1-harsha.harsha@amd.com> References: <20230218053809.1780-1-harsha.harsha@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010206:EE_|LV2PR12MB5847:EE_ X-MS-Office365-Filtering-Correlation-Id: b555a1b0-6e24-4009-e415-08db11726446 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nfaPsC2Q9R8l1I3gMnHcauFc8bdWoUbhWHNNPqKAVuaQaEbG85SdAI4m7iV7Y7HEx1fyOVvV+2XdRIrEme/Bo36NGeRaVQz6nWrYh7F0pgwT3JE0oSJNN2kWekhxxZBaOfijfcuYSLVukzULMduF6UMUh3FM8Fm5R97LaH7OmvZUhtf15OUeTy27ZFDRUSeMmFTZAevNUT1VAM0cPryzvo0HusXtk8X2AXh5C6YUv0HpAk3XcaXzSLLbU9ofqf57r+CnbvBSCGO2fBV9eioH5/4Kv251CwIZ6aHe50X1kZ9WE08NqTACFmomRryq91P/ZHXDrOcuQrV0cNt04Wv6MNSLO54a4+6A9qJBVL2U1Qlefgn+ILBbCPEmFogJqEGsq24zB//uG3QoMtaG0DmNA4jYpf1F5o45/9cM4Mc6Gmhe/xJFIS1pLN/Pax8W1wFLiGA7bhaeHHtIxzVx+4MVHkHxusudYemDyI0TRVD2kLX1wBDRWkCu4Ec7+IpgECNSAsN5AqvGy9KdV1W3BBLFzelSzwzV+v2MWIggO2xdzp+DC9utPeHz8Ju+jbEJ7ZpiPv7/JrGQeHhvfLKKOPM9V+UNnm95chDRSRNUjJsdH2SneFxLeS1pMvambuqBIQs8FywjS0VOVaWPzMa4nmBxun/H4dh+uyjnh1YXs971R0LUzfp9249Bx5tmNQCHxHoAo1h2em4TV6Fobbt/l1ERz56qnM97J8aIiEza+7CA0/nDydWuL3LdHJY2qmuc5+xF X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230025)(4636009)(396003)(376002)(39860400002)(346002)(136003)(451199018)(40470700004)(46966006)(36840700001)(2616005)(86362001)(336012)(82310400005)(6666004)(44832011)(2906002)(478600001)(426003)(186003)(1076003)(41300700001)(83380400001)(4326008)(26005)(47076005)(356005)(40480700001)(40460700003)(36860700001)(70586007)(8936002)(5660300002)(8676002)(54906003)(110136005)(82740400003)(36756003)(70206006)(316002)(81166007)(2101003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2023 05:38:40.8900 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b555a1b0-6e24-4009-e415-08db11726446 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010206.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5847 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Add zynqmp_pm_rsa API in the ZynqMP firmware to encrypt and decrypt the datai using RSA hardware engine for ZynqMP. Signed-off-by: Harsha Harsha Co-developed-by: Dhaval Shah Signed-off-by: Dhaval Shah --- drivers/firmware/xilinx/zynqmp.c | 21 +++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 8 ++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 10ae42a2ae22..d6f73823bab4 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -1426,6 +1426,27 @@ int zynqmp_pm_sha_hash(const u64 address, const u32 size, const u32 flags) } EXPORT_SYMBOL_GPL(zynqmp_pm_sha_hash); +/** + * zynqmp_pm_rsa - Access RSA hardware to encrypt/decrypt the data with RSA. + * @address: Address of the data + * @size: Size of the data. + * @flags: + * BIT(0) - Encryption/Decryption + * 0 - RSA decryption with private key + * 1 - RSA encryption with public key. + * + * Return: Returns status, either success or error code. + */ +int zynqmp_pm_rsa(const u64 address, const u32 size, const u32 flags) +{ + u32 lower_32_bits = lower_32_bits(address); + u32 upper_32_bits = upper_32_bits(address); + + return zynqmp_pm_invoke_fn(PM_SECURE_RSA, upper_32_bits, lower_32_bits, + size, flags, NULL); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_rsa); + /** * zynqmp_pm_register_notifier() - PM API for register a subsystem * to be notified about specific diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index cd5acfa29cbc..8666b0c3cd66 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -117,6 +117,7 @@ enum pm_api_id { PM_FPGA_GET_STATUS = 23, PM_GET_CHIPID = 24, PM_SECURE_SHA = 26, + PM_SECURE_RSA = 27, PM_PINCTRL_REQUEST = 28, PM_PINCTRL_RELEASE = 29, PM_PINCTRL_GET_FUNCTION = 30, @@ -542,6 +543,7 @@ int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities, 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_rsa(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); @@ -744,6 +746,12 @@ static inline int zynqmp_pm_sha_hash(const u64 address, const u32 size, return -ENODEV; } +static inline int zynqmp_pm_rsa(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 Sat Feb 18 05:38:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harsha Harsha X-Patchwork-Id: 654815 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 F015BC61DA4 for ; Sat, 18 Feb 2023 05:39:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229715AbjBRFjN (ORCPT ); Sat, 18 Feb 2023 00:39:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229771AbjBRFjF (ORCPT ); Sat, 18 Feb 2023 00:39:05 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2082.outbound.protection.outlook.com [40.107.100.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AB016186C; Fri, 17 Feb 2023 21:38:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fTmwnP9GPytewv4uy0q/pLyqKDhX6Pc6UTjBiwMeWrnRTfrcy7hBAVY1Ms0yCNo8TegOaSCko8Apk+55JWTnjPVkJpxcvSAX4bjeT4OCKq8bRy/BvuV4fa/0sqZ0kkL84gHyGHuRVZrKJxdFKT4BAb7/u2OoIJUgJMdCqhz4VcJY8UVAz0+F344RuwUQOtsd8TpLaliSaA/wxuXvf4GZftLy9LGepXSfn+j3hI5HVJ1IQVjGuB4UVYXhC4T8UB1RW2ZCnjcUJfzcl4MzRPLSn61ghl57IVIS3OMvRdEDZFXjERA2S5jtRuLHjUl9nM4/bxFpJX27fyfNkSgKzrxOFw== 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=34M+MqEVnwtgnx+FsZw3ShwkroQnD+0fMUTtwz2eDiA=; b=FdfkRV5GpP+ScL3laiOolFd8swBG/kpvH8Al97kvnfn5nBixBN2xuBSXqHVVVI75eixQhfX8OKZRDZtOdll6f0SAPQa2ZjPPyYG9cFyOuJ5reTdUmvjcH8mixJ5gxLYEgFUmkvATmkevpuU2cX/Xb2lpQqU4LmbChV81rtSHsLWb/zeNRez/FTfYwlz3r8muRNMdRLa1EcnlSqzYFd+FrKJWjSKa5byXnCRvIWE79R4NMsRWaHsr7WOa681aJWU4aCZQ47HTij9+l+gNHWhcY9elmc/X0BJO6Np7MIPsYhv+tn5xmVyRLrZrFpylxeHG444NGu0gK/zCzGXopZ0dcA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=34M+MqEVnwtgnx+FsZw3ShwkroQnD+0fMUTtwz2eDiA=; b=RaatzI1OMaDBUG3BXW0buVflbphriNGQ7zpZtNcPhOAztOZnlkKj9sm74dmBTxnFtD46OO/gBWOXgQwNl4bl0Y0K5RtPaJkKH2rT5vlFf+Dnr0c4IcmMZNzvtimamujfK93LLFGVXGXr0RasNfH2ywdzz+VeqVsOgyhNiY9k0HU= Received: from BN9P223CA0028.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::33) by IA1PR12MB6138.namprd12.prod.outlook.com (2603:10b6:208:3ea::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.18; Sat, 18 Feb 2023 05:38:46 +0000 Received: from BN8NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10b:cafe::42) by BN9P223CA0028.outlook.office365.com (2603:10b6:408:10b::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.15 via Frontend Transport; Sat, 18 Feb 2023 05:38:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT079.mail.protection.outlook.com (10.13.177.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6111.18 via Frontend Transport; Sat, 18 Feb 2023 05:38:44 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 17 Feb 2023 23:38:43 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 17 Feb 2023 21:38:43 -0800 Received: from xhdharshah40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Fri, 17 Feb 2023 23:38:40 -0600 From: Harsha Harsha To: , , , , , CC: , , Harsha Harsha , Dhaval Shah Subject: [PATCH 3/4] crypto: xilinx: Add ZynqMP RSA driver Date: Sat, 18 Feb 2023 11:08:08 +0530 Message-ID: <20230218053809.1780-4-harsha.harsha@amd.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20230218053809.1780-1-harsha.harsha@amd.com> References: <20230218053809.1780-1-harsha.harsha@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT079:EE_|IA1PR12MB6138:EE_ X-MS-Office365-Filtering-Correlation-Id: 84fcbf8f-a52b-4e48-48ba-08db117266b6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sw+1xYFMj3GyEjfvkQ/chwq1GCyVYZd803O5aFDpDx9uso9JvT07UzjqVtKmIE//wQBNZe7xiXSB6+iT/Hjf43cE5lVgMKhxrFwc0UD22OjlAZttLJgMLNj2ReXxsenAAgrLy3swZlJoDgRKHB3PikFZNUO+x1sA4lfWbAC4aL8iPK8/IA4LBeidAgAtBj4icU/VT/1ohyHGTgGyQjfX0R9MeXIeEbZiWPVS+bZSVdkpTrMwQhTO7pB5po7SfNB9b7CTBUmcBDf31Jyaz2w+jzCc4tzf4wk603YjJ5l+OA58S/pzOI84cdt1YrcoizdfPgfVvVgT0vid7EbS+OEtJtjQBq5a4ZsFo8S0JaqnnLDeW9N8bnER65AwiA4OPMtlJGe666zkoEEuvRxwBqPldTPpmSsFqBsxxOEg9GBHVOtpXpJO+zbv/pzBInZfyqhppODaygseDm86JRx/PXCsqaxObOkMuxIooWjcXuArrErcdq/MwoVK4lU4p3eSprX8CQ3EHTsJKllUMQUOcisFu1VSlbCrUkKwH4eUl7K9AgTIaYyJcxYibH8GMp0ax8/8vuAUB6SfFVSq6t3xJC54Mkh+hQxjOzx/PdpxKb1ccm5Emg4v3YysN/yNw9TpLIaDfUvcMVEbc68JxFgWAX/9EGD2dG7SBvknOs1CXLTeTv3SF6XtSgXgjrKm7xXQEKEcPl+zEUeezTeONi9RGhAke4HFoR/QejuEbF5WyZQGdDENQIvhG23f2i7yPAsABWM2 X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230025)(4636009)(136003)(346002)(376002)(39860400002)(396003)(451199018)(36840700001)(40470700004)(46966006)(40460700003)(4326008)(8676002)(82310400005)(70206006)(70586007)(81166007)(110136005)(316002)(54906003)(356005)(2906002)(82740400003)(36756003)(44832011)(30864003)(5660300002)(8936002)(41300700001)(40480700001)(36860700001)(6666004)(1076003)(186003)(26005)(83380400001)(86362001)(426003)(336012)(47076005)(2616005)(478600001)(36900700001)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2023 05:38:44.9754 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84fcbf8f-a52b-4e48-48ba-08db117266b6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6138 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Adds RSA driver support for the ZynqMP SoC. ZynqMP SoC has RSA engine used for encryption and decryption. The flow is RSA encrypt/decrypt request from Userspace -> ZynqMP RSA driver -> Firmware driver -> RSA Hardware Engine RSA Hardware engine supports 2048, 3072 and 4096 keysizes are supported. So RSA operations using these key sizes are done by hardware engine. Software fallback is being used for other key sizes. Signed-off-by: Harsha Harsha Co-developed-by: Dhaval Shah Signed-off-by: Dhaval Shah --- drivers/crypto/Kconfig | 10 + drivers/crypto/xilinx/Makefile | 1 + drivers/crypto/xilinx/xilinx-rsa.c | 489 +++++++++++++++++++++++++++++ 3 files changed, 500 insertions(+) create mode 100644 drivers/crypto/xilinx/xilinx-rsa.c diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index dfb103f81a64..1ff19bfe8a13 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -695,6 +695,16 @@ config CRYPTO_DEV_ROCKCHIP_DEBUG This will create /sys/kernel/debug/rk3288_crypto/stats for displaying the number of requests per algorithm and other internal stats. +config CRYPTO_DEV_XILINX_RSA + tristate "Support for Xilinx ZynqMP RSA hardware accelerator" + depends on ARCH_ZYNQMP || COMPILE_TEST + select CRYPTO_ENGINE + select CRYPTO_AKCIPHER + help + Xilinx processors have RSA hardware accelerator used for signature + generation and verification. This driver interfaces with RSA + hardware accelerator. Select this if you want to use the ZynqMP + module for RSA algorithms. config CRYPTO_DEV_ZYNQMP_AES tristate "Support for Xilinx ZynqMP AES hw accelerator" diff --git a/drivers/crypto/xilinx/Makefile b/drivers/crypto/xilinx/Makefile index 730feff5b5f2..819d82486a5d 100644 --- a/drivers/crypto/xilinx/Makefile +++ b/drivers/crypto/xilinx/Makefile @@ -1,3 +1,4 @@ # 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 +obj-$(CONFIG_CRYPTO_DEV_XILINX_RSA) += xilinx-rsa.o diff --git a/drivers/crypto/xilinx/xilinx-rsa.c b/drivers/crypto/xilinx/xilinx-rsa.c new file mode 100644 index 000000000000..148a2a59ab89 --- /dev/null +++ b/drivers/crypto/xilinx/xilinx-rsa.c @@ -0,0 +1,489 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2022 - 2023, Advanced Micro Devices, Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define XILINX_DMA_BIT_MASK 32U +#define XILINX_RSA_MAX_KEY_SIZE 1024 +#define XILINX_RSA_BLOCKSIZE 64 + +/* Key size in bytes */ +#define XSECURE_RSA_2048_KEY_SIZE (2048U / 8U) +#define XSECURE_RSA_3072_KEY_SIZE (3072U / 8U) +#define XSECURE_RSA_4096_KEY_SIZE (4096U / 8U) + +enum xilinx_akcipher_op { + XILINX_RSA_DECRYPT = 0, + XILINX_RSA_ENCRYPT, + XILINX_RSA_SIGN, + XILINX_RSA_VERIFY +}; + +struct xilinx_rsa_drv_ctx { + struct akcipher_alg alg; + struct device *dev; + struct crypto_engine *engine; + int (*xilinx_rsa_xcrypt)(struct akcipher_request *req); +}; + +/* + * 1st variable must be of struct crypto_engine_ctx type + */ +struct xilinx_rsa_tfm_ctx { + struct crypto_engine_ctx engine_ctx; + struct device *dev; + struct crypto_akcipher *fbk_cipher; + u8 *e_buf; + u8 *n_buf; + u8 *d_buf; + unsigned int key_len; /* in bits */ + unsigned int e_len; + unsigned int n_len; + unsigned int d_len; +}; + +struct xilinx_rsa_req_ctx { + enum xilinx_akcipher_op op; +}; + +static int zynqmp_rsa_xcrypt(struct akcipher_request *req) +{ + struct xilinx_rsa_req_ctx *rq_ctx = akcipher_request_ctx(req); + unsigned int len, offset, diff = req->dst_len - req->src_len; + struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req); + struct xilinx_rsa_tfm_ctx *tctx = akcipher_tfm_ctx(tfm); + dma_addr_t dma_addr; + char *kbuf, *buf; + size_t dma_size; + u8 padding = 0; + int ret; + + if (rq_ctx->op == XILINX_RSA_ENCRYPT) { + padding = tctx->e_len % 2; + buf = tctx->e_buf; + len = tctx->e_len; + } else { + buf = tctx->d_buf; + len = tctx->d_len; + } + + dma_size = req->dst_len + tctx->n_len + len + padding; + offset = dma_size - len; + + kbuf = dma_alloc_coherent(tctx->dev, dma_size, &dma_addr, GFP_KERNEL); + if (!kbuf) + return -ENOMEM; + + scatterwalk_map_and_copy(kbuf + diff, req->src, 0, req->src_len, 0); + memcpy(kbuf + req->dst_len, tctx->n_buf, tctx->n_len); + + memcpy(kbuf + offset, buf, len); + + ret = zynqmp_pm_rsa(dma_addr, tctx->n_len, rq_ctx->op); + if (ret < 0) + goto out; + + sg_copy_from_buffer(req->dst, sg_nents(req->dst), kbuf, req->dst_len); + +out: + dma_free_coherent(tctx->dev, dma_size, kbuf, dma_addr); + + return ret; +} + +static int xilinx_rsa_decrypt(struct akcipher_request *req) +{ + struct xilinx_rsa_req_ctx *rctx = akcipher_request_ctx(req); + struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req); + struct akcipher_alg *alg = crypto_akcipher_alg(tfm); + struct xilinx_rsa_drv_ctx *drv_ctx; + + rctx->op = XILINX_RSA_DECRYPT; + drv_ctx = container_of(alg, struct xilinx_rsa_drv_ctx, alg); + + return crypto_transfer_akcipher_request_to_engine(drv_ctx->engine, req); +} + +static int xilinx_rsa_encrypt(struct akcipher_request *req) +{ + struct xilinx_rsa_req_ctx *rctx = akcipher_request_ctx(req); + struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req); + struct akcipher_alg *alg = crypto_akcipher_alg(tfm); + struct xilinx_rsa_drv_ctx *drv_ctx; + + rctx->op = XILINX_RSA_ENCRYPT; + drv_ctx = container_of(alg, struct xilinx_rsa_drv_ctx, alg); + + return crypto_transfer_akcipher_request_to_engine(drv_ctx->engine, req); +} + +static unsigned int xilinx_rsa_max_size(struct crypto_akcipher *tfm) +{ + struct xilinx_rsa_tfm_ctx *tctx = akcipher_tfm_ctx(tfm); + + return tctx->n_len; +} + +static inline int xilinx_copy_and_save_keypart(u8 **kpbuf, unsigned int *kplen, + const u8 *buf, size_t sz) +{ + int nskip; + + for (nskip = 0; nskip < sz; nskip++) + if (buf[nskip]) + break; + + *kplen = sz - nskip; + *kpbuf = kmemdup(buf + nskip, *kplen, GFP_KERNEL); + if (!*kpbuf) + return -ENOMEM; + + return 0; +} + +static int xilinx_check_key_length(unsigned int len) +{ + if (len < 8 || len > 4096) + return -EINVAL; + return 0; +} + +static void xilinx_rsa_free_key_bufs(struct xilinx_rsa_tfm_ctx *ctx) +{ + /* Clean up old key data */ + kfree_sensitive(ctx->e_buf); + ctx->e_buf = NULL; + ctx->e_len = 0; + kfree_sensitive(ctx->n_buf); + ctx->n_buf = NULL; + ctx->n_len = 0; + kfree_sensitive(ctx->d_buf); + ctx->d_buf = NULL; + ctx->d_len = 0; +} + +static int xilinx_rsa_setkey(struct crypto_akcipher *tfm, const void *key, + unsigned int keylen, bool private) +{ + struct xilinx_rsa_tfm_ctx *tctx = akcipher_tfm_ctx(tfm); + struct rsa_key raw_key; + int ret; + + if (private) + ret = rsa_parse_priv_key(&raw_key, key, keylen); + else + ret = rsa_parse_pub_key(&raw_key, key, keylen); + if (ret) + goto n_key; + + ret = xilinx_copy_and_save_keypart(&tctx->n_buf, &tctx->n_len, + raw_key.n, raw_key.n_sz); + if (ret) + goto key_err; + + /* convert to bits */ + tctx->key_len = tctx->n_len << 3; + if (xilinx_check_key_length(tctx->key_len)) { + ret = -EINVAL; + goto key_err; + } + + ret = xilinx_copy_and_save_keypart(&tctx->e_buf, &tctx->e_len, + raw_key.e, raw_key.e_sz); + if (ret) + goto key_err; + + if (private) { + ret = xilinx_copy_and_save_keypart(&tctx->d_buf, &tctx->d_len, + raw_key.d, raw_key.d_sz); + if (ret) + goto key_err; + } + + return 0; + +key_err: + xilinx_rsa_free_key_bufs(tctx); +n_key: + return ret; +} + +static int xilinx_rsa_set_priv_key(struct crypto_akcipher *tfm, const void *key, + unsigned int keylen) +{ + struct xilinx_rsa_tfm_ctx *tfm_ctx = akcipher_tfm_ctx(tfm); + int ret; + + tfm_ctx->fbk_cipher->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; + tfm_ctx->fbk_cipher->base.crt_flags |= (tfm->base.crt_flags & + CRYPTO_TFM_REQ_MASK); + + ret = crypto_akcipher_set_priv_key(tfm_ctx->fbk_cipher, key, keylen); + if (ret) + return ret; + + return xilinx_rsa_setkey(tfm, key, keylen, true); +} + +static int xilinx_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key, + unsigned int keylen) +{ + struct xilinx_rsa_tfm_ctx *tfm_ctx = akcipher_tfm_ctx(tfm); + int ret; + + tfm_ctx->fbk_cipher->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; + tfm_ctx->fbk_cipher->base.crt_flags |= (tfm->base.crt_flags & + CRYPTO_TFM_REQ_MASK); + + ret = crypto_akcipher_set_pub_key(tfm_ctx->fbk_cipher, key, keylen); + if (ret) + return ret; + + return xilinx_rsa_setkey(tfm, key, keylen, false); +} + +static int xilinx_fallback_check(struct xilinx_rsa_tfm_ctx *tfm_ctx, + struct akcipher_request *areq) +{ + int need_fallback = 0; + + if (tfm_ctx->n_len != XSECURE_RSA_2048_KEY_SIZE && + tfm_ctx->n_len != XSECURE_RSA_3072_KEY_SIZE && + tfm_ctx->n_len != XSECURE_RSA_4096_KEY_SIZE) + need_fallback = 1; + + if (areq->src_len > areq->dst_len) + need_fallback = 1; + + return need_fallback; +} + +static int handle_rsa_req(struct crypto_engine *engine, + void *req) +{ + struct akcipher_request *areq = container_of(req, + struct akcipher_request, + base); + struct crypto_akcipher *akcipher = crypto_akcipher_reqtfm(req); + struct akcipher_alg *cipher_alg = crypto_akcipher_alg(akcipher); + struct xilinx_rsa_tfm_ctx *tfm_ctx = akcipher_tfm_ctx(akcipher); + struct xilinx_rsa_req_ctx *rq_ctx = akcipher_request_ctx(areq); + struct akcipher_request *subreq = akcipher_request_ctx(req); + struct xilinx_rsa_drv_ctx *drv_ctx; + int need_fallback, err; + + drv_ctx = container_of(cipher_alg, struct xilinx_rsa_drv_ctx, alg); + + need_fallback = xilinx_fallback_check(tfm_ctx, areq); + if (need_fallback) { + akcipher_request_set_tfm(subreq, tfm_ctx->fbk_cipher); + + akcipher_request_set_callback(subreq, areq->base.flags, + NULL, NULL); + akcipher_request_set_crypt(subreq, areq->src, areq->dst, + areq->src_len, areq->dst_len); + + if (rq_ctx->op == XILINX_RSA_ENCRYPT) + err = crypto_akcipher_encrypt(subreq); + else if (rq_ctx->op == XILINX_RSA_DECRYPT) + err = crypto_akcipher_decrypt(subreq); + } else { + err = drv_ctx->xilinx_rsa_xcrypt(areq); + } + + crypto_finalize_akcipher_request(engine, areq, err); + + return 0; +} + +static int xilinx_rsa_init(struct crypto_akcipher *tfm) +{ + struct xilinx_rsa_tfm_ctx *tfm_ctx = + (struct xilinx_rsa_tfm_ctx *)akcipher_tfm_ctx(tfm); + struct akcipher_alg *cipher_alg = crypto_akcipher_alg(tfm); + struct xilinx_rsa_drv_ctx *drv_ctx; + + drv_ctx = container_of(cipher_alg, struct xilinx_rsa_drv_ctx, alg); + tfm_ctx->dev = drv_ctx->dev; + + tfm_ctx->engine_ctx.op.do_one_request = handle_rsa_req; + tfm_ctx->engine_ctx.op.prepare_request = NULL; + tfm_ctx->engine_ctx.op.unprepare_request = NULL; + tfm_ctx->fbk_cipher = crypto_alloc_akcipher(drv_ctx->alg.base.cra_name, + 0, + CRYPTO_ALG_NEED_FALLBACK); + if (IS_ERR(tfm_ctx->fbk_cipher)) { + pr_err("%s() Error: failed to allocate fallback for %s\n", + __func__, drv_ctx->alg.base.cra_name); + return PTR_ERR(tfm_ctx->fbk_cipher); + } + + akcipher_set_reqsize(tfm, sizeof(struct xilinx_rsa_req_ctx)); + + return 0; +} + +static void xilinx_rsa_exit(struct crypto_akcipher *tfm) +{ + struct xilinx_rsa_tfm_ctx *tfm_ctx = + (struct xilinx_rsa_tfm_ctx *)akcipher_tfm_ctx(tfm); + + xilinx_rsa_free_key_bufs(tfm_ctx); + + if (tfm_ctx->fbk_cipher) { + crypto_free_akcipher(tfm_ctx->fbk_cipher); + tfm_ctx->fbk_cipher = NULL; + } + memzero_explicit(tfm_ctx, sizeof(struct xilinx_rsa_tfm_ctx)); +} + +struct xilinx_rsa_drv_ctx zynqmp_rsa_drv_ctx = { + .xilinx_rsa_xcrypt = zynqmp_rsa_xcrypt, + .alg = { + .init = xilinx_rsa_init, + .set_pub_key = xilinx_rsa_set_pub_key, + .set_priv_key = xilinx_rsa_set_priv_key, + .max_size = xilinx_rsa_max_size, + .decrypt = xilinx_rsa_decrypt, + .encrypt = xilinx_rsa_encrypt, + .sign = xilinx_rsa_decrypt, + .verify = xilinx_rsa_encrypt, + .exit = xilinx_rsa_exit, + .base = { + .cra_name = "rsa", + .cra_driver_name = "zynqmp-rsa", + .cra_priority = 200, + .cra_flags = CRYPTO_ALG_TYPE_AKCIPHER | + CRYPTO_ALG_KERN_DRIVER_ONLY | + CRYPTO_ALG_ALLOCATES_MEMORY | + CRYPTO_ALG_NEED_FALLBACK, + .cra_blocksize = XILINX_RSA_BLOCKSIZE, + .cra_ctxsize = sizeof(struct xilinx_rsa_tfm_ctx), + .cra_alignmask = 15, + .cra_module = THIS_MODULE, + }, + } +}; + +static struct xlnx_feature rsa_feature_map[] = { + { + .family = ZYNQMP_FAMILY_CODE, + .subfamily = ALL_SUB_FAMILY_CODE, + .feature_id = PM_SECURE_RSA, + .data = &zynqmp_rsa_drv_ctx, + }, + { /* sentinel */ } +}; + +static int xilinx_rsa_probe(struct platform_device *pdev) +{ + struct xilinx_rsa_drv_ctx *rsa_drv_ctx; + struct device *dev = &pdev->dev; + int ret; + + /* Verify the hardware is present */ + rsa_drv_ctx = xlnx_get_crypto_dev_data(rsa_feature_map); + if (IS_ERR(rsa_drv_ctx)) { + dev_err(dev, "RSA is not supported on the platform\n"); + return PTR_ERR(rsa_drv_ctx); + } + + ret = dma_set_mask_and_coherent(dev, + DMA_BIT_MASK(XILINX_DMA_BIT_MASK)); + if (ret < 0) { + dev_err(dev, "no usable DMA configuration"); + return ret; + } + + rsa_drv_ctx->engine = crypto_engine_alloc_init(dev, 1); + if (!rsa_drv_ctx->engine) { + dev_err(dev, "Cannot alloc RSA engine\n"); + return -ENOMEM; + } + + ret = crypto_engine_start(rsa_drv_ctx->engine); + if (ret) { + dev_err(dev, "Cannot start RSA engine\n"); + goto out; + } + + rsa_drv_ctx->dev = dev; + platform_set_drvdata(pdev, rsa_drv_ctx); + + ret = crypto_register_akcipher(&rsa_drv_ctx->alg); + if (ret < 0) { + dev_err(dev, "Failed to register akcipher alg.\n"); + goto out; + } + + return 0; + +out: + crypto_engine_exit(rsa_drv_ctx->engine); + + return ret; +} + +static int xilinx_rsa_remove(struct platform_device *pdev) +{ + struct xilinx_rsa_drv_ctx *rsa_drv_ctx; + + rsa_drv_ctx = platform_get_drvdata(pdev); + + crypto_engine_exit(rsa_drv_ctx->engine); + + crypto_unregister_akcipher(&rsa_drv_ctx->alg); + + return 0; +} + +static struct platform_driver xilinx_rsa_driver = { + .probe = xilinx_rsa_probe, + .remove = xilinx_rsa_remove, + .driver = { + .name = "xilinx_rsa", + }, +}; + +static int __init xilinx_rsa_driver_init(void) +{ + struct platform_device *pdev; + int ret; + + ret = platform_driver_register(&xilinx_rsa_driver); + if (ret) + return ret; + + pdev = platform_device_register_simple(xilinx_rsa_driver.driver.name, + 0, NULL, 0); + if (IS_ERR(pdev)) { + ret = PTR_ERR(pdev); + platform_driver_unregister(&xilinx_rsa_driver); + } + + return ret; +} + +static void __exit xilinx_rsa_driver_exit(void) +{ + platform_driver_unregister(&xilinx_rsa_driver); +} + +device_initcall(xilinx_rsa_driver_init); +module_exit(xilinx_rsa_driver_exit); + +MODULE_DESCRIPTION("Xilinx RSA hw acceleration support."); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Harsha "); From patchwork Sat Feb 18 05:38:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harsha Harsha X-Patchwork-Id: 654929 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 811EBC636D7 for ; Sat, 18 Feb 2023 05:39:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229607AbjBRFjP (ORCPT ); Sat, 18 Feb 2023 00:39:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229776AbjBRFjH (ORCPT ); Sat, 18 Feb 2023 00:39:07 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2054.outbound.protection.outlook.com [40.107.93.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C08525CF1A; Fri, 17 Feb 2023 21:38:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SDz089RmtR1bSMTVczJvXpbTDbCYJLXUNIO9x8Y2JjPpztlnhBayqSfl8ArQhmevxc8VLwo18A7X/w2rXSN1XjR1jP9Xe1q4xW/f7zXdDmJ1kwHCfzKMxtqC+jFQSeyTwq9+BqZTiiKQVz+R936lq97aCba0u7vju+iGwJF7VnBhLLuqhidW4oiP3Gi3Qk4zuHhtUj3oxXxPFVBrYqB+wviiSv1CWv0tskYo4ZpJSWMjYQg4kUfbRJaXQwF401u5LUhRIguHC9tapC0Up+TyMUNlS1VSkHaRyCUv5IPJ30uYZIcQIM0XWyccTKhlrmPmjqEI4/we/ZXG5hSZVR4FPQ== 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=Z89+Ult3niz4FXpvOfFcRaV8fsyqoGbH9oQZF1UW/Bw=; b=OFPRO8Mh4CI8ad2NxlXAoQh9NxMFcvBBvWpCdaDcisOK+9V/hRk6I+rhnMvbBUSxp0vm9erJz2pPQU6xScr02hVo/RQ6jdpQ5xMfUawY4zVsnX4ZvpBb/04XgJnhfTENeN8o30eCu51ZjGj53WlX/UsnZTLSNB/+kyUIvA26R3ehaRG04MGtYaVFabofMlajZYebxbpS4JEoMGjRAKvcfJVnYBd0GvbcqajGmpqA/EShC+yjfBYtuyb6Cm4B8KBQGgsCRbppwZj+4FqlcSvTf3WxXgt6oWQSltZ2UN9LJJSko3mhRF3YiDcP2tS79q8bSRYCAhFgLfybI2pY3BRJmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z89+Ult3niz4FXpvOfFcRaV8fsyqoGbH9oQZF1UW/Bw=; b=kGLkUYOxEIP/08Mz2Xz8B16ESvWV1R1uB9N9P+Oo6uWnkJRO3haDYntq+MwpwnvhtbF5BnUK/UaPXjTh0XqZgOTWEzHiEW68uAmsqqQnCa635g5qEpwwNWk+jQLdSe7JYnRvxcmwigx0TEXZIKQiSAsir34ggedqLDBbUL4RHw0= Received: from BN0PR04CA0063.namprd04.prod.outlook.com (2603:10b6:408:ea::8) by DM4PR12MB6637.namprd12.prod.outlook.com (2603:10b6:8:bb::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.18; Sat, 18 Feb 2023 05:38:48 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:408:ea:cafe::a0) by BN0PR04CA0063.outlook.office365.com (2603:10b6:408:ea::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17 via Frontend Transport; Sat, 18 Feb 2023 05:38:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6134.14 via Frontend Transport; Sat, 18 Feb 2023 05:38:46 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 17 Feb 2023 23:38:46 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 17 Feb 2023 21:38:46 -0800 Received: from xhdharshah40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Fri, 17 Feb 2023 23:38:43 -0600 From: Harsha Harsha To: , , , , , CC: , , Harsha Harsha Subject: [PATCH 4/4] MAINTAINERS: Add maintainer for Xilinx ZynqMP RSA driver Date: Sat, 18 Feb 2023 11:08:09 +0530 Message-ID: <20230218053809.1780-5-harsha.harsha@amd.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20230218053809.1780-1-harsha.harsha@amd.com> References: <20230218053809.1780-1-harsha.harsha@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|DM4PR12MB6637:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d61cbf2-8788-4b10-d8c3-08db117267de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bs2TSEAkrzcyYS4en/Zfta2OvbgD2jHEWg/iwkFOWqsm+Umf0OkIP41MD/cK+sO85wMbTATZQfgZJtYQb5K/dstsXEA9QYQlQNI+jrBIGx/HP1TH84fO+7pekyhhvpgZEA8gYVyZtABG6TL988/7yO4nbSPb1RXGBftM5P3yxRAv6YX1piIk/oTyaDdwllXBlI1gmGzOtB/lWt5GhM8ciqdsoTcZ6TUYTGv0coxz8871u7+f9/le2YDAztPJ0KmKdXp44mWwvxUXI3H6cUgp+qbulG/E9KMD0Kv22Z6MfQq+whRET+wq7ezjfzatdu/q28QYfCVCobhlu06mTRvQTVQD91TjsRuaUOF1B+aZonRdlMOcg3QQXvGs8a7/2DDp3lGi10LaK+XI5l1kB68enlYx1BNDWEWUqNdepH2qWR12FJ+vpzXYgcIju1AAkO/DjLD4XK/+2vxoBnWgTOjbL4yKqoZjKuOnUB6KOYbT0fCByVpUXRsnLTbPvVQIHMMkJRUqcKmcCEQ8KhLhQqVv3wDecgtmvBunMBjZsgiCFmFpKtikAVmueRUTLlOeVAoW1NtEbVVohX24Y3+xnEpsSHSQJY0h7n7V50reXcjBz+SVUqmiyRy6D5OZDE5NR1A8otCpDCz4ckYYJXUyLktF2wCmwOWtJ2jPWTainM8UsjJ5sVAAfuvM7A/zvJAhr2zgROvmxXwbFetr4HHhNqn6ch/x2d41m1oLlqRDz0qZMO/NCjjJTEqz5IMzXgFZE3s/ X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230025)(4636009)(396003)(39860400002)(136003)(346002)(376002)(451199018)(46966006)(40470700004)(36840700001)(40460700003)(81166007)(82310400005)(356005)(336012)(2616005)(6666004)(1076003)(86362001)(26005)(186003)(36860700001)(40480700001)(426003)(47076005)(41300700001)(8936002)(70206006)(70586007)(4326008)(8676002)(2906002)(44832011)(5660300002)(4744005)(36756003)(82740400003)(966005)(316002)(478600001)(54906003)(110136005)(36900700001)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2023 05:38:46.9189 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4d61cbf2-8788-4b10-d8c3-08db117267de X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6637 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This patch adds an entry for ZynqMP RSA driver in the list of Maintainers. Signed-off-by: Harsha Harsha --- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index f61eb221415b..c21d646cffb0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -22907,6 +22907,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 RSA DRIVER +M: Harsha +S: Maintained +F: drivers/crypto/xilinx/xilinx-rsa.c + XILINX ZYNQMP SHA3 DRIVER M: Harsha S: Maintained