From patchwork Wed Mar 11 13:51:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 11431971 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B5F790 for ; Wed, 11 Mar 2020 15:04:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B81D0206C0 for ; Wed, 11 Mar 2020 15:04:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="r7MESjrL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B81D0206C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9344E6E9A7; Wed, 11 Mar 2020 15:04:41 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id 46EA26E430; Wed, 11 Mar 2020 13:52:04 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id m3so2233298wmi.0; Wed, 11 Mar 2020 06:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=xEoFbydtA55bQRoTqtzVl54mwFx3SL0wixHy09grPa0=; b=r7MESjrLBguiuqkJWV5+QhG2ZuQSFkodxlA1aWbNaIXYzGHoRgec96ylrOYaaeMcSQ h3g9fCl8X+vf4W9OEJNZUn97AGKgc4JTxzWK6LeWdFf8qVMDJy6wwf2J9IDxPUc5D5ft jAMp5egEe2WKoUAqyLz7AcTr6SpCm0tBpbPcUClXcPRp9xyWSqv3I6ueKAnu8wfJnCey 57rUV5EWInn60cNMUJyI7KBKwAED8wMsCk1fC7Lu+WyPgfyn/9+AhRGeF+USeM1U9nZN YmMp41PV9WE/HlSyIkO2hHfqLJjZr0sHHqv5N1TC593JyqRaj2XMKu3KAlFNnQDvZ4hr oq7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xEoFbydtA55bQRoTqtzVl54mwFx3SL0wixHy09grPa0=; b=Tcx+QQmX+jp+dby+FxLcDeaYzzuc7yLZ2/aMtGhx5pa09iByfNsTd+vdCO9t/F0kGx 8nnz6xcrTNcKhPg7PJRcwotK9F8/AkpS8JB9jSTPTw/LRxUlZKPOPk3lWiOjBLxaVby9 pJCiMZ67s0mYoCxSceX7dpkgKyARJDa3c2Ko4cdzEXymhD3Hrg8bu/yUnvZROqstSd76 qrcbQMOOCfWJweFAHW8pU5fz1JR1wtFaTCtKiV9HGXFpJdsMeldhhLr4GD5xeTW6qH7X CzEbMZnHT85ydeT3pYTYYn6fYCO4oEnkx4jAn3+TT1E+3sP31wrsSjNEEc8JvAtD8Nw5 Icag== X-Gm-Message-State: ANhLgQ02zU4TCmXRr5p2BaEy7904Mq12pjHkbPVvk8nzpeN1p8eIq0YL MszTnCKqtMtm1hPwb7bkqZs= X-Google-Smtp-Source: ADFU+vuIhHcOqb5hYvyJLF0VXhRNUC5gsOSa+CkV8rcXv1Lmvo1T20WArTWant8WOU2t0Mvf9O7HNQ== X-Received: by 2002:a05:600c:4013:: with SMTP id i19mr2532147wmm.28.1583934722955; Wed, 11 Mar 2020 06:52:02 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:8dc:e796:e7da:a319]) by smtp.gmail.com with ESMTPSA id 138sm3183811wmb.21.2020.03.11.06.52.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 06:52:02 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: David1.Zhou@amd.com, hch@infradead.org, jgg@ziepe.ca, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org, intel-gfx@lists.freedesktop.org Date: Wed, 11 Mar 2020 14:51:54 +0100 Message-Id: <20200311135158.3310-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200311135158.3310-1-christian.koenig@amd.com> References: <20200311135158.3310-1-christian.koenig@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 11 Mar 2020 15:04:30 +0000 Subject: [Intel-gfx] [PATCH 2/6] dma-buf: add peer2peer flag X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 --- drivers/dma-buf/dma-buf.c | 2 ++ include/linux/dma-buf.h | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index f4ace9af2191..f9220928ec90 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -689,6 +689,8 @@ dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev, attach->dev = dev; attach->dmabuf = dmabuf; + if (importer_ops) + attach->peer2peer = importer_ops->allow_peer2peer; attach->importer_ops = importer_ops; attach->importer_priv = importer_priv; diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index 1ade486fc2bb..82e0a4a64601 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h @@ -334,6 +334,14 @@ struct dma_buf { * Attachment operations implemented by the importer. */ struct dma_buf_attach_ops { + /** + * @allow_peer2peer: + * + * If this is set to true the importer must be able to handle peer + * resources without struct pages. + */ + bool allow_peer2peer; + /** * @move_notify * @@ -362,6 +370,7 @@ struct dma_buf_attach_ops { * @node: list of dma_buf_attachment, protected by dma_resv lock of the dmabuf. * @sgt: cached mapping. * @dir: direction of cached mapping. + * @peer2peer: true if the importer can handle peer resources without pages. * @priv: exporter specific attachment data. * @importer_ops: importer operations for this attachment, if provided * dma_buf_map/unmap_attachment() must be called with the dma_resv lock held. @@ -382,6 +391,7 @@ struct dma_buf_attachment { struct list_head node; struct sg_table *sgt; enum dma_data_direction dir; + bool peer2peer; const struct dma_buf_attach_ops *importer_ops; void *importer_priv; void *priv;