Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: entropy: stm32 entropy driver add semaphore protection #72882

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FRASTM
Copy link
Collaborator

@FRASTM FRASTM commented May 16, 2024

When the PM is going to suspend mode, this change is adding a semaphore to protect the access to the RNG peripheral

Fixes #72640

Add a semaphore to protect the disable access to the RNG peripheral
when the PM is going to suspend mode.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue is that in release_rng following is done:

	entropy_stm32_suspend();
#if defined(CONFIG_SOC_SERIES_STM32WBX) || defined(CONFIG_STM32H7_DUAL_CORE)
	z_stm32_hsem_unlock(CFG_HW_RNG_SEMID);
#endif /* CONFIG_SOC_SERIES_STM32WBX || CONFIG_STM32H7_DUAL_CORE */

So current implementation will end up with 2 consecutive z_stm32_hsem_unlock.

To take this into account, what about:
Calling release_rng instead of entropy_stm32_suspend and call lock semaphore before calls in entropy_stm32_rng_pm_action.

(maybe some function renaming would be required in the end to make all this more clear)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problems with low power and entropy on STM32WB55
3 participants