From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 86863CF9C6F for ; Mon, 23 Sep 2024 14:55:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WHr0ZZ/aZlRlTTNC+24ZGFKKQK7dS5KdBsTinwCJgs0=; b=Wkm4H4SSnRCPpkozxjsVmdltcR t8abMZzJNNfnq8VtytxBPm39gZjAYj7mnyht9CrKXHukVuiknPcMcVQZ3JTgxmlMeJ50IWUbs7hmq MfNmisz5DK7izhVbcBK4jK+AAFAV0oOu1P5C1dcaW0KJF0J+TTbR9eWVFYke43n8Yp6i01FM7XjPd 5Bam1JoXz25clqA98+JLeYwtB1nBlpQbcNTWI4X3w5KWfoqQ4jR9Awc2dIg+9zx3MvaEf3KTXW1yk O7Gwh1cT340Atoc0X/vo5o1kXQkQJeEucp8+lmQ3IPu7IFkKhhbcdoizuHH3bS/uKYoIxZHrwOU+g bgvBgE6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sskSp-0000000HQME-0Iik; Mon, 23 Sep 2024 14:54:59 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sskRg-0000000HQB7-0efr for linux-arm-kernel@lists.infradead.org; Mon, 23 Sep 2024 14:53:49 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-20792913262so52542165ad.3 for ; Mon, 23 Sep 2024 07:53:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727103226; x=1727708026; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WHr0ZZ/aZlRlTTNC+24ZGFKKQK7dS5KdBsTinwCJgs0=; b=FgXzCu+gdhec7K5QFcUEy211Z9mq8ad+Csu2RiDx1ua+9JJXKTWjk0U1RyEy7XSNsr Pot+7VaVIsjxp8MUCvZrqxJSYsKOSAJsm0SNLELZYCGZz/SqfQoH3Qn8w0w2HXTbauif vPE9RCddtIq+omjToDZtaNsmOB6fpPeAmYFd+LrdICyoHUIMuxf52/SJ3DZ6k4595UMD Qx9OSlXrqAAH82lYMDYGPkd2pnb3vedCRolQ0TRmf+M9s4N0/2lST+ZRIHNns8FzJoAe V8Xj5CXYK7sDB00J+cagdQLK2r9YC/n47AkL7bbOBpn7t9Cj7uOUfB4SZf4HrEni0TyA wNXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727103226; x=1727708026; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WHr0ZZ/aZlRlTTNC+24ZGFKKQK7dS5KdBsTinwCJgs0=; b=W2d1Mb2jPJWR1pE/YKpuluJG75Sqr9jP803w4hykZQa7KqQoLSOUx/jHNFVL1Z3yf7 EgluTemTggbc1VAm/2FYlDBiPJ2Jrhev3bwPZ5CKyPKgS3N9v6q6Gi1WRBcZdJOI2WAx 0t3c+va5Y8sXzCusWtI68vRWkOVQKecakfiWvgQhi9gpwf+9xFtMkdjKvUIXvVuLQX2l xedA7D/gj+iMBVMkHzPeWhUShwk30ek57CL6zXtNUkakaTrsqH7At3fcFc0LszBSmjm4 SL2MrvMkuaB61QyjUEx5b9OdHPOQwheXZwbypjTQvEswYC/jGgub2OsUNKHtvBVFHW9V hkiQ== X-Forwarded-Encrypted: i=1; AJvYcCWXccDLnh+8KFF9D2Exc6ScmZSA3+yC9f+fx3Ihx9qCV0kvkfd0XNehTBxVCmgaOX2swB5RNXCnSlLkl3F9utmS@lists.infradead.org X-Gm-Message-State: AOJu0YwMufG0u/Zxz9kjiTtbf5LbhWAcWghL8jRnPH+50/ErKb49C8VQ HMpL4hMZVI8Uj3c3Wf5tY5TaHN/JwpzWlGip3OHyjE4fGhSh8eDh4v2d50ZttOA= X-Google-Smtp-Source: AGHT+IFhuOJw/XCNSvJ+MBjXWlX3smHS2Cj4f9xvR/t5xWbD1tPq7HDm+e4xSSJ78ipXDawFIf2SCw== X-Received: by 2002:a17:903:18f:b0:205:76b1:175f with SMTP id d9443c01a7336-208d8394187mr150565885ad.21.1727103226610; Mon, 23 Sep 2024 07:53:46 -0700 (PDT) Received: from p14s ([2604:3d09:148c:c800:7512:bc48:5403:2376]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-207946010d9sm134192425ad.65.2024.09.23.07.53.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 07:53:46 -0700 (PDT) Date: Mon, 23 Sep 2024 08:53:43 -0600 From: Mathieu Poirier To: Arnaud POULIQUEN Cc: Bjorn Andersson , Jens Wiklander , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org, devicetree@vger.kernel.org Subject: Re: [PATCH v9 4/7] remoteproc: core: Add TEE interface support for firmware release Message-ID: References: <20240830095147.3538047-1-arnaud.pouliquen@foss.st.com> <20240830095147.3538047-5-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_075348_244310_75195F6D X-CRM114-Status: GOOD ( 32.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Sep 17, 2024 at 06:56:58PM +0200, Arnaud POULIQUEN wrote: > Hello Mathieu, > > On 9/12/24 17:26, Mathieu Poirier wrote: > > On Fri, Aug 30, 2024 at 11:51:44AM +0200, Arnaud Pouliquen wrote: > >> Add support for releasing remote processor firmware through > >> the Trusted Execution Environment (TEE) interface. > >> > >> The tee_rproc_release_fw() function is called in the following cases: > >> > >> - An error occurs in rproc_start() between the loading of the segments and > >> the start of the remote processor. > >> - When rproc_release_fw is called on error or after stopping the remote > >> processor. > >> > >> Signed-off-by: Arnaud Pouliquen > >> --- > >> drivers/remoteproc/remoteproc_core.c | 10 ++++++++-- > >> 1 file changed, 8 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > >> index 7694817f25d4..32052dedc149 100644 > >> --- a/drivers/remoteproc/remoteproc_core.c > >> +++ b/drivers/remoteproc/remoteproc_core.c > >> @@ -29,6 +29,7 @@ > >> #include > >> #include > >> #include > >> +#include > >> #include > >> #include > >> #include > >> @@ -1258,6 +1259,9 @@ static int rproc_alloc_registered_carveouts(struct rproc *rproc) > >> > >> static void rproc_release_fw(struct rproc *rproc) > >> { > >> + if (rproc->state == RPROC_OFFLINE && rproc->tee_interface) > >> + tee_rproc_release_fw(rproc); > > > > Function tee_rproc_release_fw() returns a value that is ignored. I don't know > > how it passes the Sparse checker but I already see patches coming in my Inbox to > > deal with that. In this case there is nothing else to do if there is an error > > releasing the firware. As such I would put a (void) in front and add a comment > > about the return value being ignore on purpose. > > Instead of ignoring the error, I wonder if we should panic in > tee_rproc_release_fw(). Indeed, we would be in an unexpected state without any > possible action to return to a normal state. Nowadays a call to panic() is only used in very dire situations and I don't see this meeting that requirement. I would just call a dev_err() and let it be. > > Regards, > Arnaud > > > > >> + > >> /* Free the copy of the resource table */ > >> kfree(rproc->cached_table); > >> rproc->cached_table = NULL; > >> @@ -1348,7 +1352,7 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) > >> if (ret) { > >> dev_err(dev, "failed to prepare subdevices for %s: %d\n", > >> rproc->name, ret); > >> - goto reset_table_ptr; > >> + goto release_fw; > >> } > >> > >> /* power up the remote processor */ > >> @@ -1376,7 +1380,9 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) > >> rproc->ops->stop(rproc); > >> unprepare_subdevices: > >> rproc_unprepare_subdevices(rproc); > >> -reset_table_ptr: > >> +release_fw: > >> + if (rproc->tee_interface) > >> + tee_rproc_release_fw(rproc); > > > > Same here. > > > >> rproc->table_ptr = rproc->cached_table; > >> > >> return ret; > >> -- > >> 2.25.1 > >>