@@ -847,11 +847,9 @@ int arch_mem_domain_init(struct k_mem_domain *domain)
847
847
return ret ;
848
848
}
849
849
850
- static int region_map_update (uint32_t * ptables , uintptr_t start ,
850
+ static void region_map_update (uint32_t * ptables , uintptr_t start ,
851
851
size_t size , uint32_t ring , uint32_t flags )
852
852
{
853
- int ret = 0 ;
854
-
855
853
for (size_t offset = 0 ; offset < size ; offset += CONFIG_MMU_PAGE_SIZE ) {
856
854
uint32_t * l2_table , pte ;
857
855
uint32_t page = start + offset ;
@@ -873,15 +871,11 @@ static int region_map_update(uint32_t *ptables, uintptr_t start,
873
871
874
872
xtensa_dtlb_vaddr_invalidate ((void * )page );
875
873
}
876
-
877
- return ret ;
878
874
}
879
875
880
- static inline int update_region (uint32_t * ptables , uintptr_t start ,
881
- size_t size , uint32_t ring , uint32_t flags ,
882
- uint32_t option )
876
+ static void update_region (uint32_t * ptables , uintptr_t start , size_t size ,
877
+ uint32_t ring , uint32_t flags , uint32_t option )
883
878
{
884
- int ret ;
885
879
k_spinlock_key_t key ;
886
880
887
881
key = k_spin_lock (& xtensa_mmu_lock );
@@ -901,13 +895,10 @@ static inline int update_region(uint32_t *ptables, uintptr_t start,
901
895
new_flags_uc = (flags & ~XTENSA_MMU_PTE_ATTR_CACHED_MASK );
902
896
new_flags = new_flags_uc | XTENSA_MMU_CACHED_WB ;
903
897
904
- ret = region_map_update (ptables , va , size , ring , new_flags );
905
-
906
- if (ret == 0 ) {
907
- ret = region_map_update (ptables , va_uc , size , ring , new_flags_uc );
908
- }
898
+ region_map_update (ptables , va , size , ring , new_flags );
899
+ region_map_update (ptables , va_uc , size , ring , new_flags_uc );
909
900
#else
910
- ret = region_map_update (ptables , start , size , ring , flags );
901
+ region_map_update (ptables , start , size , ring , flags );
911
902
#endif /* CONFIG_XTENSA_MMU_DOUBLE_MAP */
912
903
913
904
#if CONFIG_MP_MAX_NUM_CPUS > 1
@@ -918,14 +909,12 @@ static inline int update_region(uint32_t *ptables, uintptr_t start,
918
909
919
910
sys_cache_data_flush_and_invd_all ();
920
911
k_spin_unlock (& xtensa_mmu_lock , key );
921
-
922
- return ret ;
923
912
}
924
913
925
- static inline int reset_region (uint32_t * ptables , uintptr_t start , size_t size , uint32_t option )
914
+ static inline void reset_region (uint32_t * ptables , uintptr_t start , size_t size , uint32_t option )
926
915
{
927
- return update_region (ptables , start , size ,
928
- XTENSA_MMU_KERNEL_RING , XTENSA_MMU_PERM_W , option );
916
+ update_region (ptables , start , size ,
917
+ XTENSA_MMU_KERNEL_RING , XTENSA_MMU_PERM_W , option );
929
918
}
930
919
931
920
void xtensa_user_stack_perms (struct k_thread * thread )
@@ -950,8 +939,9 @@ int arch_mem_domain_partition_remove(struct k_mem_domain *domain,
950
939
struct k_mem_partition * partition = & domain -> partitions [partition_id ];
951
940
952
941
/* Reset the partition's region back to defaults */
953
- return reset_region (domain -> arch .ptables , partition -> start ,
954
- partition -> size , 0 );
942
+ reset_region (domain -> arch .ptables , partition -> start , partition -> size , 0 );
943
+
944
+ return 0 ;
955
945
}
956
946
957
947
int arch_mem_domain_partition_add (struct k_mem_domain * domain ,
@@ -961,14 +951,14 @@ int arch_mem_domain_partition_add(struct k_mem_domain *domain,
961
951
uint32_t ring = K_MEM_PARTITION_IS_USER (partition -> attr ) ? XTENSA_MMU_USER_RING :
962
952
XTENSA_MMU_KERNEL_RING ;
963
953
964
- return update_region (domain -> arch .ptables , partition -> start ,
965
- partition -> size , ring , partition -> attr , 0 );
954
+ update_region (domain -> arch .ptables , partition -> start ,
955
+ partition -> size , ring , partition -> attr , 0 );
956
+ return 0 ;
966
957
}
967
958
968
959
/* These APIs don't need to do anything */
969
960
int arch_mem_domain_thread_add (struct k_thread * thread )
970
961
{
971
- int ret = 0 ;
972
962
bool is_user , is_migration ;
973
963
uint32_t * old_ptables ;
974
964
struct k_mem_domain * domain ;
@@ -992,9 +982,7 @@ int arch_mem_domain_thread_add(struct k_thread *thread)
992
982
/* and reset thread's stack permission in
993
983
* the old page tables.
994
984
*/
995
- ret = reset_region (old_ptables ,
996
- thread -> stack_info .start ,
997
- thread -> stack_info .size , 0 );
985
+ reset_region (old_ptables , thread -> stack_info .start , thread -> stack_info .size , 0 );
998
986
}
999
987
1000
988
/* Need to switch to new page tables if this is
@@ -1018,7 +1006,7 @@ int arch_mem_domain_thread_add(struct k_thread *thread)
1018
1006
}
1019
1007
#endif
1020
1008
1021
- return ret ;
1009
+ return 0 ;
1022
1010
}
1023
1011
1024
1012
int arch_mem_domain_thread_remove (struct k_thread * thread )
@@ -1046,9 +1034,11 @@ int arch_mem_domain_thread_remove(struct k_thread *thread)
1046
1034
* adding it back to another. So there is no need to send TLB IPI
1047
1035
* at this point.
1048
1036
*/
1049
- return reset_region (domain -> arch .ptables ,
1050
- thread -> stack_info .start ,
1051
- thread -> stack_info .size , OPTION_NO_TLB_IPI );
1037
+ reset_region (domain -> arch .ptables ,
1038
+ thread -> stack_info .start ,
1039
+ thread -> stack_info .size , OPTION_NO_TLB_IPI );
1040
+
1041
+ return 0 ;
1052
1042
}
1053
1043
1054
1044
static bool page_validate (uint32_t * ptables , uint32_t page , uint8_t ring , bool write )
0 commit comments