Received: by 10.213.65.68 with SMTP id h4csp2612236imn; Mon, 2 Apr 2018 10:38:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+ejHE0dbrH6C3wGehRQk24f4TPVw0KmKMkWzheyhHhEp3HQbBfCcuNSfYrKA6LelRw3vyI X-Received: by 2002:a17:902:264:: with SMTP id 91-v6mr10739449plc.178.1522690713917; Mon, 02 Apr 2018 10:38:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522690713; cv=none; d=google.com; s=arc-20160816; b=GvpwGwZafofmSkUZ0+RmF9ogSTe/JgFx7YfQlLmbKY/vu5ZxVwrzDST8nlcP41IhsQ v/PtTj2iKkxJee71dZOvsbLVLePS5PSr8aTnmMVvctlGgK9eOA6KDIAwB1z4vwGEYhkW NxhIJooW9nwvKcVHmtPXVKlKpAtBrN4Cukf0huLYZPbhYCAtl1LdgjtucmuMCgWAK3Dp HqIOQALObGL/G9vIPvgBtVlBfxaQyJw7dK5qyFsYCZ+aMp6sHqpVvmzaWDBAHRk2S8eW hHaDH2JV9R4tBrLPfxme16BF1E7q3ufIAtL1WKDv5OmtY9dE2NR/Rhrg/ek77goHC2P4 uAuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:arc-authentication-results; bh=szw39GxtqmVZ6L3l5OLI80LBmRRE9O4ecgETvoEt+28=; b=LBRi+47M38r7xfWUVNWuzt+2jbNDEFDKAvYTzT2lGCWF9C1e35tayMSqaTw5yi13bG tBhz2czk+N7dN1jESAQzFMjbiTKsUd05GvSKuN7hsg8VIy4q53dcb5Q60Xi7iMsxN6mH 4NAa+ISdQgsQbN8th+tDj4tkCdTX/5D8vtnvz29g2Syd6nqWF0QytSUT7zFNhozeLs+7 Bjs24ThuO8DruyYbQiX6AwL0WqaEB+V7R1DjotklST8fYbe6IZIARAPkg8ln2jt6yVMV ngkxvmkt8LXSxsvE/NTbBXeVir3gASGoXZw7E6fZDpmX/Yd4opzpGs4tm6opRbr0ckkg UIDA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s5-v6si718130plp.28.2018.04.02.10.38.19; Mon, 02 Apr 2018 10:38:33 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753226AbeDBRhM (ORCPT + 99 others); Mon, 2 Apr 2018 13:37:12 -0400 Received: from ale.deltatee.com ([207.54.116.67]:40610 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753030AbeDBRhK (ORCPT ); Mon, 2 Apr 2018 13:37:10 -0400 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1f33OG-0005TN-Ob; Mon, 02 Apr 2018 11:37:09 -0600 To: Jerome Glisse Cc: =?UTF-8?Q?Christian_K=c3=b6nig?= , Christoph Hellwig , Will Davis , Joerg Roedel , 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 References: <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> <20180330015854.GA3572@redhat.com> <0234bc5e-495e-0f68-fb0a-debb17a35761@deltatee.com> <20180330194519.GC3198@redhat.com> <31266710-f6bb-99ee-c73d-6e58afe5c38c@deltatee.com> <20180402172027.GA18231@redhat.com> From: Logan Gunthorpe Message-ID: <6f796779-0ba3-d056-de33-341ee55d6b38@deltatee.com> Date: Mon, 2 Apr 2018 11:37:07 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180402172027.GA18231@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: bhelgaas@google.com, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, joro@8bytes.org, wdavis@nvidia.com, hch@infradead.org, christian.koenig@amd.com, jglisse@redhat.com X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 Subject: Re: [PATCH 2/8] PCI: Add pci_find_common_upstream_dev() X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/04/18 11:20 AM, Jerome Glisse wrote: > The point i have been trying to get accross is that you do have this > information with dma_map_resource() you know the device to which you > are trying to map (dev argument to dma_map_resource()) and you can > easily get the device to which the memory belongs because you have the > CPU physical address of the memory hence you can lookup the resource > and get the device from that. How do you go from a physical address to a struct device generally and in a performant manner? > IIRC CAPI make P2P mandatory but maybe this is with NVLink. We can ask > the PowerPC folks to confirm. Note CAPI is Power8 and newer AFAICT. PowerPC folks recently told us specifically that Power9 does not support P2P between PCI root ports. I've said this many times. CAPI has nothing to do with it. > Mapping to userspace have nothing to do here. I am talking at hardware > level. How thing are expose to userspace is a completely different > problems that do not have one solution fit all. For GPU you want this > to be under total control of GPU drivers. For storage like persistent > memory, you might want to expose it userspace more directly ... My understanding (and I worked on this a while ago) is that CAPI hardware manages memory maps typically for userspace memory. When a userspace program changes it's mapping, the CAPI hardware is updated so that hardware is coherent with the user address space and it is safe to DMA to any address without having to pin memory. (This is very similar to ODP in RNICs.) This is *really* nice but doesn't solve *any* of the problems we've been discussing. Moreover, many developers want to keep P2P in-kernel, for the time being, where the problem of pinning memory does not exist. Logan