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 30AD5CF9C72 for ; Mon, 23 Sep 2024 15:14: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=PHlnbW3NKllRcJspO1pNGsF1SNs+MNN94ks3ff4dHtw=; b=BSQfthRysYqddjL8Akda7m7tXE rfbmH/SgDKtvI8UeJDa4+gWL35uxivNaL+KwKBpTJAl/bjy8GNmHTtC3hkzAQP4M6AuiQpPDwdTUb NxCqAcIOFwdFzLHDgdm9QkMqNmB/KpM4xszUX4BnsQm6UENTiRq+mNki21U9BGaHnwvOnMyUtV/g6 2r/K9lB/Bmj0D4LxKr01KbBaVNQMYAVZpK3fENEIS49NxXf4n7OcH6beRkMr/50PnhS0U0oJh8Fa3 kEhYUCJf71BZYdhAzH2My3dF7QOXjLlFp+gQsyW/9YYa0vGBN3rMiQVlnwCPk5VZtl1PAPRxoPuIE 9KeYGibA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sskm0-0000000HT2j-0Di0; Mon, 23 Sep 2024 15:14:48 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sskkr-0000000HSsi-173T for linux-arm-kernel@lists.infradead.org; Mon, 23 Sep 2024 15:13:38 +0000 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-7e6b32959easo156213a12.1 for ; Mon, 23 Sep 2024 08:13:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727104416; x=1727709216; 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=PHlnbW3NKllRcJspO1pNGsF1SNs+MNN94ks3ff4dHtw=; b=r5570imVq0UGFAppuFg927X4V/m92E9RPK3Z06ELIrKucfH08jZlshtfgPIGx43uVm Dzfh/ltWhKVRwy4O6hyLxA098yILk2Nc5FuSq4O/3HEcUn9WK4sw+LyCDROFy44XOjJX YyAokerIMCZdsJxxAJI4NasiZdjliJ1lrq8f5iyBCaFdDaz/LIKyUav1kZoLOlkU2jrB wMz2+ybZCOxT7RMwezkl/G8oYvu2klI6w+p938MKAgDEDUo0zYUe65rL4PXDsqZX6fRI L2Z5Fu8DaHZQ/G2iWyDbIg72wSXAK0fz94c2b7CotQfmw7i7kvFCgzwvNX68X4KqLUho c1Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727104416; x=1727709216; 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=PHlnbW3NKllRcJspO1pNGsF1SNs+MNN94ks3ff4dHtw=; b=NmmQrMgK75i32HiwScELLBBvk+rnx/JoFPkNL07WruUI9Xo3bcV1AWPyscP49xP9BM SRcxYSStoEM4QlZf56XKHNiQ0nR0FVZCs3riW2d5KMn3NdYbiwGJzWPwpJhRvjugdvNg CC8I0ZuYdzT8p7vx3Vr5CxkJjZ+ahvtNoQzQCfCaNwwyOB1cTvha2X7g2Nni/T0cu3MM SI13YMSOJE+z21jJFcarlO9/HnUGeTib/PNncN6yxyTeUQMJhW+kYv5en+cMTo9jpmPN GYUPXh+LI+dU2shT1aJTTdYO0uR7MhFmXcwsGsDitSEfZmGrfQteiUL4bBH78WRrWkpv Ed9A== X-Forwarded-Encrypted: i=1; AJvYcCW2/HoloCAqT/nsJJ4A6ep79KpiRsvqJatrdKdWkjl+JGuuMr6taqUwCayuL8v24RSOrHgXfOkVAG/Xrct3YwCT@lists.infradead.org X-Gm-Message-State: AOJu0YxkQseRoll6XoUDdmd9kXBL8v2EZ3RY/fS4aVr+5LdQKPlsWiBm WySTA1Ae+lOWEIhsHQzRKYdgoA+jUio7uZ/hKqkhQrqoEIswc2GP55RcM2yIFnk= X-Google-Smtp-Source: AGHT+IFbJhoxbZDPUB8xpdXKh4oBW7cnyX/oVOpugsG4Ru3LqNxXMRMWf4XdpOaiA2LQuH5+9FEH5A== X-Received: by 2002:a05:6a21:3414:b0:1d2:ba7c:d8cf with SMTP id adf61e73a8af0-1d30c989839mr15685241637.7.1727104416169; Mon, 23 Sep 2024 08:13:36 -0700 (PDT) Received: from p14s ([2604:3d09:148c:c800:7512:bc48:5403:2376]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71944b97e51sm13955025b3a.162.2024.09.23.08.13.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 08:13:35 -0700 (PDT) Date: Mon, 23 Sep 2024 09:13: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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_081337_341523_FB03A1BD X-CRM114-Status: GOOD ( 36.34 ) 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 Wed, Sep 18, 2024 at 04:43:32PM +0200, Arnaud POULIQUEN wrote: > Hello Mathieu, > > On 8/30/24 11:51, 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); > > I'm requesting you expertise to fix an issue I'm facing during my test preparing > the V10. > > My issue is that here, we can call the tee_rproc_release_fw() function, defined > in remoteproc_tee built as a remoteproc_tee.ko module. > > I tried to use the IS_ENABLED and IS_REACHABLE macros in remoteproc_tee.h, but > without success: > - use IS_ENABLED() results in a link error: "undefined reference to > tee_rproc_release_fw." > - use IS_REACHABLE() returns false and remoteproc_core calls the inline > tee_rproc_release_fw function that just call WARN_ON(1). > > To solve the issue, I can see three alternatives: > > 1) Modify Kconfig and remoteproc_tee.c to support only built-in. > 2) Use symbol_get/symbol_put. > 3) Define a new rproc_ops->release_fw operation that will be initialized to > tee_rproc_release_fw. > Option (1) is best but make sure people can disable the TEE interface if they don't wish to use it. > From my perspective, the solution 3 seems to be the cleanest way, as it also > removes the dependency between remoteproc_core.c and remoteproc_tee.c. But > regarding previous discussion/series version, it seems that it could not be your > preferred solution. > > Please, could you indicate your preference so that I can directly implement the > best solution (or perhaps you have another alternative to propose)? > > Thanks in advance! > > 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); > > rproc->table_ptr = rproc->cached_table; > > > > return ret;