Received: by 10.213.65.68 with SMTP id h4csp1217533imn; Wed, 28 Mar 2018 23:59:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+dOuAJvBVQwoWJfSoy7T1C78I5MWM29l3UaOHhlyW4Ji4JrhXt6HWZ8NssR66DHc2ULPB8 X-Received: by 10.101.74.6 with SMTP id s6mr2396237pgq.79.1522306744362; Wed, 28 Mar 2018 23:59:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522306744; cv=none; d=google.com; s=arc-20160816; b=avyE1+Lbm0g5fSDd+fFRkTex41BlhmbknJSPFa2Gsh1Eq9SIiYScLEVxCuSYwTP/7r C76iM4E1Qi/MKg3LYsMFHAHpdfHkyhigT5TbHSEEa4iVFMvTEYAMfjhAmpx+15rlJnUO 0ATggROaJm/waJ0QzySO1h9gXwswIsl/WdJYgE1fecsipP5qM5+9zpc+bDfGFWOzCeDj u+Z8vrEnQaHnjGUpd81R3Dh2VUlp3zDN6yJwQzCFyR3xNfx/uNNDGKdGq/3usVCFjg4q D+zWC3frARfUAHopCW0C3T0ipGPCtZyftcBR5y1zbopaKJeN/kdrFo8G2MdH/1hM1c3F yjyQ== 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:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=FcEzOFkC7PuX3GPVx0Tfu4AkUu+czQRBysyssdv0ks8=; b=OdHtFQKqcwkKIIxfcJc7LL2U3NZho0fFTSvcDXl33swJAbdM5h7BsuUc+zk/QBk5Zm hJbBJ6TDRYCVQaXy3ea3+VQZPbPnB+mLdYlCyOWTCFlGEOpDZ7Dtnkkx7vmFo0kAbcle O/jx2fAQaDcwPCOza7GJ9WrSBpD9edbEj7R9dkU1jqvNMOvcoOvu9y8h2/YW+shbbBCL ZZ89aIW8DgTXPz+wizGihwS5sDbE59xu3qaGGGk2gTNnO1ZAfPd/cv6QtNUTOChgzTSI lbThaDt48AfXaDHCwwz2PpYMHquQGwEqqKENschsXWk+2PXdfvgjKfaphRwl0CbgA/wN Z3wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=Pcc4iRDf; 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 c27si3604222pgn.223.2018.03.28.23.58.49; Wed, 28 Mar 2018 23:59:04 -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; dkim=fail header.i=@ffwll.ch header.s=google header.b=Pcc4iRDf; 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 S1751096AbeC2G57 (ORCPT + 99 others); Thu, 29 Mar 2018 02:57:59 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:50578 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750716AbeC2G56 (ORCPT ); Thu, 29 Mar 2018 02:57:58 -0400 Received: by mail-wm0-f65.google.com with SMTP id l201so8836464wmg.0 for ; Wed, 28 Mar 2018 23:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=FcEzOFkC7PuX3GPVx0Tfu4AkUu+czQRBysyssdv0ks8=; b=Pcc4iRDfHw1Y2qjvssnY+mbXJ9FJV5ZCEZBc6yGKGizppdPEBhDv2vtn7iaV75j9qu KbxLirAON1PUlm50y/xt8vPu9kmMBm+OAtfowmeQy3DgIoJ1FsBrovxOdJN6yANATr3y D5EnBJTQ7yrIszEz1sc+wsieiLGNmKsFs9KIg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=FcEzOFkC7PuX3GPVx0Tfu4AkUu+czQRBysyssdv0ks8=; b=PPYotLAsOT0qf6gxiD8DHQ2wGjairxAprut+A6tXICvgcPv+VH+QYUV+PExWs2/PNt CncW+Rhtw9HEdm5kYsODwt5Vj8Bmnsld1vZEEhsdtjJFEhgE5lfpSZqQ7ITDdbjJmd8A l8xCmwpednaj2peJxoaC1M1TzZVaRBg9zrHZ/sd+XO0v9JCCdCfIXjqOkz9l9Na8SiLI wF+aEdnyMY88rC74+J8zFvtWXDkA2uB8A6RT9Um9ogykiXH3hXVt09b70zHHEb1VVPEj gM+Y1/oJM1OlP0MjYTIouLRv4wJhAGXXi626jqriW9vtd/11R+Izd2Ksv1SDZGk4ycti 3AlA== X-Gm-Message-State: AElRT7HWMEJT/oIx2NzaXZJl8N21T2DWgWtgCwsttILZ35EQ8vcNlLWH Wec77YxG/fxacPGkJgI5RiBhfg== X-Received: by 10.80.162.231 with SMTP id 94mr6171775edm.84.1522306676679; Wed, 28 Mar 2018 23:57:56 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id q29sm3419896edd.25.2018.03.28.23.57.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Mar 2018 23:57:55 -0700 (PDT) Date: Thu, 29 Mar 2018 08:57:53 +0200 From: Daniel Vetter To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/8] dma-buf: add peer2peer flag Message-ID: <20180329065753.GD3881@phenom.ffwll.local> Mail-Followup-To: Christian =?iso-8859-1?Q?K=F6nig?= , linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20180325110000.2238-1-christian.koenig@amd.com> <20180325110000.2238-4-christian.koenig@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180325110000.2238-4-christian.koenig@amd.com> X-Operating-System: Linux phenom 4.15.0-1-amd64 User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 25, 2018 at 12:59:56PM +0200, Christian K?nig wrote: > Add a peer2peer flag noting that the importer can deal with device > resources which are not backed by pages. > > Signed-off-by: Christian K?nig Um strictly speaking they all should, but ttm never bothered to use the real interfaces but just hacked around the provided sg list, grabbing the underlying struct pages, then rebuilding&remapping the sg list again. The entire point of using sg lists was exactly to allow this use case of peer2peer dma (or well in general have special exporters which managed memory/IO ranges not backed by struct page). So essentially you're having a "I'm totally not broken flag" here. I think a better approach would be if we add a requires_struct_page or so, and annotate the current importers accordingly. Or we just fix them up (it is all in shared ttm code after all, I think everyone else got this right). -Daniel > --- > drivers/dma-buf/dma-buf.c | 1 + > include/linux/dma-buf.h | 4 ++++ > 2 files changed, 5 insertions(+) > > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c > index ffaa2f9a9c2c..f420225f93c6 100644 > --- a/drivers/dma-buf/dma-buf.c > +++ b/drivers/dma-buf/dma-buf.c > @@ -565,6 +565,7 @@ struct dma_buf_attachment *dma_buf_attach(const struct dma_buf_attach_info *info > > attach->dev = info->dev; > attach->dmabuf = dmabuf; > + attach->peer2peer = info->peer2peer; > attach->priv = info->priv; > attach->invalidate = info->invalidate; > > diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h > index 15dd8598bff1..1ef50bd9bc5b 100644 > --- a/include/linux/dma-buf.h > +++ b/include/linux/dma-buf.h > @@ -313,6 +313,7 @@ struct dma_buf { > * @dmabuf: buffer for this attachment. > * @dev: device attached to the buffer. > * @node: list of dma_buf_attachment. > + * @peer2peer: true if the importer can handle peer resources without pages. > * @priv: exporter specific attachment data. > * > * This structure holds the attachment information between the dma_buf buffer > @@ -328,6 +329,7 @@ struct dma_buf_attachment { > struct dma_buf *dmabuf; > struct device *dev; > struct list_head node; > + bool peer2peer; > void *priv; > > /** > @@ -392,6 +394,7 @@ struct dma_buf_export_info { > * @dmabuf: the exported dma_buf > * @dev: the device which wants to import the attachment > * @priv: private data of importer to this attachment > + * @peer2peer: true if the importer can handle peer resources without pages > * @invalidate: callback to use for invalidating mappings > * > * This structure holds the information required to attach to a buffer. Used > @@ -401,6 +404,7 @@ struct dma_buf_attach_info { > struct dma_buf *dmabuf; > struct device *dev; > void *priv; > + bool peer2peer; > void (*invalidate)(struct dma_buf_attachment *attach); > }; > > -- > 2.14.1 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch