diff mbox series

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

Message ID 20230117061257.341041-1-d-gole@ti.com
State Accepted
Delegated to: Ryan Eatmon
Headers show
Series [dunfell] optee-os: Enable SW PRNG for OP-TEE in AM62X | expand

Commit Message

Gole, Dhruva Jan. 17, 2023, 6:12 a.m. UTC
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.

Cc: vibhore@ti.com
Cc: Andrew Davis <afd@ti.com>
Signed-off-by: Dhruva Gole <d-gole@ti.com>
---

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(-)

Comments

Andrew Davis Jan. 17, 2023, 3:44 p.m. UTC | #1
On 1/17/23 12:12 AM, Dhruva Gole wrote:
> 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.
> 
> Cc: vibhore@ti.com
> Cc: Andrew Davis <afd@ti.com>
> Signed-off-by: Dhruva Gole <d-gole@ti.com>
> ---

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

> 
> 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(-)
> 
> diff --git a/recipes-security/optee/optee-os_%.bbappend b/recipes-security/optee/optee-os_%.bbappend
> index db9064deba27..83eb9c6a20c6 100644
> --- a/recipes-security/optee/optee-os_%.bbappend
> +++ b/recipes-security/optee/optee-os_%.bbappend
> @@ -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() {
Bajjuri, Praneeth Jan. 17, 2023, 8:46 p.m. UTC | #2
+Kamlesh

On 1/17/2023 9:44 AM, Andrew Davis via lists.yoctoproject.org wrote:
> On 1/17/23 12:12 AM, Dhruva Gole wrote:
>> 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.
>>
>> Cc: vibhore@ti.com
>> Cc: Andrew Davis <afd@ti.com>
>> Signed-off-by: Dhruva Gole <d-gole@ti.com>
>> ---
> 
> 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, 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.


> 
> Andrew
> 
>>
>> 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(-)
>>
>> diff --git a/recipes-security/optee/optee-os_%.bbappend 
>> b/recipes-security/optee/optee-os_%.bbappend
>> index db9064deba27..83eb9c6a20c6 100644
>> --- a/recipes-security/optee/optee-os_%.bbappend
>> +++ b/recipes-security/optee/optee-os_%.bbappend
>> @@ -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() {
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> 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: meta-ti+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub [praneeth@ti.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Andrew Davis Jan. 17, 2023, 9:45 p.m. UTC | #3
On 1/17/23 2:46 PM, Bajjuri, Praneeth wrote:
> +Kamlesh
> 
> On 1/17/2023 9:44 AM, Andrew Davis via lists.yoctoproject.org wrote:
>> On 1/17/23 12:12 AM, Dhruva Gole wrote:
>>> 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.
>>>
>>> Cc: vibhore@ti.com
>>> Cc: Andrew Davis <afd@ti.com>
>>> Signed-off-by: Dhruva Gole <d-gole@ti.com>
>>> ---
>>
>> 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, 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

> 
>>
>> Andrew
>>
>>>
>>> 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(-)
>>>
>>> diff --git a/recipes-security/optee/optee-os_%.bbappend b/recipes-security/optee/optee-os_%.bbappend
>>> index db9064deba27..83eb9c6a20c6 100644
>>> --- a/recipes-security/optee/optee-os_%.bbappend
>>> +++ b/recipes-security/optee/optee-os_%.bbappend
>>> @@ -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() {
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> 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: meta-ti+owner@lists.yoctoproject.org
>> Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub [praneeth@ti.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
diff mbox series

Patch

diff --git a/recipes-security/optee/optee-os_%.bbappend b/recipes-security/optee/optee-os_%.bbappend
index db9064deba27..83eb9c6a20c6 100644
--- a/recipes-security/optee/optee-os_%.bbappend
+++ b/recipes-security/optee/optee-os_%.bbappend
@@ -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() {