OSDN Git Service

RDMA/hns: Get rid of virt_to_page and vmap calls after dma_alloc_coherent
authorWei Hu\(Xavier\) <xavier.huwei@huawei.com>
Tue, 28 Nov 2017 07:10:27 +0000 (15:10 +0800)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 1 Dec 2017 19:21:27 +0000 (12:21 -0700)
commitb1c158350968d6717ec1889f07ea3a89432e8574
treeed2aef3f6cce7be029ac48b4cb2e202c068bd85f
parentdb270c41900d39a388990701da3ee2971094ebaa
RDMA/hns: Get rid of virt_to_page and vmap calls after dma_alloc_coherent

In general dma_alloc_coherent() returns a CPU virtual address and
a DMA address, and we have no guarantee that the virtual address
is either in the linear map or vmalloc. It could be in  some other special
place. We have no guarantee that the underlying memory even has
an associated struct page at all.

In current code, there are incorrect usage as below:
dma_alloc_coherent + virt_to_page + vmap. There will probably
introduce coherency problem. This patch fixes it to get rid of
virt_to_page and vmap calls at Leon's suggestion. The related
link: https://lkml.org/lkml/2017/11/7/34
Fixes: 9a44353("IB/hns: Add driver files for hns RoCE driver")
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Shaobo Xu <xushaobo2@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Yixian Liu <liuyixian@huawei.com>
Signed-off-by: Xiping Zhang (Francis) <zhangxiping3@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/hns/hns_roce_alloc.c
drivers/infiniband/hw/hns/hns_roce_device.h