Skip to content

Conversation

fsammoura1980
Copy link
Contributor

Removes redundant calls to write_pmp_entries() from within conditional compilation blocks (CONFIG_PMP_STACK_GUARD, CONFIG_MULTITHREADING).

This change consolidates the logic to write the configured PMP entries into a single call at the end of the z_riscv_pmp_init() function. This simplifies the code, reduces redundancy, and ensures the PMP registers are updated once after all potential entries have been configured.

@zephyrbot zephyrbot added the area: RISCV RISCV Architecture (32-bit & 64-bit) label Oct 9, 2025
@fsammoura1980 fsammoura1980 force-pushed the consolidate_writes branch 3 times, most recently from 134fee0 to 97c6a63 Compare October 10, 2025 04:05
Removes redundant calls to write_pmp_entries() from within conditional
compilation blocks (CONFIG_PMP_STACK_GUARD, CONFIG_MULTITHREADING).

This change consolidates the logic to write the configured PMP entries
into a single call at the end of the z_riscv_pmp_init() function. This
simplifies the code, reduces redundancy, and ensures the PMP registers
are updated once after all potential entries have been configured.

Signed-off-by: Firas Sammoura <[email protected]>
@fsammoura1980
Copy link
Contributor Author

This PR will pass CQ once this PR is merged

Copy link

@jimmyzhe
Copy link
Contributor

jimmyzhe commented Oct 13, 2025

As #97314 (comment), this is needed to ensure kernel initialization doesn't violate the PMP configuration, including ROM protection, null pointer, and stack guard.

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

Labels

area: RISCV RISCV Architecture (32-bit & 64-bit)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants