Received: by 10.213.65.68 with SMTP id h4csp1705372imn; Thu, 29 Mar 2018 09:27:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx49Cb/npsgn00k3Vxo17mebbxC5pW87X8MFh5I54OUPHlh9Km6zFeGB7KsBDDyVerrnkaQl7 X-Received: by 10.101.89.5 with SMTP id f5mr5977552pgu.428.1522340865835; Thu, 29 Mar 2018 09:27:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522340865; cv=none; d=google.com; s=arc-20160816; b=S8MVeViE4AgUgS7cqaWWv4Ovt4+5Tik6unHEX3VknlKcDXarmQRtmMOM5GJ3dEBme1 pvvneNx1GUW9IhDL9QEg4TWqFNy9HuA1HCkirx5vZeaNdRVufyPJDUIrbFjG8UpsT0Rr LyBobHra4Wow5Hs/sEmX6EtiaKs62WreJVjGv+HbJlNEE7tNX7yBSRjmZokPMlhBn9tM JH1741NoCCSZdZyfOe4oDC1kmvFPjzIPfPum9d1+co7WYufK+vEPNr/BVyO59E5+LNUL pGyKXxAfAz2cU19A8dyKGqfBRn5kDZ7Ue4OlpPg8lMezNe1F6t0/kfdJnFJ+VqgVJJvv jm3w== 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=NBDBmqhscjc5KwvOLbS528pQfwmpuz7QK6VMFluskno=; b=S+v7XkRIqP5DbgmdCYD0WsL57TlDSvmXCXVsEQ9NyUjymdn15GQgqfeDiuHNYF+ji3 fJ0OUciLSyzMwtIrO3Jx77thL/7eMj+24676iDllWF3oXIjEY2cEAmUG4Fb5h/hU20O2 RVfUbThdebps0x5Sbd/+qScHp06MZTkcqBfPFYjvYSmftXqvcmfXmkSoHpKLVHgknxYM UhJRgwIjRGrpsOkg2Gr4Aqt/A9+pPskzJK7AtRtbZyYRljkqFqUiRNhdISq3J80QMd0B cihkeUsNTs2wwFVucRMgmAGTPROiDD1X1ofxg9M4+DirEQuE/IEMuJj+7uR3C38StW0U emUg== 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 b123si4694870pfb.406.2018.03.29.09.27.32; Thu, 29 Mar 2018 09:27:45 -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 S1752596AbeC2QZ4 (ORCPT + 99 others); Thu, 29 Mar 2018 12:25:56 -0400 Received: from ale.deltatee.com ([207.54.116.67]:46512 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752261AbeC2QZy (ORCPT ); Thu, 29 Mar 2018 12:25:54 -0400 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1f1aN7-0005zl-K3; Thu, 29 Mar 2018 10:25:54 -0600 To: =?UTF-8?Q?Christian_K=c3=b6nig?= , Christoph Hellwig Cc: 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: <20180325110000.2238-1-christian.koenig@amd.com> <20180325110000.2238-2-christian.koenig@amd.com> <20180328123830.GB25060@infradead.org> <613a6c91-7e72-5589-77e6-587ec973d553@gmail.com> <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> From: Logan Gunthorpe Message-ID: Date: Thu, 29 Mar 2018 10:25:52 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <8d050848-8970-b8c4-a657-429fefd31769@amd.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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, hch@infradead.org, christian.koenig@amd.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.8 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE,MYRULES_EXCLUSIVE,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 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. >> And this is necessary to >> check if the DMA ops in use support it or not. We can't have the >> dma_map_X() functions do the wrong thing because they don't support it yet. > > Well that sounds like we should just return an error from > dma_map_resources() when an architecture doesn't support P2P yet as Alex > suggested. Yes, well except in our patch-set we can't easily use dma_map_resources() as we either have SGLs to deal with or we need to create whole new interfaces to a number of subsystems. > You don't seem to understand the implications: The devices do have a > common upstream bridge! In other words your code would currently claim > that P2P is supported, but in practice it doesn't work. Do they? They don't on any of the Intel machines I'm looking at. The previous version of the patchset not only required a common upstream bridge but two layers of upstream bridges on both devices which would effectively limit transfers to PCIe switches only. But Bjorn did not like this. > You need to include both drivers which participate in the P2P > transaction to make sure that both supports this and give them > opportunity to chicken out and in the case of AMD APUs even redirect the > request to another location (e.g. participate in the DMA translation). I don't think it's the drivers responsibility to reject P2P . The topology is what governs support or not. The discussions we had with Bjorn settled on if the devices are all behind the same bridge they can communicate with each other. This is essentially guaranteed by the PCI spec. > DMA-buf fortunately seems to handle all this already, that's why we > choose it as base for our implementation. Well, unfortunately DMA-buf doesn't help for the drivers we are working with as neither the block layer nor the RDMA subsystem have any interfaces for it. Logan