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 35703EE49BC for ; Wed, 11 Sep 2024 15:59:58 +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=qyEYdmmCtjL2ZglMclaQOmpZZ8FR1iFPca3qPYCy9w4=; b=TsUb0wG8ZwifvsmRrjweCnxYLI QbN9roLas6l7dBaGus7KpJSZOr/9C9WoiPh9pdOr43OlH7prB+TR+HNfGis/zvRDfTncYNil1y70j vhMJ3GOqvRugJy6Zof9KXr1kzKwBu1lnP3Yatl9eXX+8RFAirmwziE650B2Q+wJRf5QQrHv6QYCRI RG2ozsGqF5QfqT+hkial3kHx9cXyOKUJw6kzqWEMOurA0BaTB4a5ZzIbS6sRk4HcTWz+cthKWjrId ZtZ4jBYOI/iQJI0jaAqrt7WUM+BgTpfV45IAaTDcjJiQjZsmEqaqTXnZTcfB0OgvNLFUmyxPm/rRS Zgw+0MSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soPkz-0000000AHeS-1i3w; Wed, 11 Sep 2024 15:59:49 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1soPht-0000000AGr5-1XRj for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2024 15:56:39 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-20543fdb7acso167585ad.1 for ; Wed, 11 Sep 2024 08:56:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726070196; x=1726674996; 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=qyEYdmmCtjL2ZglMclaQOmpZZ8FR1iFPca3qPYCy9w4=; b=Wev3QLisWn74LjWc+lfJVR+z/A/kVUfSpTHxIXMp+WVK6jBGnfY+B6KZ5vkjvEJhEO kHPGEaLT3yASRdRHxPzREOR72/rVw3YgSRZQ8no+nVTFqlw59W8vd05b+m68HQAYkRvx n2h5MZKf5PAw0Y8Lz0RHPY5/eHOr9t1lFA666yjiCNs8cYcNsyie4YRoqltLyYPyouWc Dh+uu9bQwoIzWURwmSKMHJ0mg7Kq6pQMK76HI/RPTSku2fXlphBkTnpTHLIaDbNENVT3 tENlIt1qEQC7M58QybROLkBqNlGbNvUGIysmzdN+k68e8oyh36An4Ra58/uhFXq+bsq8 RXZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726070196; x=1726674996; 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=qyEYdmmCtjL2ZglMclaQOmpZZ8FR1iFPca3qPYCy9w4=; b=ulAqyeJXQLM4ra1kr/MyiXoZLCFTp4DLzhZQQWDna9G8+f6AtylINSIqNFvy4Pw131 Pm5sKOVDhiudp7LEtRoPkzMqR4bE2fQFugAPLRwmdRT0aItM2OJcgpnBPhIGAdKaVzPP yERISQ+luU+L+bfdYFyFkRf/8PvvKerWnkIjjmNqDiEb2KZhbvdY/sJMMt6yI889xfhB mr9Vx++DAdevnve53QUM5xGfMAt90sr25GnHBmnyzbZYJ3bTj5KxDduARQPPJPwXgR9Q 91O0dknqOWuH2mgInLdnmKZlvHGzWXjBA70rJ6ERhPEkMl7E8kNgr26K6RAG+oRq8EpE pEMw== X-Forwarded-Encrypted: i=1; AJvYcCXdfUB0l9xlZ+eDy05xjtNV1kz6y38/Em8NXMJRG4457MqBush29+TOEElWR8+0hC+FHroetLiXT48995DrI1wr@lists.infradead.org X-Gm-Message-State: AOJu0YywZQYspjtqLMrQazt3o9+qk8AdsA8RP0ppR1ZaheB91NmpjVVU 75TBvzbcc1WyCb/PHx6ym1ajjJvYYH5iXS+bNQIVRU8cPE8bo+fs3vhAw18ArCw= X-Google-Smtp-Source: AGHT+IGa4wRKlJxrETW0qCu5ZTTQ3xb8Do/wPK2e8jasfbzAeq1gxfAE2Mk/Fx9F2dJ/V92m0elHfA== X-Received: by 2002:a17:902:d4cc:b0:207:3a46:345 with SMTP id d9443c01a7336-2074c761a4dmr58970435ad.51.1726070196194; Wed, 11 Sep 2024 08:56:36 -0700 (PDT) Received: from p14s ([2604:3d09:148c:c800:cc9a:9892:2799:3634]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2076afe9cb9sm1159555ad.193.2024.09.11.08.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:56:35 -0700 (PDT) Date: Wed, 11 Sep 2024 09:56:32 -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-20240911_085637_607194_2A01DBF2 X-CRM114-Status: GOOD ( 25.00 ) 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); > + If I understand correctly, the first condition is there because the attach/detach scenario does not yet support management by the TEE. I would simply move the check to tee_rproc_release_fw() with a comment to that effect. > /* 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: I would have kept the old label. > + if (rproc->tee_interface) > + tee_rproc_release_fw(rproc); > rproc->table_ptr = rproc->cached_table; > > return ret; > -- > 2.25.1 >