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=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 A1298C4742C for ; Thu, 5 Nov 2020 14:34:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3FC402083B for ; Thu, 5 Nov 2020 14:34:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="d1AhRiIA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731006AbgKEOeX (ORCPT ); Thu, 5 Nov 2020 09:34:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730935AbgKEOeW (ORCPT ); Thu, 5 Nov 2020 09:34:22 -0500 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4D62C0613D2 for ; Thu, 5 Nov 2020 06:34:20 -0800 (PST) Received: by mail-qv1-xf43.google.com with SMTP id da2so763758qvb.0 for ; Thu, 05 Nov 2020 06:34:20 -0800 (PST) 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=RNmi4P8WYl4GQETrYJxETS32iCzFa9Xv1b6hiJTCjLI=; b=d1AhRiIAMURRnc2p19hIinkgrZ6DW3hWA8vDhq/FL2ROPM9EIi7JcPpv2eyODMprbv 4tsGNhNZb3TGymM+rZ2KZpf7GleHIlpZRPJ1UsjK/hXagRZWDUJmcrYQVfHeR+tkTLcM yLJj9NoZf/Q3nZOoW/UjmUerXb3f8wc8oTFVeaBD9eIeWidRa76hIGSkix04wBZ5ymWQ WtnJL/Rr3jLHyWCeww/F9fNpKvr2iFh5jmrA2Fggtp5vL3Txcy1VsPqbFyvUl5S5XEEa yLfPujs8ZYzi44/IC4MYGlUYRGZLZCYfVKyDCGS3sayP4ntGQRdP/uL9pLPQCddX+lOL +xTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RNmi4P8WYl4GQETrYJxETS32iCzFa9Xv1b6hiJTCjLI=; b=qYlm3bOEFyaXDasoDYaThWdTTQ+46qAiz/Ye0hzY/M2mHPvib6cSqZ4xOp/LB/DD7t rb+0P4LBcQkMhRlUEQcHcwyUEeI0MCvXMZqj60bdEI4Y4xe3YXLY5MLs0VBURqkgDcAo gUyy+W0VbqXR0lTVOsNj4MqgeZ/N7jLBIffm5ZWT5uMguNUOV8Jt47fp+1NeKxaggMtP A03WZyRdtrJ0leI9oQe8sx7l0jgf8dsqjkCXkQ/TzBFHGfVmEXpM+c/3pbExkpJ2JnTn mSlCFBbqoA8DC4HypR/9b/p5Ce5O+dE73A1hegn6efw8pYgsv+oTBu5IBNEfeYMgQgRL jjDw== X-Gm-Message-State: AOAM533Tl47Wd209I5gWD6zC2RyY9EPnc85bHVjq/yrJVatpgTOpMWz6 W+x04ymctGw/Dz0mt5V0vW/HEA== X-Google-Smtp-Source: ABdhPJw0ST1B67vguCBdvn7ezsqBPCcqlyF/5YAxBY/HhZbjhQWUMpnKjhTf+w+TlD6Fi1I60TlRyQ== X-Received: by 2002:a0c:8d05:: with SMTP id r5mr2332295qvb.31.1604586860101; Thu, 05 Nov 2020 06:34:20 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id d18sm1115165qka.41.2020.11.05.06.34.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 06:34:19 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kagLC-00HNlu-Vc; Thu, 05 Nov 2020 10:34:18 -0400 Date: Thu, 5 Nov 2020 10:34:18 -0400 From: Jason Gunthorpe To: Christoph Hellwig Cc: Bjorn Helgaas , Bernard Metzler , Zhu Yanjun , Logan Gunthorpe , Dennis Dalessandro , Mike Marciniszyn , linux-rdma@vger.kernel.org, linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org Subject: Re: [PATCH 4/6] PCI/P2PDMA: Remove the DMA_VIRT_OPS hacks Message-ID: <20201105143418.GA4142106@ziepe.ca> References: <20201105074205.1690638-1-hch@lst.de> <20201105074205.1690638-5-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201105074205.1690638-5-hch@lst.de> Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Thu, Nov 05, 2020 at 08:42:03AM +0100, Christoph Hellwig wrote: > Now that all users of dma_virt_ops are gone we can remove the workaround > for it in the PCI peer to peer code. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Logan Gunthorpe > Acked-by: Bjorn Helgaas > drivers/pci/p2pdma.c | 20 -------------------- > 1 file changed, 20 deletions(-) > > diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c > index de1c331dbed43f..b07018af53876c 100644 > +++ b/drivers/pci/p2pdma.c > @@ -556,15 +556,6 @@ int pci_p2pdma_distance_many(struct pci_dev *provider, struct device **clients, > return -1; > > for (i = 0; i < num_clients; i++) { > -#ifdef CONFIG_DMA_VIRT_OPS > - if (clients[i]->dma_ops == &dma_virt_ops) { > - if (verbose) > - dev_warn(clients[i], > - "cannot be used for peer-to-peer DMA because the driver makes use of dma_virt_ops\n"); > - return -1; > - } > -#endif > - > pci_client = find_parent_pci_dev(clients[i]); > if (!pci_client) { > if (verbose) > @@ -837,17 +828,6 @@ static int __pci_p2pdma_map_sg(struct pci_p2pdma_pagemap *p2p_pgmap, > phys_addr_t paddr; > int i; > > - /* > - * p2pdma mappings are not compatible with devices that use > - * dma_virt_ops. If the upper layers do the right thing > - * this should never happen because it will be prevented > - * by the check in pci_p2pdma_distance_many() > - */ > -#ifdef CONFIG_DMA_VIRT_OPS > - if (WARN_ON_ONCE(dev->dma_ops == &dma_virt_ops)) > - return 0; > -#endif The check is removed here, but I didn't see a matching check added to the IB side? Something like: static int rdma_rw_map_sg(struct ib_device *dev, struct scatterlist *sg, u32 sg_cnt, enum dma_data_direction dir) { if (is_pci_p2pdma_page(sg_page(sg))) { if (ib_uses_virt_dma(dev)) return 0; return pci_p2pdma_map_sg(dev->dma_device, sg, sg_cnt, dir); } return ib_dma_map_sg(dev, sg, sg_cnt, dir); } I think the change to rdma_rw_unmap_sg() should probably be dropped in favour of the above? Jason