Skip to contentSkip to conversation

i.MX8M SNVS ONOFF key handling (secure system)

DISCUSSION Marco Felsch 2 participants 4 messages Jul 3, 2024 – Jul 15, 2024 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

Dear NXP team,

we do have the following situation:
- A verified boot (locked-down) system based on i.MX8MM and i.MX8MP
- The ONOFF pin is connected to an ext. MCU to initiate a shutdown
- The NPSWA_EN bit in HPCOMR is _not_ set

According the datasheet NXP introduced a new interrupt called "ipi_snvs_btn_int_b (button) interrupt" which can be enabled via HPCR register BTN_MASK bit. The interrupt level/edge trigger can be configured via the HPCR register BTN_CONFIG bit field. This interrupt can be cleared by _non_ privileged software e.g. Linux by writting an '1' to the BI bit (HPSR register).

Unfortunately I don't see how this interrupt is connected to the GIC. I can only see the snvs_lp_wrapper and snvs_hp_wrapper which do share the same IRQ number 4. According "Table 7-1. ARM Domain Interrupt Summary" IRQ 4 is triggered if: "ON-OFF button press shorter than 5 secs (pulse event)". It seems like this IRQ is controlled by the set_pwr_off_irq (SPOF) but to clear this IRQ from Linux we need to set the NPSWA_EN bit.

Now my question is how the ipi_snvs_btn_int_b irq is supposed to work?

Regards,
Marco

#1 lore raw

Hi Marco

Quoted 26 lines

Subject: i.MX8M SNVS ONOFF key handling (secure system)

Dear NXP team,

we do have the following situation:
- A verified boot (locked-down) system based on i.MX8MM and
i.MX8MP
- The ONOFF pin is connected to an ext. MCU to initiate a shutdown
- The NPSWA_EN bit in HPCOMR is _not_ set

According the datasheet NXP introduced a new interrupt called "ipi_snvs_btn_int_b (button) interrupt" which can be enabled via HPCR register BTN_MASK bit. The interrupt level/edge trigger can be configured via the HPCR register BTN_CONFIG bit field. This interrupt can be cleared by _non_ privileged software e.g. Linux by writting an '1' to the BI bit (HPSR register).

Unfortunately I don't see how this interrupt is connected to the GIC. I can only see the snvs_lp_wrapper and snvs_hp_wrapper which do share the same IRQ number 4. According "Table 7-1. ARM Domain Interrupt Summary"
IRQ 4 is triggered if: "ON-OFF button press shorter than 5 secs (pulse event)". It seems like this IRQ is controlled by the set_pwr_off_irq (SPOF) but to clear this IRQ from Linux we need to set the NPSWA_EN bit.

Quoted 2 lines

Now my question is how the ipi_snvs_btn_int_b irq is supposed to work?

My understanding is (set_pwr_off_irq | ipi_snvs_btn_int_b) connects to IRQ 4.

For more details, I need check with our Design team. Will update if I have more information.

Regards,
Peng.

Quoted 3 lines

Regards,
Marco

#2 lore raw

Hi Peng,

Quoted 28 lines · Peng Fan

Hi Marco

Quoted 26 lines

Subject: i.MX8M SNVS ONOFF key handling (secure system)

Dear NXP team,

we do have the following situation:
- A verified boot (locked-down) system based on i.MX8MM and
i.MX8MP
- The ONOFF pin is connected to an ext. MCU to initiate a shutdown
- The NPSWA_EN bit in HPCOMR is _not_ set

According the datasheet NXP introduced a new interrupt called "ipi_snvs_btn_int_b (button) interrupt" which can be enabled via HPCR register BTN_MASK bit. The interrupt level/edge trigger can be configured via the HPCR register BTN_CONFIG bit field. This interrupt can be cleared by _non_ privileged software e.g. Linux by writting an '1' to the BI bit (HPSR register).

Unfortunately I don't see how this interrupt is connected to the GIC. I can only see the snvs_lp_wrapper and snvs_hp_wrapper which do share the same IRQ number 4. According "Table 7-1. ARM Domain Interrupt Summary"
IRQ 4 is triggered if: "ON-OFF button press shorter than 5 secs (pulse event)". It seems like this IRQ is controlled by the set_pwr_off_irq (SPOF) but to clear this IRQ from Linux we need to set the NPSWA_EN bit.

Quoted 5 lines
Quoted 2 lines

Now my question is how the ipi_snvs_btn_int_b irq is supposed to work?

My understanding is (set_pwr_off_irq | ipi_snvs_btn_int_b) connects to IRQ 4.

That was my assumption too.

Quoted 2 lines

For more details, I need check with our Design team. Will update if I have more information.

Thank you!

Regards,
Marco

#3 lore raw
Quoted 38 lines

Subject: Re: i.MX8M SNVS ONOFF key handling (secure system)

Hi Peng,

Quoted 8 lines · Peng Fan

Hi Marco

Quoted 6 lines

Subject: i.MX8M SNVS ONOFF key handling (secure system)

Dear NXP team,

we do have the following situation:
- A verified boot (locked-down) system based on i.MX8MM and

i.MX8MP

Quoted 1 line
Quoted 1 line

- The ONOFF pin is connected to an ext. MCU to initiate a

shutdown

Quoted 5 lines
Quoted 5 lines

- The NPSWA_EN bit in HPCOMR is _not_ set

According the datasheet NXP introduced a new interrupt called "ipi_snvs_btn_int_b (button) interrupt" which can be enabled via HPCR register BTN_MASK bit. The interrupt level/edge trigger can

be

Quoted 6 lines
Quoted 6 lines

configured via the HPCR register BTN_CONFIG bit field. This interrupt can be cleared by _non_ privileged software e.g. Linux by writting an '1' to the BI bit (HPSR register).

Unfortunately I don't see how this interrupt is connected to the GIC. I can only see the snvs_lp_wrapper and snvs_hp_wrapper

which do

Quoted 6 lines
Quoted 6 lines

share the same IRQ number 4. According "Table 7-1. ARM Domain Interrupt Summary"
IRQ 4 is triggered if: "ON-OFF button press shorter than 5 secs (pulse event)". It seems like this IRQ is controlled by the set_pwr_off_irq
(SPOF) but to clear this IRQ from Linux we need to set the

NPSWA_EN

Quoted 2 lines
Quoted 2 lines

bit.

Quoted 11 lines
Quoted 4 lines
Quoted 2 lines

Now my question is how the ipi_snvs_btn_int_b irq is supposed to work?

My understanding is (set_pwr_off_irq | ipi_snvs_btn_int_b) connects

to

Quoted 1 line

IRQ 4.

That was my assumption too.

Quoted 2 lines

For more details, I need check with our Design team. Will update if I have more information.

Sorry for late reply.

There is no debounce for ipi_snvs_btn_int_b, so if interrupt detected on PAD, the interrupt will be triggered immediately.
And this interrupt has different trigger types. Level or edge

There is debounce for set_pwr_off_irq. And this should be level trigger.

So there is possibility that ipi_snvs_btn_int_b could be triggered before set_pwr_off_irq. Then there is a short window for user to do some action, but my understanding is this not make much sense, unless needs edge trigger interrupt using btn.

Regards,
Peng.

Quoted 5 lines

Thank you!

Regards,
Marco