hw/rdma: Change host_virt to void *

To avoid compilation warnings on 32-bit machines:
rdma_backend.c: In function 'rdma_backend_create_mr':
rdma_backend.c:409:37: error: cast to pointer from integer of different
size [-Werror=int-to-pointer-cast]
	mr->ibmr = ibv_reg_mr(pd->ibpd, (void *)addr, length, access);

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180322095220.9976-2-yuval.shaia@oracle.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
This commit is contained in:
Yuval Shaia 2018-03-22 11:52:18 +02:00 committed by Marcel Apfelbaum
parent 197053e212
commit 9bbb8d3577
4 changed files with 11 additions and 11 deletions

View File

@ -222,7 +222,7 @@ static int build_host_sge_array(RdmaDeviceResources *rdma_dev_res,
return VENDOR_ERR_INVLKEY | ssge[ssge_idx].lkey; return VENDOR_ERR_INVLKEY | ssge[ssge_idx].lkey;
} }
dsge->addr = mr->user_mr.host_virt + ssge[ssge_idx].addr - dsge->addr = (uintptr_t)mr->user_mr.host_virt + ssge[ssge_idx].addr -
mr->user_mr.guest_start; mr->user_mr.guest_start;
dsge->length = ssge[ssge_idx].length; dsge->length = ssge[ssge_idx].length;
dsge->lkey = rdma_backend_mr_lkey(&mr->backend_mr); dsge->lkey = rdma_backend_mr_lkey(&mr->backend_mr);
@ -401,12 +401,12 @@ void rdma_backend_destroy_pd(RdmaBackendPD *pd)
} }
} }
int rdma_backend_create_mr(RdmaBackendMR *mr, RdmaBackendPD *pd, uint64_t addr, int rdma_backend_create_mr(RdmaBackendMR *mr, RdmaBackendPD *pd, void *addr,
size_t length, int access) size_t length, int access)
{ {
pr_dbg("addr=0x%lx\n", addr); pr_dbg("addr=0x%p\n", addr);
pr_dbg("len=%ld\n", length); pr_dbg("len=%ld\n", length);
mr->ibmr = ibv_reg_mr(pd->ibpd, (void *)addr, length, access); mr->ibmr = ibv_reg_mr(pd->ibpd, addr, length, access);
if (mr->ibmr) { if (mr->ibmr) {
pr_dbg("lkey=0x%x\n", mr->ibmr->lkey); pr_dbg("lkey=0x%x\n", mr->ibmr->lkey);
pr_dbg("rkey=0x%x\n", mr->ibmr->rkey); pr_dbg("rkey=0x%x\n", mr->ibmr->rkey);

View File

@ -61,7 +61,7 @@ int rdma_backend_query_port(RdmaBackendDev *backend_dev,
int rdma_backend_create_pd(RdmaBackendDev *backend_dev, RdmaBackendPD *pd); int rdma_backend_create_pd(RdmaBackendDev *backend_dev, RdmaBackendPD *pd);
void rdma_backend_destroy_pd(RdmaBackendPD *pd); void rdma_backend_destroy_pd(RdmaBackendPD *pd);
int rdma_backend_create_mr(RdmaBackendMR *mr, RdmaBackendPD *pd, uint64_t addr, int rdma_backend_create_mr(RdmaBackendMR *mr, RdmaBackendPD *pd, void *addr,
size_t length, int access); size_t length, int access);
void rdma_backend_destroy_mr(RdmaBackendMR *mr); void rdma_backend_destroy_mr(RdmaBackendMR *mr);

View File

@ -146,7 +146,7 @@ int rdma_rm_alloc_mr(RdmaDeviceResources *dev_res, uint32_t pd_handle,
RdmaRmMR *mr; RdmaRmMR *mr;
int ret = 0; int ret = 0;
RdmaRmPD *pd; RdmaRmPD *pd;
uint64_t addr; void *addr;
size_t length; size_t length;
pd = rdma_rm_get_pd(dev_res, pd_handle); pd = rdma_rm_get_pd(dev_res, pd_handle);
@ -165,10 +165,10 @@ int rdma_rm_alloc_mr(RdmaDeviceResources *dev_res, uint32_t pd_handle,
/* TODO: This is my guess but not so sure that this needs to be /* TODO: This is my guess but not so sure that this needs to be
* done */ * done */
length = TARGET_PAGE_SIZE; length = TARGET_PAGE_SIZE;
addr = (uint64_t)g_malloc(length); addr = g_malloc(length);
} else { } else {
mr->user_mr.host_virt = (uint64_t) host_virt; mr->user_mr.host_virt = host_virt;
pr_dbg("host_virt=0x%lx\n", mr->user_mr.host_virt); pr_dbg("host_virt=0x%p\n", mr->user_mr.host_virt);
mr->user_mr.length = guest_length; mr->user_mr.length = guest_length;
pr_dbg("length=0x%lx\n", guest_length); pr_dbg("length=0x%lx\n", guest_length);
mr->user_mr.guest_start = guest_start; mr->user_mr.guest_start = guest_start;
@ -216,7 +216,7 @@ void rdma_rm_dealloc_mr(RdmaDeviceResources *dev_res, uint32_t mr_handle)
if (mr) { if (mr) {
rdma_backend_destroy_mr(&mr->backend_mr); rdma_backend_destroy_mr(&mr->backend_mr);
munmap((void *)mr->user_mr.host_virt, mr->user_mr.length); munmap(mr->user_mr.host_virt, mr->user_mr.length);
res_tbl_dealloc(&dev_res->mr_tbl, mr_handle); res_tbl_dealloc(&dev_res->mr_tbl, mr_handle);
} }
} }

View File

@ -56,7 +56,7 @@ typedef struct RdmaRmCQ {
} RdmaRmCQ; } RdmaRmCQ;
typedef struct RdmaRmUserMR { typedef struct RdmaRmUserMR {
uint64_t host_virt; void *host_virt;
uint64_t guest_start; uint64_t guest_start;
size_t length; size_t length;
} RdmaRmUserMR; } RdmaRmUserMR;