mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	riscv: add a warning when physical memory address overflows
The part of physical memory that exceeds the size of the linear mapping will be discarded. When the system starts up normally, a warning message will be printed to prevent confusion caused by the mismatch between the system memory and the actual physical memory. Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com> Link: https://lore.kernel.org/r/20240814062625.19794-1-cuiyunhui@bytedance.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
This commit is contained in:
		
							parent
							
								
									b6de116e46
								
							
						
					
					
						commit
						101971298b
					
				
					 2 changed files with 6 additions and 2 deletions
				
			
		|  | @ -256,8 +256,12 @@ static void __init setup_bootmem(void) | |||
| 	 */ | ||||
| 	if (IS_ENABLED(CONFIG_64BIT) && IS_ENABLED(CONFIG_MMU)) { | ||||
| 		max_mapped_addr = __pa(PAGE_OFFSET) + KERN_VIRT_SIZE; | ||||
| 		if (memblock_end_of_DRAM() > max_mapped_addr) { | ||||
| 			memblock_cap_memory_range(phys_ram_base, | ||||
| 						  max_mapped_addr - phys_ram_base); | ||||
| 			pr_warn("Physical memory overflows the linear mapping size: region above %pa removed", | ||||
| 				&max_mapped_addr); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	/*
 | ||||
|  |  | |||
							
								
								
									
										
											BIN
										
									
								
								scripts/selinux/genheaders/genheaders
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								scripts/selinux/genheaders/genheaders
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in a new issue
	
	 Yunhui Cui
						Yunhui Cui