• Logan Gunthorpe's avatar
    RISC-V: Implement sparsemem · d95f1a54
    Logan Gunthorpe authored
    Implement sparsemem support for Risc-v which helps pave the
    way for memory hotplug and eventually P2P support.
    
    Introduce Kconfig options for virtual and physical address bits which
    are used to calculate the size of the vmemmap and set the
    MAX_PHYSMEM_BITS.
    
    The vmemmap is located directly before the VMALLOC region and sized
    such that we can allocate enough pages to populate all the virtual
    address space in the system (similar to the way it's done in arm64).
    
    During initialization, call memblocks_present() and sparse_init(),
    and provide a stub for vmemmap_populate() (all of which is similar to
    arm64).
    
    [greentime.hu@sifive.com: fixed pfn_valid, FIXADDR_TOP and fixed a bug
     rebasing onto v5.3]
    Signed-off-by: default avatarGreentime Hu <greentime.hu@sifive.com>
    Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
    Reviewed-by: default avatarPalmer Dabbelt <palmer@sifive.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Cc: Albert Ou <aou@eecs.berkeley.edu>
    Cc: Andrew Waterman <andrew@sifive.com>
    Cc: Olof Johansson <olof@lixom.net>
    Cc: Michael Clark <michaeljclark@mac.com>
    Cc: Rob Herring <robh@kernel.org>
    Cc: Zong Li <zong@andestech.com>
    Reviewed-by: default avatarMike Rapoport <rppt@linux.ibm.com>
    [paul.walmsley@sifive.com: updated to apply; minor commit message
     reformat]
    Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
    d95f1a54
pgtable.h 11.7 KB