devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 3/5] remoteproc: stm32: Clean-up the management of the hold boot by SMC call
Date: Wed, 5 Apr 2023 11:55:18 -0600	[thread overview]
Message-ID: <20230405175518.GC3812912@p14s> (raw)
In-Reply-To: <20230331154651.3107173-4-arnaud.pouliquen@foss.st.com>

Hi Arnaud,

On Fri, Mar 31, 2023 at 05:46:49PM +0200, Arnaud Pouliquen wrote:
> There are two ways to manage the Cortex-M4 hold boot:
> - by Linux thanks to a sys config controller
> - by the secure context when the hold boot is protected.
> Since the introduction of the SCMI server, the use of the SMC call

What SCMI server?  Does this means stm32 is now able to use SCMI to manage the
remote processor hold boot?  If so, that is what I should find in this
changelog.  Otherwise this changelog needs to be re-written. 

> is deprecated. If the trust zone is activated, the management of the
> hold boot must be done by the secure context thanks to a SCMI reset
> controller.
> 
> This patch cleans-up the code related to the SMC call, replaced by
> the SCMI server.
> 
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
> ---
>  drivers/remoteproc/stm32_rproc.c | 34 ++------------------------------
>  1 file changed, 2 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c
> index 7d782ed9e589..4be651e734ee 100644
> --- a/drivers/remoteproc/stm32_rproc.c
> +++ b/drivers/remoteproc/stm32_rproc.c
> @@ -5,7 +5,6 @@
>   *          Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics.
>   */
>  
> -#include <linux/arm-smccc.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
> @@ -88,7 +87,6 @@ struct stm32_rproc {
>  	struct stm32_rproc_mem *rmems;
>  	struct stm32_mbox mb[MBOX_NB_MBX];
>  	struct workqueue_struct *workqueue;
> -	bool secured_soc;
>  	void __iomem *rsc_va;
>  };
>  
> @@ -398,20 +396,12 @@ static int stm32_rproc_set_hold_boot(struct rproc *rproc, bool hold)
>  {
>  	struct stm32_rproc *ddata = rproc->priv;
>  	struct stm32_syscon hold_boot = ddata->hold_boot;
> -	struct arm_smccc_res smc_res;
>  	int val, err;
>  
>  	val = hold ? HOLD_BOOT : RELEASE_BOOT;
>  
> -	if (IS_ENABLED(CONFIG_HAVE_ARM_SMCCC) && ddata->secured_soc) {
> -		arm_smccc_smc(STM32_SMC_RCC, STM32_SMC_REG_WRITE,
> -			      hold_boot.reg, val, 0, 0, 0, 0, &smc_res);
> -		err = smc_res.a0;
> -	} else {
> -		err = regmap_update_bits(hold_boot.map, hold_boot.reg,
> -					 hold_boot.mask, val);
> -	}
> -
> +	err = regmap_update_bits(hold_boot.map, hold_boot.reg,
> +				 hold_boot.mask, val);
>  	if (err)
>  		dev_err(&rproc->dev, "failed to set hold boot\n");
>  
> @@ -680,8 +670,6 @@ static int stm32_rproc_parse_dt(struct platform_device *pdev,
>  {
>  	struct device *dev = &pdev->dev;
>  	struct device_node *np = dev->of_node;
> -	struct stm32_syscon tz;
> -	unsigned int tzen;
>  	int err, irq;
>  
>  	irq = platform_get_irq(pdev, 0);
> @@ -710,24 +698,6 @@ static int stm32_rproc_parse_dt(struct platform_device *pdev,
>  		return dev_err_probe(dev, PTR_ERR(ddata->rst),
>  				     "failed to get mcu_reset\n");
>  
> -	/*
> -	 * if platform is secured the hold boot bit must be written by
> -	 * smc call and read normally.
> -	 * if not secure the hold boot bit could be read/write normally
> -	 */
> -	err = stm32_rproc_get_syscon(np, "st,syscfg-tz", &tz);
> -	if (err) {
> -		dev_err(dev, "failed to get tz syscfg\n");
> -		return err;
> -	}

If I was to do a bisect here, I would not be able to boot boards that have a
trustzone.  Add the new functionality and then remove the old one.

> -
> -	err = regmap_read(tz.map, tz.reg, &tzen);
> -	if (err) {
> -		dev_err(dev, "failed to read tzen\n");
> -		return err;
> -	}
> -	ddata->secured_soc = tzen & tz.mask;
> -
>  	err = stm32_rproc_get_syscon(np, "st,syscfg-holdboot",
>  				     &ddata->hold_boot);
>  	if (err) {
> -- 
> 2.25.1
> 

  reply	other threads:[~2023-04-05 17:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31 15:46 [PATCH 0/5] stm32mp15: update remoteproc to support SCMI Device tree Arnaud Pouliquen
2023-03-31 15:46 ` [PATCH 1/5] dt-bindings: remoteproc: st,stm32-rproc: Rework reset declarations Arnaud Pouliquen
2023-03-31 15:46 ` [PATCH 2/5] ARM: dts: stm32: Remove the st,syscfg-tz property Arnaud Pouliquen
2023-04-04 15:33   ` Arnaud POULIQUEN
2023-03-31 15:46 ` [PATCH 3/5] remoteproc: stm32: Clean-up the management of the hold boot by SMC call Arnaud Pouliquen
2023-04-05 17:55   ` Mathieu Poirier [this message]
2023-03-31 15:46 ` [PATCH 4/5] remoteproc: stm32: Allow hold boot management by the SCMI reset controller Arnaud Pouliquen
2023-04-04  4:55   ` Peng Fan
2023-04-04 15:15     ` Arnaud POULIQUEN
2023-04-06  5:16       ` Peng Fan
2023-04-06  7:27         ` Alexandre TORGUE
2023-04-05 18:01   ` Mathieu Poirier
2023-04-06 11:11     ` Arnaud POULIQUEN
2023-03-31 15:46 ` [PATCH 5/5] ARM: dts: stm32: fix m4_rproc references to use scmi Arnaud Pouliquen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230405175518.GC3812912@p14s \
    --to=mathieu.poirier@linaro.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andersson@kernel.org \
    --cc=arnaud.pouliquen@foss.st.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).