From patchwork Fri Feb 5 00:29:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xiong, Jianxin" X-Patchwork-Id: 12069025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F526C433DB for ; Fri, 5 Feb 2021 00:14:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F206B64FAE for ; Fri, 5 Feb 2021 00:14:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F206B64FAE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 813676EEB2; Fri, 5 Feb 2021 00:14:17 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8B2366EEB1 for ; Fri, 5 Feb 2021 00:14:15 +0000 (UTC) IronPort-SDR: gyMfNT2PFUbwNyq3VEPDEUkolSv2S2+oe0AniJo5xUHQ1bIAQuQtjeeeDhieKGxAzOjyYjndzT a2KDuL1bPfFA== X-IronPort-AV: E=McAfee;i="6000,8403,9885"; a="266181545" X-IronPort-AV: E=Sophos;i="5.81,153,1610438400"; d="scan'208";a="266181545" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 16:14:14 -0800 IronPort-SDR: 4NWm1oZ0nuHSdRNWL/ar5oktZ8cBKZnc8obrjPDKfEScgv4/x6Q3Z7BypiGEcfDfjcnX7wTVDu qnerKJzhJq3Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,153,1610438400"; d="scan'208";a="508326484" Received: from cst-dev.jf.intel.com ([10.23.221.69]) by orsmga004.jf.intel.com with ESMTP; 04 Feb 2021 16:14:14 -0800 From: Jianxin Xiong To: linux-rdma@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH rdma-core v2 1/3] verbs: Fix gcc warnings when building for 32bit systems Date: Thu, 4 Feb 2021 16:29:12 -0800 Message-Id: <1612484954-75514-2-git-send-email-jianxin.xiong@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1612484954-75514-1-git-send-email-jianxin.xiong@intel.com> References: <1612484954-75514-1-git-send-email-jianxin.xiong@intel.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yishai Hadas , Leon Romanovsky , John Hubbard , Edward Srouji , Emil Velikov , Gal Pressman , Ali Alnubani , Jason Gunthorpe , Doug Ledford , Daniel Vetter , Christian Koenig , Jianxin Xiong MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Commit 6b0a3238289f ("verbs: Support dma-buf based memory region") caused a build failure when building for 32b systems with gcc: $ mkdir build && cd build && CFLAGS="-m32" cmake -GNinja .. \ -DIOCTL_MODE=both -DNO_PYVERBS=1 -DENABLE_WERROR=1 && ninja ... ../libibverbs/cmd_mr.c: In function 'ibv_cmd_reg_dmabuf_mr': ../libibverbs/cmd_mr.c:152:21: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] vmr->ibv_mr.addr = (void *)offset; ... ../libibverbs/verbs.c: In function 'ibv_reg_dmabuf_mr': ../libibverbs/verbs.c:387:13: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] mr->addr = (void *)offset; ... Reported-by: Ali Alnubani Signed-off-by: Jianxin Xiong --- libibverbs/cmd_mr.c | 2 +- libibverbs/verbs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libibverbs/cmd_mr.c b/libibverbs/cmd_mr.c index af0fad7..736fce0 100644 --- a/libibverbs/cmd_mr.c +++ b/libibverbs/cmd_mr.c @@ -149,7 +149,7 @@ int ibv_cmd_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, size_t length, vmr->ibv_mr.lkey = lkey; vmr->ibv_mr.rkey = rkey; vmr->ibv_mr.pd = pd; - vmr->ibv_mr.addr = (void *)offset; + vmr->ibv_mr.addr = (void *)(uintptr_t)offset; vmr->ibv_mr.length = length; vmr->mr_type = IBV_MR_TYPE_DMABUF_MR; return 0; diff --git a/libibverbs/verbs.c b/libibverbs/verbs.c index b93046a..f666695 100644 --- a/libibverbs/verbs.c +++ b/libibverbs/verbs.c @@ -384,7 +384,7 @@ struct ibv_mr *ibv_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, mr->context = pd->context; mr->pd = pd; - mr->addr = (void *)offset; + mr->addr = (void *)(uintptr_t)offset; mr->length = length; return mr; }