Skip to contentSkip to conversation

optee-os: Enable SW PRNG for OP-TEE in AM62X

PATCH In review Dhruva Gole 3 participants 4 messages Jan 17, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 optee-os: Enable SW PRNG for OP-TEE in AM62X

commit 98506a4a07363 ("optee-os: Update SRCREV for OP-TEE TRNG in AM62X")

Disables SW PRNG => Enabling Hardware RNG. This is breaking Suspend Resume on AM62xx EVM variants. To fix this keep using SOFTWARE_PRNG enabled as it was.

---

I haven't tested thoroughly using bitbake and built from scratch yet, however locally in my OPTEE Repo the command I run is
...
make -j14 CROSS_COMPILE64=aarch64-none-linux-gnu- PLATFORM=k3-am62x CFG_ARM64_core=y CFG_TEE_CORE_LOG_LEVEL=1 CFG_TEE_CORE_DEBUG=y CFG_WITH_SOFTWARE_PRNG=y
...
and this seems to get low power mode (suspend resume) functional for AM625 SK EVM that I am testing on.

 recipes-security/optee/optee-os_%.bbappend | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
recipes-security/optee/optee-os_%.bbappend +2 -2
index db9064deba27..83eb9c6a20c6 100644
@@ -6,8 +6,8 @@ DEPENDS_append_ti-soc = " python3-cryptography-native"
 
 EXTRA_OEMAKE_append_k3 = "${@ 'CFG_CONSOLE_UART='+ d.getVar('OPTEE_K3_USART') if d.getVar('OPTEE_K3_USART') else ''}"
 
