Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5183583pxb; Tue, 28 Sep 2021 12:20:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySmUyUv3y7PmPigCyOcF0vlK2lQIVBcLLciJTEDOI++m9gcho3QOs+oXYiHNrpAS34hf+Y X-Received: by 2002:a50:a343:: with SMTP id 61mr1378818edn.218.1632856820823; Tue, 28 Sep 2021 12:20:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632856820; cv=none; d=google.com; s=arc-20160816; b=pZxQLSfUTK8bx8o7DZ9TA/UXRJ3UWZ/inDmOcccv5GjqDDBM4+Y5uO4CZ3ySAgOb8M nRrq4yZXZVmpl+vDJPn0dznQm+nyOBucK2Cvk7j1edcXeUpx+3kWREaR3rf9gemPgYVB ESX715I6aOdukZq9JU+EVNLNIZ9NHETOKUin/BcBVN4Wl1E5JWMS8SDsBnZ/aTBj/fVr Cw/mZUt7xjgKihg+u+Uk2h+3Lnnw9+rGoJOE7moCbkQStwzYdGgMGJ9y3oJ7vUDjQtlR a/htsYue4EcNUKQMvh2O34hPMLNl3A2p6AFgZGJTnamrRMPGqmcLgMe5xeTI/+32tsq3 cX/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7f1QZiONeDrfm8AhTnbc53U7HhkzQ840mRRtmUewnCI=; b=yYSfwBpH9JoHXeIL218MRJierOmEPzeJJKt0mBb1xg7GnpazbR62OmN2amEUPDV5mH yrIWyRRl3yCbZ1Hh1ass0CKJHyla4inMgzFX0+h0r4p8YUWmI4/w5bdCEXLBQImCECYE 7JXObvGJy6ta9GMlzlExmDsap8GGNB6r8hq7IpkmISTNxN6TM2dbhajCChtUBj7oy5Ac TboQEe3M4o1d+naxardfGREfpGBb8SxZN/xht38YWqYGPDBFVapXuBHRXstkHQnt/Vdk oKOTEzmFYaRFxXK09qecG6GQc5fJ+GOaaccg1AWGqHBXfV19/oSqXr5f7fJMvjQ2vq1U ieuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=jv2OU4dR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y97si447233ede.520.2021.09.28.12.19.56; Tue, 28 Sep 2021 12:20:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=jv2OU4dR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237134AbhI1TTZ (ORCPT + 99 others); Tue, 28 Sep 2021 15:19:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242315AbhI1TTX (ORCPT ); Tue, 28 Sep 2021 15:19:23 -0400 Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEDA5C06161C for ; Tue, 28 Sep 2021 12:17:43 -0700 (PDT) Received: by mail-qt1-x82d.google.com with SMTP id c20so2580qtb.2 for ; Tue, 28 Sep 2021 12:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=7f1QZiONeDrfm8AhTnbc53U7HhkzQ840mRRtmUewnCI=; b=jv2OU4dRonKtBmDWObStEgucOWtPlJyqGW207XvuQpqOpfcn92InOEODzxDn3983J8 NWUMSihLuwJkDTW1ES/IWD1pW4f1IgZWhUtRjvhMkDyUbQyYUzTcg2auWALiBpPMh6T5 o6Y/op/SaG0z9lus3Le6nGPTcAsbC0wYw1OmeasBeOOIc0Unh8ixnfIYVGFTDQvdWUf7 ejnTvxk5F1g8wMgxUrGGmpVnriP2WtOERNRAu+rKxEr8b83QkHsd4GVA2mxfZkrmQHOF YHUBTillHF8tNjol2rYAKfciv/4RCk/9bFro7e8E17vrA8nf9zNDkX9XT7E2zrdw+Kvq T7bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7f1QZiONeDrfm8AhTnbc53U7HhkzQ840mRRtmUewnCI=; b=BaPb+a3bA3S5cR15BORzXGy8m4GajFfzjQQ9LnN8dPt6Y/cGLwlUlo6I+kR0oQjTDd k3D8EUyKxfqc2u4i4joWs/ZCa/yeKRPuqskI9ltq+s0qzqD+ejxLo7HSIH0nE9Zk5sFI Pq8/2iRoG7v9pugDtoudkVH+Loi/Pb6j0qLKWsXTEHdq1Z22ZOkPxv/DIJKskKQDlQR+ +QCf3WZAla5d7ktEJkC8/AeRbwu+MfvSxOi9IlPTwa0WHmeLjTIuvDiZqZ2RTu4rXjna q56cq0t+P5hFa5a/UQClZD5c2PHxUOwSIa+L8BS+j/4wwM4PMJHr3/qwt0rPqN5YTKFw eQww== X-Gm-Message-State: AOAM531Eojn/Mfm5VK0viPxCg+BJiaNlklVWGp45G4m1ptkKEbU5kdeF HoZJjifMVQ+fM0daZ2zo3xeZPg== X-Received: by 2002:ac8:7d4b:: with SMTP id h11mr7542407qtb.333.1632856663191; Tue, 28 Sep 2021 12:17:43 -0700 (PDT) Received: from ziepe.ca ([206.223.160.26]) by smtp.gmail.com with ESMTPSA id c6sm5387224qtx.72.2021.09.28.12.17.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 12:17:42 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1mVIbl-007G4o-JW; Tue, 28 Sep 2021 16:17:41 -0300 Date: Tue, 28 Sep 2021 16:17:41 -0300 From: Jason Gunthorpe To: Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, Stephen Bates , Christoph Hellwig , Dan Williams , Christian =?utf-8?B?S8O2bmln?= , John Hubbard , Don Dutile , Matthew Wilcox , Daniel Vetter , Jakowski Andrzej , Minturn Dave B , Jason Ekstrand , Dave Hansen , Xiong Jianxin , Bjorn Helgaas , Ira Weiny , Robin Murphy , Martin Oliveira , Chaitanya Kulkarni Subject: Re: [PATCH v3 11/20] RDMA/core: introduce ib_dma_pci_p2p_dma_supported() Message-ID: <20210928191741.GQ3544071@ziepe.ca> References: <20210916234100.122368-1-logang@deltatee.com> <20210916234100.122368-12-logang@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210916234100.122368-12-logang@deltatee.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 16, 2021 at 05:40:51PM -0600, Logan Gunthorpe wrote: > Introduce the helper function ib_dma_pci_p2p_dma_supported() to check > if a given ib_device can be used in P2PDMA transfers. This ensures > the ib_device is not using virt_dma and also that the underlying > dma_device supports P2PDMA. > > Use the new helper in nvme-rdma to replace the existing check for > ib_uses_virt_dma(). Adding the dma_pci_p2pdma_supported() check allows > switching away from pci_p2pdma_[un]map_sg(). > > Signed-off-by: Logan Gunthorpe > --- > drivers/nvme/target/rdma.c | 2 +- > include/rdma/ib_verbs.h | 11 +++++++++++ > 2 files changed, 12 insertions(+), 1 deletion(-) Reviewed-by: Jason Gunthorpe > +/* > + * Check if a IB device's underlying DMA mapping supports P2PDMA transfers. > + */ > +static inline bool ib_dma_pci_p2p_dma_supported(struct ib_device *dev) > +{ > + if (ib_uses_virt_dma(dev)) > + return false; If someone wants to make rxe/hfi/qib use this stuff then they will have to teach the the driver to do all the p2p checks and add some struct ib_device flag Jason