Received: by 10.213.65.68 with SMTP id h4csp2137405imn; Thu, 29 Mar 2018 19:01:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+18mzqsPgcmxeyxomodayiQM9K79Gj9pxi5qDLlZzl/apKrMIK5vA9lsESV2TgdLyu8UBM X-Received: by 10.98.210.7 with SMTP id c7mr8202213pfg.92.1522375283173; Thu, 29 Mar 2018 19:01:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522375283; cv=none; d=google.com; s=arc-20160816; b=dS2zBRdQx9gGeHjzbEvwNSWP09DQBdenMW0pcoUa1KNGV5jPh6znXQtSc6/zs3cIhO 3nSPBT62lflWRih8+8jovqRya5cvd91AfgIRVIEiv3rJIIKSsr/2EgtrmqSK/RM9r8sf J3M07lgP/TWOnMPqo5TOfVVYw4gn5ccLSRxT/2gAiJkoTeY5tI553PVcPi3T0f+TgQAT 8w/yC5MIutbO19dsQSLv6OfB6sBIoWuQ7cknAouZWrbpFiITLsOgc17/B2mx3RDU2Ojv 8ZKMIBHppLAvpBy4NY0/CrNNfRAIe3NdvHhir4KpdeF2aYs9D4NqyKnTjwAB3gu+wUcI Q4xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=5Juc1K0bN7k23FjVk7RKUruRIXAPzdNH7D07cvMNjGA=; b=kPPYsQuWj9IQXAEAfmJj0XkIfE3pzxgkZa3iJMGK4xAH9iVyKc/OMRMcvh2mBKbLE5 gDTXq43l8ElSM9MXaNEIBnI+NyOtTb9PLWWqR1SqGpdywFzwwjJUJBUzq7iQi6rrn3zz d5I4kRxnD/P1fW92W27wrxJbrRLjue5nYv6b//mk+j8G9EApWXcg9ki4/MIsbwKwHfha 5yrx1i8ccNkW+guvHmNoEefrb1Ome+QrPmqzfjOBa0esbn/AhCy249t6Q2D/17AvoeYM gieUENjvzIQXoVUC/xEbuKFZxNPKzqzAardCabJhCT9bfQb+3XYl83zU0DMY4MADt2Ks FwRw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d15-v6si2845587plj.458.2018.03.29.19.00.56; Thu, 29 Mar 2018 19:01:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752590AbeC3B7B (ORCPT + 99 others); Thu, 29 Mar 2018 21:59:01 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43202 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751906AbeC3B67 (ORCPT ); Thu, 29 Mar 2018 21:58:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B0A044068031; Fri, 30 Mar 2018 01:58:58 +0000 (UTC) Received: from redhat.com (ovpn-125-66.rdu2.redhat.com [10.10.125.66]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66EF784453; Fri, 30 Mar 2018 01:58:56 +0000 (UTC) Date: Thu, 29 Mar 2018 21:58:54 -0400 From: Jerome Glisse To: Logan Gunthorpe Cc: Christian =?iso-8859-1?Q?K=F6nig?= , Christoph Hellwig , linaro-mm-sig@lists.linaro.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, Bjorn Helgaas Subject: Re: [PATCH 2/8] PCI: Add pci_find_common_upstream_dev() Message-ID: <20180330015854.GA3572@redhat.com> References: <5498e9b5-8fe5-8999-a44e-f7dc483bc9ce@amd.com> <16c7bef8-5f03-9e89-1f50-b62fb139a36f@deltatee.com> <6a5c9a10-50fe-b03d-dfc1-791d62d79f8e@amd.com> <73578b4e-664b-141c-3e1f-e1fae1e4db07@amd.com> <1b08c13e-b4a2-08f2-6194-93e6c21b7965@deltatee.com> <70adc2cc-f7aa-d4b9-7d7a-71f3ae99f16c@gmail.com> <98ce6cfd-bcf3-811e-a0f1-757b60da467a@deltatee.com> <8d050848-8970-b8c4-a657-429fefd31769@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 30 Mar 2018 01:58:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 30 Mar 2018 01:58:58 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jglisse@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 29, 2018 at 10:25:52AM -0600, Logan Gunthorpe wrote: > > > On 29/03/18 10:10 AM, Christian K?nig wrote: > > Why not? I mean the dma_map_resource() function is for P2P while other > > dma_map_* functions are only for system memory. > > Oh, hmm, I wasn't aware dma_map_resource was exclusively for mapping > P2P. Though it's a bit odd seeing we've been working under the > assumption that PCI P2P is different as it has to translate the PCI bus > address. Where as P2P for devices on other buses is a big unknown. dma_map_resource() is the right API (thought its current implementation is fill with x86 assumptions). So i would argue that arch can decide to implement it or simply return dma error address which trigger fallback path into the caller (at least for GPU drivers). SG variant can be added on top. dma_map_resource() is the right API because it has all the necessary informations. It use the CPU physical address as the common address "language" with CPU physical address of PCIE bar to map to another device you can find the corresponding bus address from the IOMMU code (NOP on x86). So dma_map_resource() knows both the source device which export its PCIE bar and the destination devices. So i don't think Christian need to base his patchset on yours. This is orthogonal. Christian is using existing upstream API, if it is broken on some arch it is up to those arch to fix it, or return error if it is not fixable. In fact i would assume that you would need to base your patchset on top of dma_map_resource() too ... Moreover i doubt Christian want to have struct page for this. For nouveau there will be HMM struct page and this would conflict. AFAICT you need struct page because the API you are trying to expose to user space rely on "regular" filesystem/RDMA umem API which all assume struct page. GPU drivers do not have this requirement and it should not be impose on them. So from my point of view Christian patchset is good as it is. Modulo better commit message. Bottom line i think we need common PCIE helper for P2P and the current dma_map_resource() is the right kind from POV. What you are doing with struct page is specific to your sub-system and should not be impose on others. Cheers, J?r?me