Skip to content

Commit

Permalink
mpfs/mpfs_mm_init: Fix the section align mask checks
Browse files Browse the repository at this point in the history
The boundary-1 mask needs to be tested, not the alignment boundary
  • Loading branch information
pussuw authored and xiaoxiang781216 committed Nov 4, 2022
1 parent d4ba930 commit e239cd9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion arch/risc-v/src/common/riscv_mmu.h
Expand Up @@ -110,7 +110,8 @@

/* Minimum alignment requirement for any section of memory is 2MB */

#define RV_MMU_SECTION_ALIGN (RV_MMU_L2_PAGE_SIZE)
#define RV_MMU_SECTION_ALIGN (RV_MMU_L2_PAGE_SIZE)
#define RV_MMU_SECTION_ALIGN_MASK (RV_MMU_SECTION_ALIGN - 1)
#else
#error "Unsupported RISC-V MMU implementation selected"
#endif /* CONFIG_ARCH_MMU_TYPE_SV39 */
Expand Down
6 changes: 3 additions & 3 deletions arch/risc-v/src/mpfs/mpfs_mm_init.c
Expand Up @@ -215,9 +215,9 @@ void mpfs_kernel_mappings(void)
* handle unaligned L3 sections.
*/

ASSERT((KFLASH_START & RV_MMU_SECTION_ALIGN) == 0);
ASSERT((KSRAM_START & RV_MMU_SECTION_ALIGN) == 0);
ASSERT((PGPOOL_START & RV_MMU_SECTION_ALIGN) == 0);
ASSERT((KFLASH_START & RV_MMU_SECTION_ALIGN_MASK) == 0);
ASSERT((KSRAM_START & RV_MMU_SECTION_ALIGN_MASK) == 0);
ASSERT((PGPOOL_START & RV_MMU_SECTION_ALIGN_MASK) == 0);

/* Check that the L3 table is of sufficient size */

Expand Down

0 comments on commit e239cd9

Please sign in to comment.