• Doug Meyer's avatar
    NTB: ntb_hw_switchtec: Fix peer BAR bug in switchtec_ntb_init_shared_mw · 140eb522
    Doug Meyer authored
    This resolves a bug which may incorrectly configure the peer host's
    LUT for shared memory window access. The code was using the local
    host's first BAR number, rather than the peer hosts's first BAR
    number, to determine what peer NT control register to program.
    
    The bug will cause the Switchtec NTB link to work only if both peers
    have the same first NTB BAR configured. In all other configurations,
    the link will not come up, failing silently.
    
    When both hosts have the same first BAR, the configuration works only
    because the first BAR numbers happent to be the same. When the hosts
    do not have the same first BAR, then the LUT translation will not be
    configured in the correct peer LUT and will not give the peer the
    shared memory window access required for the link to operate.
    Signed-off-by: default avatarDoug Meyer <dmeyer@gigaio.com>
    Reviewed-by: default avatarLogan Gunthorpe <logang@deltatee.com>
    Fixes: 678784a44ae8 ("NTB: switchtec_ntb: Initialize hardware for memory windows")
    Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
    140eb522
ntb_hw_switchtec.c 29.2 KB