From patchwork Thu Mar 22 09:52:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yuval Shaia X-Patchwork-Id: 10301123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ACF4C600F6 for ; Thu, 22 Mar 2018 09:53:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E56A29AE9 for ; Thu, 22 Mar 2018 09:53:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 925C029AFB; Thu, 22 Mar 2018 09:53:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6338129AFA for ; Thu, 22 Mar 2018 09:53:57 +0000 (UTC) Received: from localhost ([::1]:59715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eywuy-0004am-HU for patchwork-qemu-devel@patchwork.kernel.org; Thu, 22 Mar 2018 05:53:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eywtl-0003R8-9s for qemu-devel@nongnu.org; Thu, 22 Mar 2018 05:52:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eywtk-0000IG-6S for qemu-devel@nongnu.org; Thu, 22 Mar 2018 05:52:41 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:44570) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eywtf-0000Fu-2C; Thu, 22 Mar 2018 05:52:35 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2M9gvQT164674; Thu, 22 Mar 2018 09:52:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=lPbn1KkmRpjk7IvOQ68t0h+kzrJ3VI8Tat48ewUKLBw=; b=MNOHwYQXi6AnB1xGeSS7we1I425+qSkDy9/gXhYwkTIEqMOfpXONvS9QMCV5a7tSZ8EL Hi9KGrx3c5jcA+GhxjjCtHOk235jqI+5brOWVVh05sVkpxANlICMaNluZOfMvljgyTFJ OoNv0C7EIc+8zZ1+raOtJDdUQtuVG4MdVNytLSyWB4EK9hhjvW2Npov9ningnUlkAa5U ChyC96IgbqTZgn1T4HgZcG3TYQMvaP2KdCzqxLIZQHsHmMJCknhcsdqHoazFAZa+z+B9 vq6NxiGnm0NrxB8hc+2F0YPyNohBgEpndhQ8vq9ewMQ3ysPgiGY6O1s6cu33lkzYlXLp aw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2gva3hg18r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Mar 2018 09:52:33 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2M9qWVi026359 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Mar 2018 09:52:32 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w2M9qWKY009622; Thu, 22 Mar 2018 09:52:32 GMT Received: from localhost.localdomain (/77.138.186.148) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 22 Mar 2018 02:52:32 -0700 From: Yuval Shaia To: yuval.shaia@oracle.com, marcel@redhat.com, eblake@redhat.com, f4bug@amsat.org, qemu-devel@nongnu.org, qemu-trivial@nongnu.org Date: Thu, 22 Mar 2018 11:52:18 +0200 Message-Id: <20180322095220.9976-2-yuval.shaia@oracle.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180322095220.9976-1-yuval.shaia@oracle.com> References: <20180322095220.9976-1-yuval.shaia@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8839 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803200127 X-MIME-Autoconverted: from 8bit to quoted-printable by userp2120.oracle.com id w2M9gvQT164674 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.85 Subject: [Qemu-devel] [PATCH v2 for-2.12 1/3] hw/rdma: Change host_virt to void * X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Yuval Shaia Reviewed-by: Eric Blake Tested-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé --- hw/rdma/rdma_backend.c | 8 ++++---- hw/rdma/rdma_backend.h | 2 +- hw/rdma/rdma_rm.c | 10 +++++----- hw/rdma/rdma_rm_defs.h | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c index e306fba534..f1a37ba4a2 100644 --- a/hw/rdma/rdma_backend.c +++ b/hw/rdma/rdma_backend.c @@ -222,7 +222,7 @@ static int build_host_sge_array(RdmaDeviceResources *rdma_dev_res, 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; dsge->length = ssge[ssge_idx].length; 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) { - pr_dbg("addr=0x%lx\n", addr); + pr_dbg("addr=0x%p\n", addr); 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) { pr_dbg("lkey=0x%x\n", mr->ibmr->lkey); pr_dbg("rkey=0x%x\n", mr->ibmr->rkey); diff --git a/hw/rdma/rdma_backend.h b/hw/rdma/rdma_backend.h index 68f2b05ca7..07f6fed768 100644 --- a/hw/rdma/rdma_backend.h +++ b/hw/rdma/rdma_backend.h @@ -61,7 +61,7 @@ int rdma_backend_query_port(RdmaBackendDev *backend_dev, int rdma_backend_create_pd(RdmaBackendDev *backend_dev, 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); void rdma_backend_destroy_mr(RdmaBackendMR *mr); diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c index b5fc45ddab..296e40518e 100644 --- a/hw/rdma/rdma_rm.c +++ b/hw/rdma/rdma_rm.c @@ -146,7 +146,7 @@ int rdma_rm_alloc_mr(RdmaDeviceResources *dev_res, uint32_t pd_handle, RdmaRmMR *mr; int ret = 0; RdmaRmPD *pd; - uint64_t addr; + void *addr; size_t length; 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 * done */ length = TARGET_PAGE_SIZE; - addr = (uint64_t)g_malloc(length); + addr = g_malloc(length); } else { - mr->user_mr.host_virt = (uint64_t) host_virt; - pr_dbg("host_virt=0x%lx\n", mr->user_mr.host_virt); + mr->user_mr.host_virt = host_virt; + pr_dbg("host_virt=0x%p\n", mr->user_mr.host_virt); mr->user_mr.length = guest_length; pr_dbg("length=0x%lx\n", guest_length); 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) { 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); } } diff --git a/hw/rdma/rdma_rm_defs.h b/hw/rdma/rdma_rm_defs.h index 6522dca68f..fc646da61f 100644 --- a/hw/rdma/rdma_rm_defs.h +++ b/hw/rdma/rdma_rm_defs.h @@ -56,7 +56,7 @@ typedef struct RdmaRmCQ { } RdmaRmCQ; typedef struct RdmaRmUserMR { - uint64_t host_virt; + void *host_virt; uint64_t guest_start; size_t length; } RdmaRmUserMR;