diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2023-04-14 10:58:29 -0300 |
---|---|---|
committer | Leon Romanovsky <leon@kernel.org> | 2023-04-16 11:08:07 +0300 |
commit | 8d7c7c0eeb74281c846ef9231ce20536c79a99b4 (patch) | |
tree | b80b6fee2ff23604fd054ea29593ec8b6ece33c7 /drivers/infiniband/sw/siw/siw_qp_rx.c | |
parent | b2b1ddc457458fecd1c6f385baa9fbda5f0c63ad (diff) | |
download | linux-stable-8d7c7c0eeb74281c846ef9231ce20536c79a99b4.tar.gz linux-stable-8d7c7c0eeb74281c846ef9231ce20536c79a99b4.tar.bz2 linux-stable-8d7c7c0eeb74281c846ef9231ce20536c79a99b4.zip |
RDMA: Add ib_virt_dma_to_page()
Make it clearer what is going on by adding a function to go back from the
"virtual" dma_addr to a kva and another to a struct page. This is used in the
ib_uses_virt_dma() style drivers (siw, rxe, hfi, qib).
Call them instead of a naked casting and virt_to_page() when working with dma_addr
values encoded by the various ib_map functions.
This also fixes the virt_to_page() casting problem Linus Walleij has been
chasing.
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/0-v2-05ea785520ed+10-ib_virt_page_jgg@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'drivers/infiniband/sw/siw/siw_qp_rx.c')
-rw-r--r-- | drivers/infiniband/sw/siw/siw_qp_rx.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/infiniband/sw/siw/siw_qp_rx.c b/drivers/infiniband/sw/siw/siw_qp_rx.c index fd721cc19682..58bbf738e4e5 100644 --- a/drivers/infiniband/sw/siw/siw_qp_rx.c +++ b/drivers/infiniband/sw/siw/siw_qp_rx.c @@ -139,7 +139,7 @@ static int siw_rx_pbl(struct siw_rx_stream *srx, int *pbl_idx, break; bytes = min(bytes, len); - if (siw_rx_kva(srx, (void *)(uintptr_t)buf_addr, bytes) == + if (siw_rx_kva(srx, ib_virt_dma_to_ptr(buf_addr), bytes) == bytes) { copied += bytes; offset += bytes; @@ -487,7 +487,7 @@ int siw_proc_send(struct siw_qp *qp) mem_p = *mem; if (mem_p->mem_obj == NULL) rv = siw_rx_kva(srx, - (void *)(uintptr_t)(sge->laddr + frx->sge_off), + ib_virt_dma_to_ptr(sge->laddr + frx->sge_off), sge_bytes); else if (!mem_p->is_pbl) rv = siw_rx_umem(srx, mem_p->umem, @@ -852,7 +852,7 @@ int siw_proc_rresp(struct siw_qp *qp) if (mem_p->mem_obj == NULL) rv = siw_rx_kva(srx, - (void *)(uintptr_t)(sge->laddr + wqe->processed), + ib_virt_dma_to_ptr(sge->laddr + wqe->processed), bytes); else if (!mem_p->is_pbl) rv = siw_rx_umem(srx, mem_p->umem, sge->laddr + wqe->processed, |