From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3832C6FA89 for ; Wed, 7 Sep 2022 15:32:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229774AbiIGPcn (ORCPT ); Wed, 7 Sep 2022 11:32:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbiIGPcm (ORCPT ); Wed, 7 Sep 2022 11:32:42 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEEB37695C; Wed, 7 Sep 2022 08:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=aoNCEd3G2h5oJitKSRVecj6qINXspk8RoWUpFU3QgrE=; b=tCCcEUDdBTy1gWyfW9YlNG/Jia azpaKa4Vhsw29BawZm5vkl0bhNs2r5JPa4G6HvoB86C50nitowwurSg3bzRjVx2WZhWwoAhiQAmVn /oT7MA7/SWWCc8f8+o9D4Mfq2IBQOQ4PPxdBNHKqMN3P/sWe7Ttp3EszfE6OzWoqHe3YEPWs0eyO9 jpCx9TEhmKvhFD0ZcYsfFTYekZBR1omjitNqvA2cy1f4syPWthiukLGuozipk5tQrpDhLzu4ihLth QSPNF/ojETiUJOgURCWfEFBPHav5pDhp9feHgfz6yk5RxCHpVde8WMEVKomsY+Jgne51OLrnG9Tpe HeWIjtag==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVx2N-007MrO-F7; Wed, 07 Sep 2022 15:32:23 +0000 Date: Wed, 7 Sep 2022 08:32:23 -0700 From: Christoph Hellwig To: Jason Gunthorpe Cc: Christoph Hellwig , Christian =?iso-8859-1?Q?K=F6nig?= , Alex Williamson , Cornelia Huck , dri-devel@lists.freedesktop.org, kvm@vger.kernel.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org, Sumit Semwal , Daniel Vetter , Leon Romanovsky , linux-rdma@vger.kernel.org, Maor Gottlieb , Oded Gabbay , Dan Williams Subject: Re: [PATCH v2 4/4] vfio/pci: Allow MMIO regions to be exported through dma-buf Message-ID: References: <0-v2-472615b3877e+28f7-vfio_dma_buf_jgg@nvidia.com> <4-v2-472615b3877e+28f7-vfio_dma_buf_jgg@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Wed, Sep 07, 2022 at 12:23:28PM -0300, Jason Gunthorpe wrote: > 2) DMABUF abuses dma_map_resource() for P2P and thus doesn't work in > certain special cases. Not just certain special cases, but one of the main use cases. Basically P2P can happen in two ways: a) through a PCIe switch, or b) through connected root ports The open code version here only supports a), only supports it when there is no offset between the 'phyiscal' address of the BAR seen PCIe endpoint and the Linux way. x86 usually (always?) doesn't have an offset there, but other architectures often do. Last but not least I don't really see how the code would even work when an IOMMU is used, as dma_map_resource will return an IOVA that is only understood by the IOMMU itself, and not the other endpoint. How was this code even tested?