Skip to content
  • Grygorii Strashko's avatar
    ARM: 8253/1: mm: use phys_addr_t type in map_lowmem() for kernel mem region · ac084688
    Grygorii Strashko authored
    
    
    Now local variables kernel_x_start and kernel_x_end defined using
    'unsigned long' type which is wrong because they represent physical
    memory range and will be calculated wrongly if LPAE is enabled.
    As result, all following code in map_lowmem() will not work correctly.
    
    For example, Keystone 2 boot is broken because
     kernel_x_start == 0x0000 0000
     kernel_x_end   == 0x0080 0000
    
    instead of
     kernel_x_start == 0x0000 0008 0000 0000
     kernel_x_end   == 0x0000 0008 0080 0000
    and as result whole low memory will be mapped with MT_MEMORY_RW
    permissions by code (start > kernel_x_end):
    		} else if (start >= kernel_x_end) {
    			map.pfn = __phys_to_pfn(start);
    			map.virtual = __phys_to_virt(start);
    			map.length = end - start;
    			map.type = MT_MEMORY_RW;
    
    			create_mapping(&map);
    		}
    
    Hence, fix it by using phys_addr_t type for variables kernel_x_start
    and kernel_x_end.
    
    Tested-by: default avatarMurali Karicheri <m-karicheri2@ti.com>
    Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@linaro.org>
    Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
    ac084688