From patchwork Tue Nov 26 06:46:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaurav Jain X-Patchwork-Id: 13885512 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2043.outbound.protection.outlook.com [40.107.22.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E9141A260; Tue, 26 Nov 2024 06:46:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732603618; cv=fail; b=BLQmZAN40piA87uSQ/B97UBHqrCE47WtGQFMusHJoKw2zxeIw9zDXC/X9rzN36aDkGmitPP8M7+pea85n5ZBZMU/5YAi/B8YUEeuwBJ13rg0QQdEJnR9M6OlR7yOchnRQmTSqpKGiX65U6o5yyhh4bMz5oupbD4ZWpkE8G14JFM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732603618; c=relaxed/simple; bh=as8hbax+gIKz7XMde+3qdDa0aRN4V4JLpGY4ChUlwgA=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=FS1vCC0p/9vYmWK8RHC4KpNLdMVv5bwgGxa0AaDTxl+k+NTMshAOfBmHku/jCkWtJHMRqYZRXtViiVnEBMDrcx3RVJaLD7IRVD+Z5kKNzpU1FshGn4iIH7ZFVdb+OHg5/27r8QEI21BRjouh9D3dpNF/GonKuWFbbcegbKQbKOQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=LdSzjXiJ; arc=fail smtp.client-ip=40.107.22.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="LdSzjXiJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CBbARKpBpO2zrxG34oyTgP08cljK2j75yCo9KKaYfuzGhyN+YewLgGzuD4CQsO7C3nHl74dyYHmCnzQyy+hmb3Z7IC1jck/OZkQsuzzQE9QA7Mx5fuuYtw381YlGLq2iAFE8ss3xZdd6jjnhXms8bLSHXTMNZNzC3SRI7dx6/Y5++zv53dH49bEQIQuUqqrnUOoGsk03UYHAX3b89ckoaWrM9j6ahNHovoLpyWpppdU0JZaIx8bZP+JwxGYMYvy5kZIS92+bQPHF+OAlwjVwJiQ3WOUiyaC2kA+xCHF0+UojHOOgQDaWl8e9hxYUkvx0McIvOCFzzo/eagtZGA7dmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ZWHhSHA6Re1h7odoCdtFFT3xg/eI1jNwTEHtsyHEM/g=; b=MnQ3VUU3x2cMeA0FiTzNLd2RJtKcyDjBS8SdP55f9oSgcPY6PsY4BzFzWmV0YIhvszQFScjzSXfjF4gqgVN4aNs9q86awbTuZI0J9E/5xTShPNe4sNYZxg7lb+GURB0QTNxJKRLshO0OQbx3d0rCOaZRrObkJ5mcASu/2lVTJ96KwwTFEKD1QlIPKWggPJaB+k+xc9UrqtUy1MjRXs/JGHI2v3+vk/04oc8rQvt7uzHOeHL9L+dPCIV5yilZRuj4jT6hAiQNEDyavu30IfzgLvv3NSLWy8bNc34DDvGmXx7eELnkpzDeb6BGjN6l1iepBaAnWA2BkyoqWNSd55EAGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZWHhSHA6Re1h7odoCdtFFT3xg/eI1jNwTEHtsyHEM/g=; b=LdSzjXiJP0rahDm4M51c49Mvn/i7rCXjuWbKnO/T/DqeY1oTqlTWkgi0/eF4dRSMfHgDURidK0sFONrfnbJ12J0bEkXw7moIf/8DGJdRao0ztypKdNczfBWmo6iyaP6+RrpikjjzWa3gwWuOuuHmwxe1KN7vOOEFL3YApaxOG8cyj/vJJj7VVIHNHH1gGdKIetCRL3gAx9DlqbEuwokEYtmWkjdBKV7o6/s6Ykr4AImMgPq6TcfVXU861jUecnY6Y3KwLntI0iLgBRVlOSLyjwCSdp376dtodd2API49oDRVr077tBmj1/ounVMjkIyVq22eI5FePc3H25Pj3Ew2mA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB8409.eurprd04.prod.outlook.com (2603:10a6:10:244::6) by DU2PR04MB9098.eurprd04.prod.outlook.com (2603:10a6:10:2f1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.19; Tue, 26 Nov 2024 06:46:53 +0000 Received: from DB9PR04MB8409.eurprd04.prod.outlook.com ([fe80::1436:d8ba:25b8:1637]) by DB9PR04MB8409.eurprd04.prod.outlook.com ([fe80::1436:d8ba:25b8:1637%3]) with mapi id 15.20.8182.019; Tue, 26 Nov 2024 06:46:53 +0000 From: Gaurav Jain To: Ahmad Fatoum , Horia Geanta , Pankaj Gupta , Herbert Xu , "David S . Miller" , Silvano Di Ninno , Varun Sethi , Meenakshi Aggarwal , Sahil Malhotra , Nikolaus Voss Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Pengutronix Kernel Team , Gaurav Jain Subject: [PATCH v2] crypto: caam - use JobR's space to access page 0 regs Date: Tue, 26 Nov 2024 12:16:07 +0530 Message-Id: <20241126064607.456633-1-gaurav.jain@nxp.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To DB9PR04MB8409.eurprd04.prod.outlook.com (2603:10a6:10:244::6) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8409:EE_|DU2PR04MB9098:EE_ X-MS-Office365-Filtering-Correlation-Id: 23c2019c-a2fd-4c4f-50c0-08dd0de61cda X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|1800799024|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: ZIZLTPViDVKE+rhPscHjuqfwn+idXmSIOHcyMEDsX/N7+59/QXa44EmjCJuzUFJAqa+W0ZfmCgXX42veiF2wjtioBjMfCbmrdEY+YK0KcldyxGBXslK4xT+y5ry44QaiGvHxz23UCPmV06nw5c23t1OymimAVX25qgooIei4Ty6S03sU7fbubuzbBCgvLli4BXRNASyhH8hsksyovP9A9p2JlKFYkc4lFw3JVbHS2cr9uA0rFNN9WUwBYaP4rRkwppuDXVegUHW+ZWbzGsyLTB4uHCmKmhg7nyB7PER+mrv/MSRywWmiLK5gCUxBgPgufbVUnttWUcQSfUgzm7v21Q8N8pMPCaHNL7fxufrV59OgRjaxq10BdjEzLA2biLHuRS2OF4lqSG0ahv5s5h8OHY4IDW5+YHkdof8w47o+vHXFIO2lOdymau5Eo52Wj3+U0n06Up/05Q2P3KkYUCXnKoO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od.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Taxjn17aPUyfIlxUM16HH2tycwLmYWZTFstAfvDErk9yoY2geD8yKI9DhIrTFH7ycZ7BryZCAcHD39Ak3dtig+1/0CovWt6p/MPm+icKWkQQOFZS1c55hZXcoJsc+0mry2ztXwicqipFejnJlf58hF8fU9qLFDAT5kQN2uwmXCAleZXEv5J61npqR2Ml/BHHVEjjehzAMPkUIXEYdLK/QqaziWtBNq6Cq38j8WWFTx/VrSlFqYk1L6vdbo+pwOnAbupLsEnxiiTdIIri6OoikWc7FbOF3eOqx9YtBEg8y22eZL//TzLAukPZuJdBzd2ecSNsrBE1Ji3mOQ8/qIeRocIbNLToZCZfYw60GIWwt2G0FtB1L7bbuuzsZ8Ktjxrx2JlB4AZORYgXCtHOZQNOp5fc+u3bfAKSOJDS++G5U/GWkV/rEYQYe8YBrAk88ubl3ex/EPjJaIG1kKysJ4Joucp8EI7NJlkmpMyO8QjfGIsJoz4HCYV4bLxoEmn3mnbNOagWEWERF9+siSLMlpyQuOrHlO9vpxnMySJF31K5bKTBxTwG9IoZfyNdfwTvfgaB8yM4zR7wn9GgV4hPfplMz0UcVE2ttRWhnmwrV6F85FSs6w1JMWiHBwtCL2LzU0xPUPgJ3N+2VHo0SRe12psRxuRBKePfyiOE/I4lAOulCCZMIIJUVslzDeGWekgr1Zu/TyE7vU29r5uCWMYl6vvbAMnPII+5SFKYGxh/kq+uZACnBgr7FDG39qo2TKdfvHXa8/CbmetVCTSXEkVZ5HyADJ/AL4TUS4q1ZmwRSi99a00Oc5BQXC/B/gOUOeSMD6FA4elGNg9MXwpkq7pOyHMxK5hQ3LYq7zkQ2WV4E2vq/VrDHuEnWcn9BSOemhY/6ES98ieK0ZReyqWMJA6hvH+sKX4pMMUdM3oD/ST8hQGwOPb75NqGsVeIVFdLsXqm6sGuJ6jTyIpRCcaomS9FJ8OhHM11YK5N7K5inDQEW8G25fXUR1Jbl8NpdDXSIlOJCG+QXtnfLqFySzsa6q+aLA9ebstt0e6BO/WAN4u8lABz0+n0l+8u5Rf7DM+KQ8aKr0R0EkuwwXYVsjIw8c/rWsL3qBI6UImrpp20WW2kYmEF9TXrjE6esqMbN4m9UQ1Jt41G2V94ZfjzVn+BG8Zl9wehXgaXutE6oZibGielv18a9RPd+z9AzAjU3h38u59UCuaBA79CcDEtJYlZd/h68mX7xBkHdooBSOadKz2cmXWYA3aklqqsFT3v8g+trFVBTOuZJn+6CK4lV9CMuBipD9gvnwe61NEgbAhJ3AsLaPomxDue7kXmFm6SnnNM1PTWydEROI4JpoUoARdzGquU3MtAx1nFyG0ZQRz5RDDWVgRCzrYmiP/20giEJB4zLdBkD0WgwtM3IFD1zADQ5YdCr1SG+9PPwM1tmxSknyMFw8ORa/RoW6FQpyyBzTacWA9YZkjtgOfQOb6+DpusrUlQhBnXxJLpoNdw7l5/yds8qZMVOCN2MRuREAIp+vZpxMqQ5WnbbJ3oHg2oNtgC6yWt+y9uMc/aEvBZC7T2OlM/n4yjaM6Y4HCW4rfjVwlhUVTqGfet X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23c2019c-a2fd-4c4f-50c0-08dd0de61cda X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8409.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2024 06:46:53.5874 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +1AZe9qeSB0V+warpORcO+szGH/PMscgpGCBR8HqAx50AR5NmI3NX83bit+p/EAA/g6ZAsl0g/6xjThun5CgNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9098 On iMX8DXL/QM/QXP(SECO) & iMX8ULP(ELE) SoCs, access to controller region(CAAM page 0) is not permitted from non secure world. use JobR's register space to access page 0 registers. Fixes: 6a83830f649a ("crypto: caam - warn if blob_gen key is insecure") Signed-off-by: Gaurav Jain Reviewed-by: Ahmad Fatoum --- changes in v2 Updated commit message with SoCs details on which CAAM page 0 is not accessible from non secure world. drivers/crypto/caam/blob_gen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam/blob_gen.c b/drivers/crypto/caam/blob_gen.c index 87781c1534ee..079a22cc9f02 100644 --- a/drivers/crypto/caam/blob_gen.c +++ b/drivers/crypto/caam/blob_gen.c @@ -2,6 +2,7 @@ /* * Copyright (C) 2015 Pengutronix, Steffen Trumtrar * Copyright (C) 2021 Pengutronix, Ahmad Fatoum + * Copyright 2024 NXP */ #define pr_fmt(fmt) "caam blob_gen: " fmt @@ -104,7 +105,7 @@ int caam_process_blob(struct caam_blob_priv *priv, } ctrlpriv = dev_get_drvdata(jrdev->parent); - moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->ctrl->perfmon.status)); + moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->jr[0]->perfmon.status)); if (moo != CSTA_MOO_SECURE && moo != CSTA_MOO_TRUSTED) dev_warn(jrdev, "using insecure test key, enable HAB to use unique device key!\n");