@@ -127,7 +127,7 @@ static mpid_t mem_vmpu_get_entry_by_addr(struct addr_space* as, vaddr_t addr)
127127 return mpid ;
128128}
129129
130- static void as_init_boot_regions (void )
130+ static void mem_init_boot_regions (void )
131131{
132132 /**
133133 * Add hypervisor mpu entries set up during boot to the vmpu:
@@ -142,7 +142,6 @@ static void as_init_boot_regions(void)
142142 vaddr_t image_end = (vaddr_t )& _image_end ;
143143
144144 struct mp_region mpr ;
145- mpid_t mpid = 0 ;
146145
147146 bool separate_noload_region = image_load_end != image_noload_start ;
148147 vaddr_t first_region_end = separate_noload_region ? image_load_end : image_end ;
@@ -153,8 +152,7 @@ static void as_init_boot_regions(void)
153152 .mem_flags = PTE_HYP_FLAGS ,
154153 .as_sec = SEC_HYP_IMAGE ,
155154 };
156- mem_vmpu_set_entry (& cpu ()-> as , mpid , & mpr );
157- mpid ++ ;
155+ mem_map (& cpu ()-> as , & mpr , false, true);
158156
159157 if (separate_noload_region ) {
160158 mpr = (struct mp_region ){
@@ -163,8 +161,7 @@ static void as_init_boot_regions(void)
163161 .mem_flags = PTE_HYP_FLAGS ,
164162 .as_sec = SEC_HYP_IMAGE ,
165163 };
166- mem_vmpu_set_entry (& cpu ()-> as , mpid , & mpr );
167- mpid ++ ;
164+ mem_map (& cpu ()-> as , & mpr , false, true);
168165 }
169166
170167 mpr = (struct mp_region ){
@@ -173,15 +170,15 @@ static void as_init_boot_regions(void)
173170 .mem_flags = PTE_HYP_FLAGS ,
174171 .as_sec = SEC_HYP_PRIVATE ,
175172 };
176- mem_vmpu_set_entry (& cpu ()-> as , mpid , & mpr );
177- mpid ++ ;
173+ mem_map (& cpu ()-> as , & mpr , false, true);
178174}
179175
180176void mem_prot_init ()
181177{
182178 mpu_init ();
183179 as_init (& cpu ()-> as , AS_HYP , HYP_ASID , BIT_MASK (0 , PLAT_CPU_NUM ), 0 );
184- as_init_boot_regions ();
180+ mem_init_boot_regions ();
181+ mpu_enable ();
185182}
186183
187184size_t mem_cpu_boot_alloc_size ()
0 commit comments