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 4D427EED613 for ; Thu, 12 Sep 2024 15:27:37 +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=AW/y1gSAhKENjHL3lW9TJj79JKhDjrYNIUo6Ww7RCUs=; b=k52TflE+9TFLgbxdnL6Q2iQkgS LpB6ICeisLsAUMxkasX6cgLyYd8NRQLU5WFfUvfQGRI7S7daDGoap8uYhEFSuk69wPeDlZlR+PkcH g9/jxXAXdATY35XGbikbpf7YFJx9MhALcgSf069i5EL37KFNGxPsmvgm0JETIaz8gaD2OnesOCl5e TFYXUgFVzyVZTP5XZnza2wYjj8D3XukuAHUNeXvMEhekuNcXLf75OPlHqjFLfZgZ4vMM2pnij4hDt 86jpnenE2i/869c0LPNGkEXq9CLrgNTtUpZheSjd5wahICKAQDKeXTvfcfOMVf/EwdzYBF+1RKuxB w7ARaTvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soljB-0000000DYvP-1WEM; Thu, 12 Sep 2024 15:27:25 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1soli4-0000000DYfD-1bIK for linux-arm-kernel@lists.infradead.org; Thu, 12 Sep 2024 15:26:17 +0000 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-7d4fa972cbeso907445a12.2 for ; Thu, 12 Sep 2024 08:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726154775; x=1726759575; 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=AW/y1gSAhKENjHL3lW9TJj79JKhDjrYNIUo6Ww7RCUs=; b=WtosirsiAxgpkkyg9AQso/vW9875v8FQ+WaNFy5Wmqpr2j9vmg+pRo/PQhCHLVx9h8 B4pUbY7MApMBVSaZTV5fh9/tZE/pZ+WQVoUCjMfKZ8Krhr8b18HWXQkf43RrUJ/WSL3c J/aTqHgyYjaUoBohcreyIw62l5+wM+kcQlB7slVIGf6cKcvd/OiOTbLN8aibZcAQTCND VVaWaUSuL3hTcGDXoAw/sfgYkDpcw9bqRZx927cHtzI0YzudK1NqtWzqjfvv4NZxOTnV vi4fDsepIvsf58WUwiX4FzIFSSYTNdJapYFnolyrkdYWv+5WuY7QDJafuwixESOSKzRp ZFtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726154775; x=1726759575; 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=AW/y1gSAhKENjHL3lW9TJj79JKhDjrYNIUo6Ww7RCUs=; b=Ux339d4xCIHg7KSetIFSA9zM5BRPaPMFf43g0DXJCQGQSKU9Mtd2KHHKBqSS0vqq9O PPLQF7PSyBk3EFIUi1qQzkiu15ZHlTGY6OAvMggnGeQ2NKVxv3r/vayyRdAnitE+cpmD cUyI+pAzzh2oH+KDlJfNy5q/kayi1tSN+JuyfMCDvQlx18C9sjlznGRa9s4tz27SkM1Z lxTbEb+Q9efZaOfwE6u3664A3WfI/JlcIL3JgwuaHhSk/RO+Dv1HssblaNzMCoXglj8o JiOeyqHU43SkpOow1UYLX/dhpT4GesG7CLiQJLenPulh0v27t1z8S+SX3Tld+NpW0mpK Aruw== X-Forwarded-Encrypted: i=1; AJvYcCWBQJ1IWB2ATCsPN2jgcrKk0HfM/YIr4LQGITvU41gsLxBrsjfJpFZVyh1lPalrmAAUjBcIAvsqvyv61/TxOHXD@lists.infradead.org X-Gm-Message-State: AOJu0YwbUmzqKJfCE8Nf0w5WTO4QuIjkBKffN/FONPa8e98ffGtWrRfW S5MamkNWtnApMkjSgnEQcYbB4YG3250ZdgiGmcattheVufjzR0QxU4JyUk32QbY= X-Google-Smtp-Source: AGHT+IEnUV2gdc2JrTZ0PDN+tPvw1sNecok9fGkCMZLj9cBqFlHeQWX0ELyRbR9mPIeM7B+XWHHF5Q== X-Received: by 2002:a17:90a:f00b:b0:2d8:7a3b:730d with SMTP id 98e67ed59e1d1-2db9ffee5e9mr3070246a91.21.1726154774608; Thu, 12 Sep 2024 08:26:14 -0700 (PDT) Received: from p14s ([2604:3d09:148c:c800:a82e:e104:d822:3d3c]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2dadc03d0ecsm12710893a91.23.2024.09.12.08.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2024 08:26:13 -0700 (PDT) Date: Thu, 12 Sep 2024 09:26:10 -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: <20240830095147.3538047-5-arnaud.pouliquen@foss.st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240912_082616_444691_6857A29C X-CRM114-Status: GOOD ( 25.49 ) 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 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. > + > /* 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 >