Skip to content
  • Logan Gunthorpe's avatar
    NTB: switchtec_ntb: Add memory window support · 87d11e64
    Logan Gunthorpe authored
    
    
    The Switchtec hardware has two types of memory windows: LUTs and Direct.
    The first area in each BAR is for LUT windows and the remaining area is
    for the direct region. The total number of LUT entries is set by a
    configuration setting in hardware and they all must be the same
    size. (This is fixed by switchtec_ntb to be 64K.)
    
    switchtec_ntb enables the LUTs only for the first BAR and enables the
    highest power of two possible. Seeing the LUTs are at the beginning of
    the BAR, the direct memory window's alignment is affected. Therefore,
    the maximum direct memory window size can not be greater than the number
    of LUTs times 64K. The direct window in other BARs will not have this
    restriction as the LUTs will not be enabled there. LUTs will only be
    exposed through the NTB API if the use_lut_mw parameter is set.
    
    Seeing the Switchtec hardware, by default, configures BARs to be 4G a
    module parameter is given to limit the size of the advertised memory
    windows. Higher layers tend to allocate the maximum BAR size and this
    has a tendency to fail when they try to allocate 4GB of contiguous
    memory.
    
    Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
    Reviewed-by: default avatarStephen Bates <sbates@raithlin.com>
    Reviewed-by: default avatarKurt Schwemmer <kurt.schwemmer@microsemi.com>
    Acked-by: default avatarAllen Hubbe <Allen.Hubbe@dell.com>
    Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
    87d11e64