mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] bus: imx-aipstz: set default value for opacr registers
@ 2026-01-23  8:48 Shengjiu Wang
  2026-01-23  9:14 ` Daniel Baluta
  2026-01-23 10:08 ` Laurentiu Mihalcea
  0 siblings, 2 replies; 5+ messages in thread
From: Shengjiu Wang @ 2026-01-23  8:48 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, 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 apis bus, so set default
value for all opacr registers, that the peripheral does not require
supervisor privilege level for accesses.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 drivers/bus/imx-aipstz.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c
index 5fdf377f5d06..b6cb47c06900 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[] = {
@@ -84,6 +99,11 @@ static const struct dev_pm_ops imx_aipstz_pm_ops = {
  */
 static const struct imx_aipstz_config imx8mp_aipstz_default_cfg = {
 	.mpr0 = 0x77777777,
+	.opacr0 = 0x0,
+	.opacr1 = 0x0,
+	.opacr2 = 0x0,
+	.opacr3 = 0x0,
+	.opacr4 = 0x0,
 };
 
 static const struct of_device_id imx_aipstz_of_ids[] = {
-- 
2.34.1


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

* Re: [PATCH] bus: imx-aipstz: set default value for opacr registers
  2026-01-23  8:48 [PATCH] bus: imx-aipstz: set default value for opacr registers Shengjiu Wang
@ 2026-01-23  9:14 ` Daniel Baluta
  2026-01-23  9:59   ` Shengjiu Wang
  2026-01-23 10:08 ` Laurentiu Mihalcea
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Baluta @ 2026-01-23  9:14 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/23/26 10:48, Shengjiu Wang wrote:
> The sdma script app_2_mcu needs the permission to access the peripheral
> devices, 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 apis bus, so set default
> value for all opacr registers, that the peripheral does not require
> supervisor privilege level for accesses.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
>  drivers/bus/imx-aipstz.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
<snip>
>  static const struct of_device_id imx_aipstz_match_table[] = {
> @@ -84,6 +99,11 @@ static const struct dev_pm_ops imx_aipstz_pm_ops = {
>   */
>  static const struct imx_aipstz_config imx8mp_aipstz_default_cfg = {
>  	.mpr0 = 0x77777777,
> +	.opacr0 = 0x0,
> +	.opacr1 = 0x0,
> +	.opacr2 = 0x0,
> +	.opacr3 = 0x0,
> +	.opacr4 = 0x0,
>  };
>  
No need to zero these fields as they are zero by default being part of a global var.



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

* Re: [PATCH] bus: imx-aipstz: set default value for opacr registers
  2026-01-23  9:14 ` Daniel Baluta
@ 2026-01-23  9:59   ` Shengjiu Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Shengjiu Wang @ 2026-01-23  9:59 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: Shengjiu Wang, shawnguo, s.hauer, kernel, festevam,
	laurentiu.mihalcea, daniel.baluta, imx, linux-arm-kernel,
	linux-kernel

On Fri, Jan 23, 2026 at 5:11 PM Daniel Baluta <daniel.baluta@oss.nxp.com> wrote:
>
> On 1/23/26 10:48, Shengjiu Wang wrote:
> > The sdma script app_2_mcu needs the permission to access the peripheral
> > devices, 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 apis bus, so set default
> > value for all opacr registers, that the peripheral does not require
> > supervisor privilege level for accesses.
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> >  drivers/bus/imx-aipstz.c | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> >
> <snip>
> >  static const struct of_device_id imx_aipstz_match_table[] = {
> > @@ -84,6 +99,11 @@ static const struct dev_pm_ops imx_aipstz_pm_ops = {
> >   */
> >  static const struct imx_aipstz_config imx8mp_aipstz_default_cfg = {
> >       .mpr0 = 0x77777777,
> > +     .opacr0 = 0x0,
> > +     .opacr1 = 0x0,
> > +     .opacr2 = 0x0,
> > +     .opacr3 = 0x0,
> > +     .opacr4 = 0x0,
> >  };
> >
> No need to zero these fields as they are zero by default being part of a global var.

right,  I will remove them.

Best regards
Shengjiu Wang
>
>

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

* Re: [PATCH] bus: imx-aipstz: set default value for opacr registers
  2026-01-23  8:48 [PATCH] bus: imx-aipstz: set default value for opacr registers Shengjiu Wang
  2026-01-23  9:14 ` Daniel Baluta
@ 2026-01-23 10:08 ` Laurentiu Mihalcea
  2026-01-26  2:40   ` Shengjiu Wang
  1 sibling, 1 reply; 5+ messages in thread
From: Laurentiu Mihalcea @ 2026-01-23 10:08 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/23/2026 12:48 AM, Shengjiu Wang wrote:
> The sdma script app_2_mcu needs the permission to access the peripheral
> devices, 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 apis bus, so set default
> value for all opacr registers, that the peripheral does not require
> supervisor privilege level for accesses.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
>  drivers/bus/imx-aipstz.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)


Hey SJ,


I'd be interested in explaining the situation a bit better in the commit message.

The 2 most important pieces of information are, in my opinion:


1) SDMA2 transactions are set to user-mode in your particular case.

2) Your script doesn't use the peripheral interface (connected directly

to SPBA), which is why the SDMA2-issued transactions are subjected to

AIPSTZ5's security-related checks.


Of course, please feel free to correct me if I got something wrong.


Thanks,

Laurentiu


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

* Re: [PATCH] bus: imx-aipstz: set default value for opacr registers
  2026-01-23 10:08 ` Laurentiu Mihalcea
@ 2026-01-26  2:40   ` Shengjiu Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Shengjiu Wang @ 2026-01-26  2:40 UTC (permalink / raw)
  To: Laurentiu Mihalcea
  Cc: Shengjiu Wang, shawnguo, s.hauer, kernel, festevam,
	laurentiu.mihalcea, daniel.baluta, imx, linux-arm-kernel,
	linux-kernel

On Fri, Jan 23, 2026 at 6:08 PM Laurentiu Mihalcea
<laurentiumihalcea111@gmail.com> wrote:
>
>
> On 1/23/2026 12:48 AM, Shengjiu Wang wrote:
> > The sdma script app_2_mcu needs the permission to access the peripheral
> > devices, 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 apis bus, so set default
> > value for all opacr registers, that the peripheral does not require
> > supervisor privilege level for accesses.
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> >  drivers/bus/imx-aipstz.c | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
>
>
> Hey SJ,
>
>
> I'd be interested in explaining the situation a bit better in the commit message.
>
> The 2 most important pieces of information are, in my opinion:
>
>
> 1) SDMA2 transactions are set to user-mode in your particular case.
>
> 2) Your script doesn't use the peripheral interface (connected directly
>
> to SPBA), which is why the SDMA2-issued transactions are subjected to
>
> AIPSTZ5's security-related checks.

Thanks, will update them to commit message.

best regards
Shengjiu Wang
>
>
> Of course, please feel free to correct me if I got something wrong.
>
>
> Thanks,
>
> Laurentiu
>

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

end of thread, other threads:[~2026-01-26  2:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-23  8:48 [PATCH] bus: imx-aipstz: set default value for opacr registers Shengjiu Wang
2026-01-23  9:14 ` Daniel Baluta
2026-01-23  9:59   ` Shengjiu Wang
2026-01-23 10:08 ` Laurentiu Mihalcea
2026-01-26  2:40   ` Shengjiu Wang

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

all inboxes | Powered by JetHome®