hujun260 opened a new pull request, #18158: URL: https://github.com/apache/nuttx/pull/18158
## Summary This pull request enhances the ARM64 Memory Protection Unit (MPU) and GIC infrastructure: 1. **Background region support**: Enable SCTLR_EL1.BR bit for simplified MPU configuration 2. **Region occupancy query**: Add mpu_usedregion() interface to query current MPU region utilization 3. **GIC simplification**: Remove unnecessary GIC single security state check on read-only register ## Changes **Commit 1: Enable MPU background region** - Add SCTLR_BR_BIT definition for background region enable - Set SCTLR_BR_BIT in arm64_mpu_enable() to activate background region - Background region provides default MAIR attributes for unmapped memory - Files: arm64_arch.h, arm64_mpu.c (+2 lines) **Commit 2: Add mpu_usedregion interface** - Add mpu_usedregion() function to count allocated MPU regions - Uses bitcount algorithm on CPU-specific g_mpu_region bitmap - Complements existing mpu_allocregion() and mpu_freeregion() functions - Files: arm64_mpu.c, arm64_mpu.h (+44 lines) **Commit 3: Remove GIC security state check** - Remove CONFIG_ARCH_SINGLE_SECURITY_STATE configuration check - GICD_CTLR.DS bit is read-only per ARM GIC specification - Simplifies initialization and removes unnecessary panic() path - Files: arm64_gicv3.c (-15 lines) ## Impact - **MPU Flexibility**: Background region enables simpler memory mapping strategies - **Resource Monitoring**: mpu_usedregion() enables tracking MPU region utilization - **Code Simplification**: Removing non-functional GIC check reduces complexity - **Hardware Alignment**: Respects ARM GIC specification for read-only registers ## Technical Details **Background Region:** The MPU background region provides default memory access policy for addresses not covered by explicit MPU regions, simplifying configuration. **Region Query:** ```c unsigned int used = mpu_usedregion(); // Useful for debugging region exhaustion and resource accounting -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
