]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/hns: Fix wrong PBL offset when VA is not aligned to PAGE_SIZE
authorXi Wang <wangxi11@huawei.com>
Tue, 14 Jul 2020 11:42:15 +0000 (19:42 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 16 Jul 2020 12:55:01 +0000 (09:55 -0300)
commit775327d1b260122de6223259b45fcfcb8165b83f
treec564b78965e77ab9da3489848e4bf54cf470290f
parent7cca815df23d7e2b7e628056b98273bceb75714f
RDMA/hns: Fix wrong PBL offset when VA is not aligned to PAGE_SIZE

ROCE uses "VA % buf_page_size" to caclulate the offset in the PBL's first
page, the actual PA corresponding to the MR's VA is equal to MR's PA plus
this offset. The first PA in PBL has already been aligned to PAGE_SIZE
after calling ib_umem_get(), but the MR's VA may not. If the buf_page_size
is smaller than the PAGE_SIZE, this will lead the HW to access the wrong
memory because the offset is smaller than expected.

Fixes: 4b11f6ea54ef ("RDMA/hns: Optimize PBL buffer allocation process")
Link: https://lore.kernel.org/r/1594726935-45666-1-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hns/hns_roce_mr.c