forked from Mirrors/opensbi
		
	lib: sbi: Change the order of PMP initialization
Configure PMP at last when all other initializations have been done. Because if SMEPMP is detected, M-mode access to the S/U space will be rescinded. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
		
				
					committed by
					
						
						Anup Patel
					
				
			
			
				
	
			
			
			
						parent
						
							4a42a2347c
						
					
				
				
					commit
					f3fdd041ac
				
			@@ -356,13 +356,6 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)
 | 
			
		||||
		sbi_hart_hang();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	rc = sbi_hart_pmp_configure(scratch);
 | 
			
		||||
	if (rc) {
 | 
			
		||||
		sbi_printf("%s: PMP configure failed (error %d)\n",
 | 
			
		||||
			   __func__, rc);
 | 
			
		||||
		sbi_hart_hang();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Note: Platform final initialization should be after finalizing
 | 
			
		||||
	 * domains so that it sees correct domain assignment and PMP
 | 
			
		||||
@@ -392,6 +385,17 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)
 | 
			
		||||
 | 
			
		||||
	sbi_boot_print_hart(scratch, hartid);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Configure PMP at last because if SMEPMP is detected,
 | 
			
		||||
	 * M-mode access to the S/U space will be rescinded.
 | 
			
		||||
	 */
 | 
			
		||||
	rc = sbi_hart_pmp_configure(scratch);
 | 
			
		||||
	if (rc) {
 | 
			
		||||
		sbi_printf("%s: PMP configure failed (error %d)\n",
 | 
			
		||||
			   __func__, rc);
 | 
			
		||||
		sbi_hart_hang();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	wake_coldboot_harts(scratch, hartid);
 | 
			
		||||
 | 
			
		||||
	count = sbi_scratch_offset_ptr(scratch, init_count_offset);
 | 
			
		||||
@@ -445,11 +449,15 @@ static void __noreturn init_warm_startup(struct sbi_scratch *scratch,
 | 
			
		||||
	if (rc)
 | 
			
		||||
		sbi_hart_hang();
 | 
			
		||||
 | 
			
		||||
	rc = sbi_hart_pmp_configure(scratch);
 | 
			
		||||
	rc = sbi_platform_final_init(plat, false);
 | 
			
		||||
	if (rc)
 | 
			
		||||
		sbi_hart_hang();
 | 
			
		||||
 | 
			
		||||
	rc = sbi_platform_final_init(plat, false);
 | 
			
		||||
	/*
 | 
			
		||||
	 * Configure PMP at last because if SMEPMP is detected,
 | 
			
		||||
	 * M-mode access to the S/U space will be rescinded.
 | 
			
		||||
	 */
 | 
			
		||||
	rc = sbi_hart_pmp_configure(scratch);
 | 
			
		||||
	if (rc)
 | 
			
		||||
		sbi_hart_hang();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user