Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp90149lqb; Thu, 23 May 2024 11:36:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWWFl4/uT3TZYptY2xcOQ4xHsTMaj4NrFQDsx/G0LriFuaSBRfn1tTG65S9GPEv6ZKm0YHbaeZA7J0knMOQ+lUbf31frwpZvFGWyhIrhw== X-Google-Smtp-Source: AGHT+IEJL5G1jlS7HUWGI+loYNxDgle0/q3wgm0541NjYWuOiQrOvk6mQYYVHhOs63kM1v6l0pWS X-Received: by 2002:a05:620a:1470:b0:792:9e07:afb6 with SMTP id af79cd13be357-794ab08a5e0mr4839585a.32.1716489393054; Thu, 23 May 2024 11:36:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716489393; cv=pass; d=google.com; s=arc-20160816; b=F+dV5ti9TgL9mwNfOx4Yjs2p7DGniptN5GJiNsuP0jK8cyry4tHlmn+HQIMEx0yULS WCsQyxI4yIzk/75qI4+YtF/PczSV65LYD3YM0MQPo2TWpuLC0jeqoX9PW/a95fHBwqT7 N5cPmGepscvo2TR20jUUH542GtUxAYZKziTLn1/F6MbCwkxA5UkVBTHW7bCt1R3Pfbbo BnY5hdJp55slnfs1G4su18pRVEszgOzeYswhs/pDcoOdwecODktiCh7rIFLJuycpeSZp NO2dNwJIY/4ZXJpXjczB0XsMrZbDxcWDIiVHRo1EBJpegXeJHU49q/UmJouY+W7X2Fvp l4vQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=4m65FSMmNoYIe7Sd3ssHLMwWQx//gXzOd0LQ4n/7R64=; fh=egFkagNWd8+I9kyF9qcew4Q822CJfB6CuWYmJQXc250=; b=tUz0E1TnqA0po0tAlnMJcTi/flSKJrCOAUwBVw4oMzY8g6T5evpiQFJNVz+JlwRk1U a2DxXSmmctquRI7ogfcrLPHENSjabU9MfjV0xWYmGmKGC/GIZW/aSEfnXIe0ohIjqzYF ihDaINFAmVe/V7uBmXs36KDeSYZFRTHas8XQNhwvYjPX0strSesYyWmLjcKVaQnAH9sx CuSguS4pMMXYHPM8D747H3QSH12f/NwMvE8tDqO4SXPfGlKRNAnFhQP8s5q3uKhmRgKB TRsYf0d9iDfQ5+Pjo0l7pS5krI6+pI+KN8DBRP66zEXyq4BqVWhGLui9Lt2VGBIIIkiQ 2lZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-187885-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187885-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43e17d1e75bsi15402571cf.454.2024.05.23.11.36.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 11:36:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187885-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-187885-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187885-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C328E1C214A6 for ; Thu, 23 May 2024 18:36:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4215A8288D; Thu, 23 May 2024 18:36:27 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 A3F6C31A67 for ; Thu, 23 May 2024 18:36:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716489386; cv=none; b=QuFSOpgFcUqjuh106GGYvTLBeT5QSKIQZq3NKf+VRIjP6vdgcqXc4A4p4wxhaF8G+uMzlVAfZTqaKoTZQizGQZc+5ucldqreyj1hqt+0pce8SCKXWCRY4urWxJ+dMnZXuu4cfSfAksZWndqojL9sPC5ArOAqZKHKD5C5Y0SBjZk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716489386; c=relaxed/simple; bh=5RUAp8ZjGFL4XRjmweHbAxKTYu3FMUhMMQO7Zf2Hno4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=l2Zkox3bZKfvLUtUIbxe73EhBBqBAqhLM870c2Pnq6fWi1aH6zRQU/bhDb1v474eGGr9ar22BnKc/Q9K9qtinqxiTraqfsb3AiWdA/FJPHSnrW0ozQM3SMdlbcobZ2uoPdUD/EG7Fq06S7JsMo3XYLV6u+YmCqoiphqfZG8yU/w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sADIG-0005dy-Sc; Thu, 23 May 2024 20:36:00 +0200 Received: from [2a0a:edc0:2:b01:1d::c5] (helo=pty.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sADIF-002hBH-U5; Thu, 23 May 2024 20:35:59 +0200 Received: from sha by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1sADIF-009tpb-2g; Thu, 23 May 2024 20:35:59 +0200 Date: Thu, 23 May 2024 20:35:59 +0200 From: Sascha Hauer To: Pankaj Gupta Cc: Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Pengutronix Kernel Team , Fabio Estevam , Rob Herring , Krzysztof Kozlowski , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , "imx@lists.linux.dev" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [EXT] Re: [PATCH v2 4/5] firmware: imx: add driver for NXP EdgeLock Enclave Message-ID: References: <20240523-imx-se-if-v2-0-5a6fd189a539@nxp.com> <20240523-imx-se-if-v2-4-5a6fd189a539@nxp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org On Thu, May 23, 2024 at 01:43:46PM +0000, Pankaj Gupta wrote: > > > > -----Original Message----- > > From: Sascha Hauer > > Sent: Thursday, May 23, 2024 6:54 PM > > To: Pankaj Gupta > > Cc: Jonathan Corbet ; Rob Herring ; > > Krzysztof Kozlowski ; Conor Dooley > > ; Shawn Guo ; Pengutronix > > Kernel Team ; Fabio Estevam > > ; Rob Herring ; Krzysztof Kozlowski > > ; linux-doc@vger.kernel.org; linux- > > kernel@vger.kernel.org; devicetree@vger.kernel.org; imx@lists.linux.dev; > > linux-arm-kernel@lists.infradead.org > > Subject: [EXT] Re: [PATCH v2 4/5] firmware: imx: add driver for NXP EdgeLock > > Enclave > > > > Caution: This is an external email. Please take care when clicking links or > > opening attachments. When in doubt, report the message using the 'Report > > this email' button > > > > > > On Thu, May 23, 2024 at 04:19:35PM +0530, Pankaj Gupta wrote: > > > NXP hardware IP(s) for secure-enclaves like Edgelock Enclave(ELE), are > > > embedded in the SoC to support the features like HSM, SHE & V2X, using > > > message based communication interface. > > > > > > The secure enclave FW communicates on a dedicated messaging unit(MU) > > > based interface(s) with application core, where kernel is running. > > > It exists on specific i.MX processors. e.g. i.MX8ULP, i.MX93. > > > > > > This patch adds the driver for communication interface to > > > secure-enclave, for exchanging messages with NXP secure enclave HW > > > IP(s) like EdgeLock Enclave (ELE) from Kernel-space, used by kernel > > > management layers like > > > - DM-Crypt. > > > > > > Signed-off-by: Pankaj Gupta > > > --- > > > drivers/firmware/imx/Kconfig | 12 + > > > drivers/firmware/imx/Makefile | 2 + > > > drivers/firmware/imx/ele_base_msg.c | 286 +++++++++++++++++++ > > > drivers/firmware/imx/ele_base_msg.h | 92 +++++++ > > > drivers/firmware/imx/ele_common.c | 239 ++++++++++++++++ > > > drivers/firmware/imx/ele_common.h | 43 +++ > > > drivers/firmware/imx/se_ctrl.c | 531 > > ++++++++++++++++++++++++++++++++++++ > > > drivers/firmware/imx/se_ctrl.h | 99 +++++++ > > > include/linux/firmware/imx/se_api.h | 14 + > > > 9 files changed, 1318 insertions(+) > > > > [...] > > > > > > > > +int imx_ele_msg_send(struct se_if_priv *priv, void *tx_msg) { > > > + struct se_msg_hdr *header; > > > + int err; > > > + > > > + header = (struct se_msg_hdr *) tx_msg; > > > + > > > + if (header->tag == priv->cmd_tag) > > > + lockdep_assert_held(&priv->se_if_cmd_lock); > > > + > > > + scoped_guard(mutex, &priv->se_if_lock); > > > > scoped_guard() with an empty block doesn't make much sense. Either use > > scope_guard() { /* do something locked */ }; or guard(). > > > Need to allow send more than one message at a time. Hence, done it after taking the lock. > Once message sent, scope of lock is over. You take the lock and release it immediately afterwards. There's nothing locked with this. Please have a look how scoped_guard() works. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |