Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
* [PATCH v2] bus: imx-aipstz: set default value for opacr registers
@ 2026-01-26  9:11 Shengjiu Wang
  2026-01-26 14:47 ` Daniel Baluta
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Shengjiu Wang @ 2026-01-26  9:11 UTC (permalink / raw)
  To: shawnguo, s.hauer, kernel, festevam, laurentiu.mihalcea,
	daniel.baluta, imx, linux-arm-kernel, linux-kernel, shengjiu.wang

The sdma script app_2_mcu needs the permission to access the peripheral
devices:

1) SDMA2 transactions are set to user-mode in this particular case.
2) This type of script doesn't use the peripheral interface (connected
directly to SPBA), but it uses the peripheral DMA interface, then the
SDMA2-issued transactions are subjected to AIPSTZ5's security-related
checks.

So need to clear the Supervisor Protect bit of SPBA2, otherwise the sdma
script can't work. As the imx-aipstz is a common driver for all aips bus,
so set default value (zero) for all opacr registers.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
Changes in v2:
- refine the commit message
- remove the unneeded initialize value

 drivers/bus/imx-aipstz.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c
index 5fdf377f5d06..83371e5b35a2 100644
--- a/drivers/bus/imx-aipstz.c
+++ b/drivers/bus/imx-aipstz.c
@@ -11,9 +11,19 @@
 #include <linux/regmap.h>
 
 #define IMX_AIPSTZ_MPR0 0x0
+#define IMX_AIPSTZ_OPACR0 0x40
+#define IMX_AIPSTZ_OPACR1 0x44
+#define IMX_AIPSTZ_OPACR2 0x48
+#define IMX_AIPSTZ_OPACR3 0x4c
+#define IMX_AIPSTZ_OPACR4 0x50
 
 struct imx_aipstz_config {
 	u32 mpr0;
+	u32 opacr0;
+	u32 opacr1;
+	u32 opacr2;
+	u32 opacr3;
+	u32 opacr4;
 };
 
 struct imx_aipstz_data {
@@ -24,6 +34,11 @@ struct imx_aipstz_data {
 static void imx_aipstz_apply_default(struct imx_aipstz_data *data)
 {
 	writel(data->default_cfg->mpr0, data->base + IMX_AIPSTZ_MPR0);
+	writel(data->default_cfg->opacr0, data->base + IMX_AIPSTZ_OPACR0);
+	writel(data->default_cfg->opacr1, data->base + IMX_AIPSTZ_OPACR1);
+	writel(data->default_cfg->opacr2, data->base + IMX_AIPSTZ_OPACR2);
+	writel(data->default_cfg->opacr3, data->base + IMX_AIPSTZ_OPACR3);
+	writel(data->default_cfg->opacr4, data->base + IMX_AIPSTZ_OPACR4);
 }
 
 static const struct of_device_id imx_aipstz_match_table[] = {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] bus: imx-aipstz: set default value for opacr registers
  2026-01-26  9:11 [PATCH v2] bus: imx-aipstz: set default value for opacr registers Shengjiu Wang
@ 2026-01-26 14:47 ` Daniel Baluta
  2026-01-26 15:22 ` Laurentiu Mihalcea
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel Baluta @ 2026-01-26 14:47 UTC (permalink / raw)
  To: Shengjiu Wang, shawnguo, s.hauer, kernel, festevam,
	laurentiu.mihalcea, daniel.baluta, imx, linux-arm-kernel,
	linux-kernel, shengjiu.wang

On 1/26/26 11:11, Shengjiu Wang wrote:
> The sdma script app_2_mcu needs the permission to access the peripheral
> devices:
>
> 1) SDMA2 transactions are set to user-mode in this particular case.
> 2) This type of script doesn't use the peripheral interface (connected
> directly to SPBA), but it uses the peripheral DMA interface, then the
> SDMA2-issued transactions are subjected to AIPSTZ5's security-related
> checks.
>
> So need to clear the Supervisor Protect bit of SPBA2, otherwise the sdma
> script can't work. As the imx-aipstz is a common driver for all aips bus,
> so set default value (zero) for all opacr registers.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] bus: imx-aipstz: set default value for opacr registers
  2026-01-26  9:11 [PATCH v2] bus: imx-aipstz: set default value for opacr registers Shengjiu Wang
  2026-01-26 14:47 ` Daniel Baluta