-EXTRA_OEMAKE_append_am62xx-evm = " CFG_TEE_CORE_LOG_LEVEL=1"
-EXTRA_OEMAKE_append_am62xx-lp-evm = " CFG_TEE_CORE_LOG_LEVEL=1"
+EXTRA_OEMAKE_append_am62xx-evm = " CFG_WITH_SOFTWARE_PRNG=y CFG_TEE_CORE_LOG_LEVEL=1"
+EXTRA_OEMAKE_append_am62xx-lp-evm = " CFG_WITH_SOFTWARE_PRNG=y CFG_TEE_CORE_LOG_LEVEL=1"
 EXTRA_OEMAKE_append_am62axx-evm = " CFG_TEE_CORE_LOG_LEVEL=1"
 
 do_compile_prepend_ti-soc() {
Signature · 1 line
2.25.1
#1 lore raw
Quoted 10 lines · Dhruva Gole

commit 98506a4a07363 ("optee-os: Update SRCREV for OP-TEE TRNG in AM62X")

Disables SW PRNG => Enabling Hardware RNG. This is breaking Suspend Resume on AM62xx EVM variants. To fix this keep using SOFTWARE_PRNG enabled as it was.

---

Your subject tag is a bit off, I usually use:

--subject-prefix="meta-ti][dunfell][PATCH"

As for the patch, do we have any insight into why RNG use is causing issues with suspend/resume? I'm not seeing any suspend/resume hooks in the OPTEE RNG Linux driver, what all have you tried so far to fix the issue (outside of just disabling support like here, which should be a last resort).

Andrew

Quoted 29 lines

I haven't tested thoroughly using bitbake and built from scratch yet, however locally in my OPTEE Repo the command I run is
...
make -j14 CROSS_COMPILE64=aarch64-none-linux-gnu- PLATFORM=k3-am62x CFG_ARM64_core=y CFG_TEE_CORE_LOG_LEVEL=1 CFG_TEE_CORE_DEBUG=y CFG_WITH_SOFTWARE_PRNG=y
...
and this seems to get low power mode (suspend resume) functional for AM625 SK EVM that I am testing on.

  recipes-security/optee/optee-os_%.bbappend | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
recipes-security/optee/optee-os_%.bbappend +2 -2
index db9064deba27..83eb9c6a20c6 100644
@@ -6,8 +6,8 @@ DEPENDS_append_ti-soc = " python3-cryptography-native"
 
  EXTRA_OEMAKE_append_k3 = "${@ 'CFG_CONSOLE_UART='+ d.getVar('OPTEE_K3_USART') if d.getVar('OPTEE_K3_USART') else ''}"
 
-EXTRA_OEMAKE_append_am62xx-evm = " CFG_TEE_CORE_LOG_LEVEL=1"
-EXTRA_OEMAKE_append_am62xx-lp-evm = " CFG_TEE_CORE_LOG_LEVEL=1"
+EXTRA_OEMAKE_append_am62xx-evm = " CFG_WITH_SOFTWARE_PRNG=y CFG_TEE_CORE_LOG_LEVEL=1"
+EXTRA_OEMAKE_append_am62xx-lp-evm = " CFG_WITH_SOFTWARE_PRNG=y CFG_TEE_CORE_LOG_LEVEL=1"
  EXTRA_OEMAKE_append_am62axx-evm = " CFG_TEE_CORE_LOG_LEVEL=1"
 
  do_compile_prepend_ti-soc() {
#2 lore raw

+Kamlesh

Quoted 14 lines · Andrew Davis via lists.yoctoproject.org
Quoted 10 lines · Dhruva Gole

commit 98506a4a07363 ("optee-os: Update SRCREV for OP-TEE TRNG in AM62X")

Disables SW PRNG => Enabling Hardware RNG. This is breaking Suspend Resume on AM62xx EVM variants. To fix this keep using SOFTWARE_PRNG enabled as it was.

---

Your subject tag is a bit off, I usually use:

Quoted 7 lines

--subject-prefix="meta-ti][dunfell][PATCH"

As for the patch, do we have any insight into why RNG use is causing issues with suspend/resume? I'm not seeing any suspend/resume hooks in the OPTEE RNG Linux driver, what all have you tried so far to fix the issue (outside of just disabling support like here, which should be a last resort).

Andrew, Agreed on the investigation part. Kamlesh will be investigating this once back from vacation.

For now, this patch going to SW PRNG is unblocking LPM S/R driver validation and would prefer to go to this , and continue to investigate the HW RNG impact with S/R scenario.

Quoted 41 lines

Andrew

Quoted 23 lines

I haven't tested thoroughly using bitbake and built from scratch yet, however locally in my OPTEE Repo the command I run is
...
make -j14 CROSS_COMPILE64=aarch64-none-linux-gnu- PLATFORM=k3-am62x CFG_ARM64_core=y CFG_TEE_CORE_LOG_LEVEL=1 CFG_TEE_CORE_DEBUG=y CFG_WITH_SOFTWARE_PRNG=y
...
and this seems to get low power mode (suspend resume) functional for AM625 SK EVM that I am testing on.

  recipes-security/optee/optee-os_%.bbappend | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
recipes-security/optee/optee-os_%.bbappend +0 -0
index db9064deba27..83eb9c6a20c6 100644
@@ -6,8 +6,8 @@ DEPENDS_append_ti-soc = " python3-cryptography-native"

  EXTRA_OEMAKE_append_k3 = "${@ 'CFG_CONSOLE_UART='+ d.getVar('OPTEE_K3_USART') if d.getVar('OPTEE_K3_USART') else ''}"

recipes-security/optee/optee-os_%.bbappend +1 -2
-EXTRA_OEMAKE_append_am62xx-evm = " CFG_TEE_CORE_LOG_LEVEL=1"
-EXTRA_OEMAKE_append_am62xx-lp-evm = " CFG_TEE_CORE_LOG_LEVEL=1"
+EXTRA_OEMAKE_append_am62xx-evm = " CFG_WITH_SOFTWARE_PRNG=y 
Quoted 5 lines

CFG_TEE_CORE_LOG_LEVEL=1" +EXTRA_OEMAKE_append_am62xx-lp-evm = " CFG_WITH_SOFTWARE_PRNG=y CFG_TEE_CORE_LOG_LEVEL=1" EXTRA_OEMAKE_append_am62axx-evm = " CFG_TEE_CORE_LOG_LEVEL=1" do_compile_prepend_ti-soc() {

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#15577): https://lists.yoctoproject.org/g/meta-ti/message/15577
Mute This Topic: https://lists.yoctoproject.org/mt/96325420/2167429
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 25 lines · Praneeth

+Kamlesh

Quoted 14 lines · Andrew Davis via lists.yoctoproject.org
Quoted 10 lines · Dhruva Gole

commit 98506a4a07363 ("optee-os: Update SRCREV for OP-TEE TRNG in AM62X")

Disables SW PRNG => Enabling Hardware RNG. This is breaking Suspend Resume on AM62xx EVM variants. To fix this keep using SOFTWARE_PRNG enabled as it was.

---

Your subject tag is a bit off, I usually use:

Quoted 7 lines

--subject-prefix="meta-ti][dunfell][PATCH"

As for the patch, do we have any insight into why RNG use is causing issues with suspend/resume? I'm not seeing any suspend/resume hooks in the OPTEE RNG Linux driver, what all have you tried so far to fix the issue (outside of just disabling support like here, which should be a last resort).

Quoted 4 lines

Andrew, Agreed on the investigation part. Kamlesh will be investigating this once back from vacation.

For now, this patch going to SW PRNG is unblocking LPM S/R driver validation and would prefer to go to this , and continue to investigate the HW RNG impact with S/R scenario.

My only issue is that this unconditionally turns off this feature for AM62x users, would it work to instead disable the "optee" node in the lpmdemo.dts file until the driver can be fixed to support LPM?

Andrew

Quoted 40 lines
Quoted 40 lines

Andrew

Quoted 24 lines

I haven't tested thoroughly using bitbake and built from scratch yet, however locally in my OPTEE Repo the command I run is
...
make -j14 CROSS_COMPILE64=aarch64-none-linux-gnu- PLATFORM=k3-am62x CFG_ARM64_core=y CFG_TEE_CORE_LOG_LEVEL=1 CFG_TEE_CORE_DEBUG=y CFG_WITH_SOFTWARE_PRNG=y
...
and this seems to get low power mode (suspend resume) functional for AM625 SK EVM that I am testing on.

  recipes-security/optee/optee-os_%.bbappend | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
recipes-security/optee/optee-os_%.bbappend +0 -0
index db9064deba27..83eb9c6a20c6 100644
@@ -6,8 +6,8 @@ DEPENDS_append_ti-soc = " python3-cryptography-native"

  EXTRA_OEMAKE_append_k3 = "${@ 'CFG_CONSOLE_UART='+ d.getVar('OPTEE_K3_USART') if d.getVar('OPTEE_K3_USART') else ''}"

recipes-security/optee/optee-os_%.bbappend +2 -2
-EXTRA_OEMAKE_append_am62xx-evm = " CFG_TEE_CORE_LOG_LEVEL=1"
-EXTRA_OEMAKE_append_am62xx-lp-evm = " CFG_TEE_CORE_LOG_LEVEL=1"
+EXTRA_OEMAKE_append_am62xx-evm = " CFG_WITH_SOFTWARE_PRNG=y CFG_TEE_CORE_LOG_LEVEL=1"
+EXTRA_OEMAKE_append_am62xx-lp-evm = " CFG_WITH_SOFTWARE_PRNG=y CFG_TEE_CORE_LOG_LEVEL=1"
Quoted 2 lines

  EXTRA_OEMAKE_append_am62axx-evm = " CFG_TEE_CORE_LOG_LEVEL=1" do_compile_prepend_ti-soc() {

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#15577): https://lists.yoctoproject.org/g/meta-ti/message/15577
Mute This Topic: https://lists.yoctoproject.org/mt/96325420/2167429
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-