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 30BAFD15DB8 for ; Mon, 21 Oct 2024 16:11:51 +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=W2P/OAPuPPfGZgym/n673Rfg3DHU/GqTqUEFYAFx22E=; b=Src/oT95HfIr3oaxt+Kq02s97Q EnzCDoWmBPoK8MV4AiWiBVV6iJdZrPESN63rrTYmXMkZ8BW2Gams/C2CGepamekBF845nzVg7XENV /BTAK+JMk6fSC8BnnzLe3rGNAejSJoX+l8J2o8Es1R897riJiKvJkaj+DXh9+3C0XXpjyiPqKyJ8C sGHe/Ipn0WO2ZoUTo1VI+Fx/qhJ9RJRUv07OXgMDxFFnDpDL3K/8oE7k9yGGGR1kcuolKlxH4hen1 Hokkk/21ErWogSgczsv3/oVo1iUIx+jszlpxhsK6ywNkL+30dpZm2WnEUWPoHwtyvBbeqMfEZRgH2 QDtLYcag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2v0O-00000007v2B-1AbI; Mon, 21 Oct 2024 16:11:40 +0000 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2ukA-00000007sZ7-3m3V for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2024 15:54:56 +0000 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-7ea8d7341e6so3423156a12.3 for ; Mon, 21 Oct 2024 08:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729526094; x=1730130894; 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=W2P/OAPuPPfGZgym/n673Rfg3DHU/GqTqUEFYAFx22E=; b=TzMg4Q6ljXT8acUO12E8P+qAUauv0NYA2PH9i46culr9anionE27Mli73+e94munoZ y1Gk+WVdInlvFRf+v+/L+CciFe9uZbr0um1IjTEws3G2HSFL9k3RZ4YoaBlKHjZ6jPih Uv7ng2T6sGZFTAZAEheNt4UzUyiTq8zobte8TbV8Um8OT0yAje0ZvjwWuaHZqteRzuTo hydv3ZmuJ769kP5zxgYbKmuq+kEdVAG7iyidjL/9i8TEq3ibx7CL0iEDxqU69iU+RztE tpddtmYLDs90hAXpCZj/+LXHQ6AC58FPpFeJmaCSGL/uylMfbMsL8KWrv3GkpDZLnIaG MQRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729526094; x=1730130894; 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=W2P/OAPuPPfGZgym/n673Rfg3DHU/GqTqUEFYAFx22E=; b=sv6mN7PgMPSzAknYcs+tN2OYNAxtIerZHUEhp4pLTgnsS5+gzJRMjciRzJKVTRT4Eu S2uIwtDbSk0/tzF+Y6PZEc4GQRWto6lhFHd2bMKo2Qgc1cHoadmZvkI3JoIFFBuh06Jd +rxgjxCoa60rUhVbf1cc5/HpW6YwktjDY0B3kXfW9AJkmi+alDjShXw/Hrut/WM/a2ew v4Fkdsj1hwMLX5Bple0fjyr2Haw5lPCwCks9N5bS2wNxukYNxDTOPBgcBkMnFXW9AM8w /7m+m3Hgptd7sWxG7Cwbc+HgX3MsP3vhjoIvKNwj70ik6KuAraWsfUMX+IXV+5Vtia6T 5scg== X-Forwarded-Encrypted: i=1; AJvYcCU80Tj+KLs/yUQjYGET7dkpp+NXP6el+9RuLtwgJQYArbGagGAfnRVTrjqkUbUSt0sMpl3f7UjMMJy3VK1okFHW@lists.infradead.org X-Gm-Message-State: AOJu0YwfpCWe2Hikc9XOXqYVbz4JJI1AlZ7q3iBsf9VyLrhUrB9m189y CjIdp2fr5cUCBOgbS5FwsMXR3BjfOPB4VIZVbemZVqqzJIX1SLGmLi3kkH5GE1E= X-Google-Smtp-Source: AGHT+IHXumHx1fJK7C0JJjF2aFxoJi4eyEeDsc9H2M9LdVyaQELXWb/6QAXRzMTU/kCm/w8lInBwkg== X-Received: by 2002:a05:6a21:70cb:b0:1cf:6ef0:c6b9 with SMTP id adf61e73a8af0-1d92c56b9bdmr15675587637.32.1729526093768; Mon, 21 Oct 2024 08:54:53 -0700 (PDT) Received: from p14s ([2604:3d09:148c:c800:fb5e:248e:29ec:7946]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec1356780sm3137641b3a.90.2024.10.21.08.54.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 08:54:53 -0700 (PDT) Date: Mon, 21 Oct 2024 09:54:49 -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 v11 4/7] remoteproc: Introduce release_fw optional operation Message-ID: References: <20241009080108.4170320-1-arnaud.pouliquen@foss.st.com> <20241009080108.4170320-5-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241009080108.4170320-5-arnaud.pouliquen@foss.st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241021_085454_970840_5E8E200C X-CRM114-Status: GOOD ( 23.84 ) 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, Oct 09, 2024 at 10:01:05AM +0200, Arnaud Pouliquen wrote: > This patch updates the rproc_ops struct to include an optional > release_fw function. > > The release_fw ops is responsible for releasing the remote processor > firmware image. The ops 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. > - after stopping the remote processor. > > Signed-off-by: Arnaud Pouliquen > --- > Update vs v9 revision: > - New commit that preplace previous one to introduce ops->release_fw > --- > drivers/remoteproc/remoteproc_core.c | 5 +++++ > include/linux/remoteproc.h | 3 +++ > 2 files changed, 8 insertions(+) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index 7694817f25d4..46863e1ca307 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -1258,6 +1258,9 @@ static int rproc_alloc_registered_carveouts(struct rproc *rproc) > > static void rproc_release_fw(struct rproc *rproc) > { > + if (rproc->ops->release_fw) > + rproc->ops->release_fw(rproc); > + > /* Free the copy of the resource table */ > kfree(rproc->cached_table); > rproc->cached_table = NULL; > @@ -1377,6 +1380,8 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) > unprepare_subdevices: > rproc_unprepare_subdevices(rproc); > reset_table_ptr: > + if (rproc->ops->release_fw) > + rproc->ops->release_fw(rproc); > rproc->table_ptr = rproc->cached_table; > > return ret; > diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h > index 73f640dd0fc0..bdf4d94a9e63 100644 > --- a/include/linux/remoteproc.h > +++ b/include/linux/remoteproc.h > @@ -381,6 +381,8 @@ enum rsc_handling_status { > * @panic: optional callback to react to system panic, core will delay > * panic at least the returned number of milliseconds > * @coredump: collect firmware dump after the subsystem is shutdown > + * @release_fw: optional function to release the firmware image from ROM memories. > + * This function is called after stopping the process or in case of an error ... after stopping the process? > */ > struct rproc_ops { > int (*prepare)(struct rproc *rproc); > @@ -403,6 +405,7 @@ struct rproc_ops { > u64 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw); > unsigned long (*panic)(struct rproc *rproc); > void (*coredump)(struct rproc *rproc); > + void (*release_fw)(struct rproc *rproc); > }; > > /** > -- > 2.25.1 >