@ 2026-01-26 15:22 ` Laurentiu Mihalcea
  2026-01-26 16:41 ` Frank Li
  2026-02-24 19:36 ` Frank Li
  3 siblings, 0 replies; 5+ messages in thread
From: Laurentiu Mihalcea @ 2026-01-26 15:22 UTC (permalink / raw)
  To: Shengjiu Wang, shawnguo, s.hauer, kernel, festevam,
	laurentiu.mihalcea, daniel.baluta, imx, linux-arm-kernel,
	linux-kernel, shengjiu.wang


On 1/26/2026 1:11 AM, Shengjiu Wang wrote:
> The sdma script app_2_mcu needs the permission to access the peripheral
> devices:
>
> 1) SDMA2 transactions are set to user-mode in this particular case.
> 2) This type of script doesn't use the peripheral interface (connected
> directly to SPBA), but it uses the peripheral DMA interface, then the
> SDMA2-issued transactions are subjected to AIPSTZ5's security-related
> checks.
>
> So need to clear the Supervisor Protect bit of SPBA2, otherwise the sdma
> script can't work. As the imx-aipstz is a common driver for all aips bus,
> so set default value (zero) for all opacr registers.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>


Reviewed-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] bus: imx-aipstz: set default value for opacr registers
  2026-01-26  9:11 [PATCH v2] bus: imx-aipstz: set default value for opacr registers Shengjiu Wang
  2026-01-26 14:47 ` Daniel Baluta
  2026-01-26 15:22 ` Laurentiu Mihalcea
@ 2026-01-26 16:41 ` Frank Li
  2026-02-24 19:36 ` Frank Li
  3 siblings, 0 replies; 5+ messages in thread
From: Frank Li @ 2026-01-26 16:41 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: shawnguo, s.hauer, kernel, festevam, laurentiu.mihalcea,
	daniel.baluta, imx, linux-arm-kernel, linux-kernel, shengjiu.wang

On Mon, Jan 26, 2026 at 05:11:56PM +0800, Shengjiu Wang wrote:
> The sdma script app_2_mcu needs the permission to access the peripheral
> devices:
>
> 1) SDMA2 transactions are set to user-mode in this particular case.
> 2) This type of script doesn't use the peripheral interface (connected
> directly to SPBA), but it uses the peripheral DMA interface, then the
> SDMA2-issued transactions are subjected to AIPSTZ5's security-related
> checks.
>
> So need to clear the Supervisor Protect bit of SPBA2, otherwise the sdma
> script can't work. As the imx-aipstz is a common driver for all aips bus,
> so set default value (zero) for all opacr registers.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Changes in v2:
> - refine the commit message
> - remove the unneeded initialize value
>
>  drivers/bus/imx-aipstz.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c
> index 5fdf377f5d06..83371e5b35a2 100644
> --- a/drivers/bus/imx-aipstz.c
> +++ b/drivers/bus/imx-aipstz.c
> @@ -11,9 +11,19 @@
>  #include <linux/regmap.h>
>
>  #define IMX_AIPSTZ_MPR0 0x0
> +#define IMX_AIPSTZ_OPACR0 0x40
> +#define IMX_AIPSTZ_OPACR1 0x44
> +#define IMX_AIPSTZ_OPACR2 0x48
> +#define IMX_AIPSTZ_OPACR3 0x4c
> +#define IMX_AIPSTZ_OPACR4 0x50
>
>  struct imx_aipstz_config {
>  	u32 mpr0;
> +	u32 opacr0;
> +	u32 opacr1;
> +	u32 opacr2;
> +	u32 opacr3;
> +	u32 opacr4;
>  };
>
>  struct imx_aipstz_data {
> @@ -24,6 +34,11 @@ struct imx_aipstz_data {
>  static void imx_aipstz_apply_default(struct imx_aipstz_data *data)
>  {
>  	writel(data->default_cfg->mpr0, data->base + IMX_AIPSTZ_MPR0);
> +	writel(data->default_cfg->opacr0, data->base + IMX_AIPSTZ_OPACR0);
> +	writel(data->default_cfg->opacr1, data->base + IMX_AIPSTZ_OPACR1);
> +	writel(data->default_cfg->opacr2, data->base + IMX_AIPSTZ_OPACR2);
> +	writel(data->default_cfg->opacr3, data->base + IMX_AIPSTZ_OPACR3);
> +	writel(data->default_cfg->opacr4, data->base + IMX_AIPSTZ_OPACR4);
>  }
>
>  static const struct of_device_id imx_aipstz_match_table[] = {
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] bus: imx-aipstz: set default value for opacr registers
  2026-01-26  9:11 [PATCH v2] bus: imx-aipstz: set default value for opacr registers Shengjiu Wang
                   ` (2 preceding siblings ...)
  2026-01-26 16:41 ` Frank Li
@ 2026-02-24 19:36 ` Frank Li
  3 siblings, 0 replies; 5+ messages in thread
From: Frank Li @ 2026-02-24 19:36 UTC (permalink / raw)
  To: shawnguo, s.hauer, kernel, festevam, laurentiu.mihalcea,
	daniel.baluta, imx, linux-arm-kernel, linux-kernel, shengjiu.wang,
	Shengjiu Wang
  Cc: Frank Li


On Mon, 26 Jan 2026 17:11:56 +0800, Shengjiu Wang wrote:
> The sdma script app_2_mcu needs the permission to access the peripheral
> devices:
>
> 1) SDMA2 transactions are set to user-mode in this particular case.
> 2) This type of script doesn't use the peripheral interface (connected
> directly to SPBA), but it uses the peripheral DMA interface, then the
> SDMA2-issued transactions are subjected to AIPSTZ5's security-related
> checks.
>
> [...]

Applied, thanks!

[1/1] bus: imx-aipstz: set default value for opacr registers

Best regards,
--
Frank Li <Frank.Li@nxp.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-02-24 19:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-26  9:11 [PATCH v2] bus: imx-aipstz: set default value for opacr registers Shengjiu Wang
2026-01-26 14:47 ` Daniel Baluta
2026-01-26 15:22 ` Laurentiu Mihalcea
2026-01-26 16:41 ` Frank Li
2026-02-24 19:36 ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox