• Mike Rapoport's avatar
    arc: fix memory initialization for systems with two memory banks · 4af22ded
    Mike Rapoport authored
    Rework of memory map initialization broke initialization of ARC systems
    with two memory banks. Before these changes, memblock was not aware of
    nodes configuration and the memory map was always allocated from the
    "lowmem" bank. After the addition of node information to memblock, the core
    mm attempts to allocate the memory map for the "highmem" bank from its
    node. The access to this memory using __va() fails because it can be only
    accessed using kmap.
    
    Anther problem that was uncovered is that {min,max}_high_pfn are calculated
    from u64 high_mem_start variable which prevents truncation to 32-bit
    physical address and the PFN values are above the node and zone boundaries.
    
    Use phys_addr_t type for high_mem_start and high_mem_size to ensure
    correspondence between PFNs and highmem zone boundaries and reserve the
    entire highmem bank until mem_init() to avoid accesses to it before highmem
    is enabled.
    
    To test this:
    1. Enable HIGHMEM in ARC config
    2. Enable 2 memory banks in haps_hs.dts (uncomment the 2nd bank)
    
    Fixes: 51930df5 ("mm: free_area_init: allow defining max_zone_pfn in descending order")
    Cc: stable@vger.kernel.org   [5.8]
    Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
    Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
    [vgupta: added instructions to test highmem]
    4af22ded
init.c 4.84 KB