forked from Mirrors/opensbi
		
	platform/lib: Allow the OS to map the regions that are protected by PMP
This is achieved by removing the 'no-map' property from the 'reserved-memory' node when PMP is present, otherwise we keep it as it offers a small protection if the OS does not map this region at all. A new callback in platform_override is introduced and allows to fixup the device-tree. It is used here to override this new default behaviour on SiFive Fu540 platforms that has an erratum that prevents S-mode software to access a PMP protected region using 1GB page table mapping. If PMP is present, telling the OS not to map the reserved regions does not add much protection since it only avoids access to regions that are already protected by PMP. But by not allowing the OS to map those regions, it creates holes in the OS system memory map and prevents the use of hugepages which would generate, among other benefits, less TLB miss. Signed-off-by: Alexandre Ghiti <alex@ghiti.fr> Reviewed-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
		
				
					committed by
					
						
						Anup Patel
					
				
			
			
				
	
			
			
			
						parent
						
							e2c3f01af4
						
					
				
				
					commit
					6966ad0abe
				
			@@ -47,6 +47,20 @@ void fdt_plic_fixup(void *fdt, const char *compat);
 | 
			
		||||
 */
 | 
			
		||||
int fdt_reserved_memory_fixup(void *fdt);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Fix up the reserved memory subnodes in the device tree
 | 
			
		||||
 *
 | 
			
		||||
 * This routine adds the no-map property to the reserved memory subnodes so
 | 
			
		||||
 * that the OS does not map those PMP protected memory regions.
 | 
			
		||||
 *
 | 
			
		||||
 * Platform codes must call this helper in their final_init() after fdt_fixups()
 | 
			
		||||
 * if the OS should not map the PMP protected reserved regions.
 | 
			
		||||
 *
 | 
			
		||||
 * @param fdt: device tree blob
 | 
			
		||||
 * @return zero on success and -ve on failure
 | 
			
		||||
 */
 | 
			
		||||
int fdt_reserved_memory_nomap_fixup(void *fdt);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * General device tree fix-up
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user