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 X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 108E5C10F29 for ; Wed, 11 Mar 2020 11:20:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D536321D56 for ; Wed, 11 Mar 2020 11:20:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="DiECrG1C" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729141AbgCKLU3 (ORCPT ); Wed, 11 Mar 2020 07:20:29 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:45992 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729085AbgCKLUY (ORCPT ); Wed, 11 Mar 2020 07:20:24 -0400 Received: by mail-pf1-f196.google.com with SMTP id 2so1132996pfg.12 for ; Wed, 11 Mar 2020 04:20:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dwWKWsLEV24axZ5LPi6+9EofRSocDQnNjSMdJCwyg/k=; b=DiECrG1ChFrIsdnCWJkiiijV0Oa2bLJvHMESQKerzpeZrJBihyO27UbVoCHaNyHPMH 3Zf0FXl3wUuI7rGKr3W7raEbt/GKRIAgNwv8jRHu9xBi2qAhYsfvrS6rwyKm2U7mBDtZ SzR6JVH7cbDV7RKvMFAbM3cWCfSEgVFtW7rTE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dwWKWsLEV24axZ5LPi6+9EofRSocDQnNjSMdJCwyg/k=; b=Ie3XeLtSFbB7ENRGWzDQJejk2z8h8fAlkl4poifOEFG16L3OzbXB4nyoYENLxIiaOz QoYq5GyBWxFs715PDAECog+979i5BTyFmuXdwF8MpYIjegu98S2tCkaTr91E3syYQJF/ ibSaKUO3zX5HXjuxgald/eBDI0hfahLjY44zVu2UT2HMGMC29+2grmhMwygXTzsmT12Q Mi8dVXmwoEa4rt6IcTfsvsho9dDgqaUZzPc+V7WPO31M6+V7hFKCJoNVBPekml5POiCx ULbn/DDfnH5nYxdgMOaqoY7/uqixiU1Uj8zkXFDArt3YbiNVsjdhGf/716K8q5NpEWdP jaNQ== X-Gm-Message-State: ANhLgQ2oEzPkpDo5VMjB+rcb5auTDovHtYqe9UbMiOGWQvfYv9h2U+Py 7pYfS3edxXccYCR9J++X5nBLGQ== X-Google-Smtp-Source: ADFU+vsqTKXWkUwlZU65GnXLcGQeIusImXSF6/071PjPajjV9Zy+d6+78zX7Xm4MNtky83+YtZg6Ow== X-Received: by 2002:aa7:94b5:: with SMTP id a21mr295803pfl.290.1583925623087; Wed, 11 Mar 2020 04:20:23 -0700 (PDT) Received: from localhost ([2401:fa00:8f:203:30f2:7a9c:387e:6c7]) by smtp.gmail.com with ESMTPSA id q43sm4280776pjc.40.2020.03.11.04.20.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Mar 2020 04:20:22 -0700 (PDT) From: David Stevens To: Gerd Hoffmann , David Airlie Cc: Daniel Vetter , "Michael S . Tsirkin" , Jason Wang , Sumit Semwal , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Stevens , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, virtio-dev@lists.oasis-open.org Subject: [PATCH v3 1/4] dma-buf: add support for virtio exported objects Date: Wed, 11 Mar 2020 20:20:01 +0900 Message-Id: <20200311112004.47138-2-stevensd@chromium.org> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-goog In-Reply-To: <20200311112004.47138-1-stevensd@chromium.org> References: <20200311112004.47138-1-stevensd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This change adds a new dma-buf operation that allows dma-bufs to be used by virtio drivers to share exported objects. The new operation allows the importing driver to query the exporting driver for the UUID which identifies the underlying exported object. Signed-off-by: David Stevens --- drivers/dma-buf/dma-buf.c | 12 ++++++++++++ include/linux/dma-buf.h | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index d4097856c86b..fa5210ba6aaa 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -1158,6 +1158,18 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr) } EXPORT_SYMBOL_GPL(dma_buf_vunmap); +int dma_buf_get_uuid(struct dma_buf *dmabuf, uuid_t *uuid) +{ + if (WARN_ON(!dmabuf) || !uuid) + return -EINVAL; + + if (!dmabuf->ops->get_uuid) + return -ENODEV; + + return dmabuf->ops->get_uuid(dmabuf, uuid); +} +EXPORT_SYMBOL_GPL(dma_buf_get_uuid); + #ifdef CONFIG_DEBUG_FS static int dma_buf_debug_show(struct seq_file *s, void *unused) { diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index abf5459a5b9d..00758523597d 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h @@ -251,6 +251,21 @@ struct dma_buf_ops { void *(*vmap)(struct dma_buf *); void (*vunmap)(struct dma_buf *, void *vaddr); + + /** + * @get_uuid + * + * This is called by dma_buf_get_uuid to get the UUID which identifies + * the buffer to virtio devices. + * + * This callback is optional. + * + * Returns: + * + * 0 on success or a negative error code on failure. On success uuid + * will be populated with the buffer's UUID. + */ + int (*get_uuid)(struct dma_buf *dmabuf, uuid_t *uuid); }; /** @@ -444,4 +459,7 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *, unsigned long); void *dma_buf_vmap(struct dma_buf *); void dma_buf_vunmap(struct dma_buf *, void *vaddr); + +int dma_buf_get_uuid(struct dma_buf *dmabuf, uuid_t *uuid); + #endif /* __DMA_BUF_H__ */ -- 2.25.1.481.gfbce0eb801-goog 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 X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A585C5ACBF for ; Thu, 12 Mar 2020 08:10:01 +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 493CC20650 for ; Thu, 12 Mar 2020 08:10:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="DiECrG1C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 493CC20650 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3262E6EA6F; Thu, 12 Mar 2020 08:08:51 +0000 (UTC) Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7B00A6E972 for ; Wed, 11 Mar 2020 11:20:23 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id i13so1155428pfe.3 for ; Wed, 11 Mar 2020 04:20:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dwWKWsLEV24axZ5LPi6+9EofRSocDQnNjSMdJCwyg/k=; b=DiECrG1ChFrIsdnCWJkiiijV0Oa2bLJvHMESQKerzpeZrJBihyO27UbVoCHaNyHPMH 3Zf0FXl3wUuI7rGKr3W7raEbt/GKRIAgNwv8jRHu9xBi2qAhYsfvrS6rwyKm2U7mBDtZ SzR6JVH7cbDV7RKvMFAbM3cWCfSEgVFtW7rTE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dwWKWsLEV24axZ5LPi6+9EofRSocDQnNjSMdJCwyg/k=; b=gMn0tuZ590lNpTtxfARtbPhrtxGdcUT9h+Rb5SDIpqbJYWs42lHZjE1CLEmPwSxmrI y/F37r0a3kLmSh7ucrEQiPPPgobEkDOQXFQT0PT2AKMtfI/Sg8d25zRkTtbtS+QpecPi oti3LHsWSy/Xx3G5AMCz4JPmKZ1vNKo0MbAUNwCsWzWOHu1257fBUOCMqHq6M7taw1aN bVoAu/TK/7hwtZ254W01u5T7PhUoeTB8f/CBfGbGjZohGjnk4X1VjxNFvFSYxQkuFu2n IrT1yM4BKYpv++jTjX2oTW8L1se1Zvb1S71PnMPfxflckG9+18dRpEgg9t0XRN6YogC8 pBmA== X-Gm-Message-State: ANhLgQ3nT6mtQ0BMw6nSxOZx+YjAUGkjRVfRQ+g6kc8Mb3vQu8a31ACo idzDe9lGOXXzzZxCkiIOTih7ug== X-Google-Smtp-Source: ADFU+vsqTKXWkUwlZU65GnXLcGQeIusImXSF6/071PjPajjV9Zy+d6+78zX7Xm4MNtky83+YtZg6Ow== X-Received: by 2002:aa7:94b5:: with SMTP id a21mr295803pfl.290.1583925623087; Wed, 11 Mar 2020 04:20:23 -0700 (PDT) Received: from localhost ([2401:fa00:8f:203:30f2:7a9c:387e:6c7]) by smtp.gmail.com with ESMTPSA id q43sm4280776pjc.40.2020.03.11.04.20.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Mar 2020 04:20:22 -0700 (PDT) From: David Stevens To: Gerd Hoffmann , David Airlie Subject: [PATCH v3 1/4] dma-buf: add support for virtio exported objects Date: Wed, 11 Mar 2020 20:20:01 +0900 Message-Id: <20200311112004.47138-2-stevensd@chromium.org> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-goog In-Reply-To: <20200311112004.47138-1-stevensd@chromium.org> References: <20200311112004.47138-1-stevensd@chromium.org> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 12 Mar 2020 08:08:13 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, virtio-dev@lists.oasis-open.org, Thomas Zimmermann , "Michael S . Tsirkin" , Jason Wang , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, David Stevens , linux-media@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This change adds a new dma-buf operation that allows dma-bufs to be used by virtio drivers to share exported objects. The new operation allows the importing driver to query the exporting driver for the UUID which identifies the underlying exported object. Signed-off-by: David Stevens --- drivers/dma-buf/dma-buf.c | 12 ++++++++++++ include/linux/dma-buf.h | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index d4097856c86b..fa5210ba6aaa 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -1158,6 +1158,18 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr) } EXPORT_SYMBOL_GPL(dma_buf_vunmap); +int dma_buf_get_uuid(struct dma_buf *dmabuf, uuid_t *uuid) +{ + if (WARN_ON(!dmabuf) || !uuid) + return -EINVAL; + + if (!dmabuf->ops->get_uuid) + return -ENODEV; + + return dmabuf->ops->get_uuid(dmabuf, uuid); +} +EXPORT_SYMBOL_GPL(dma_buf_get_uuid); + #ifdef CONFIG_DEBUG_FS static int dma_buf_debug_show(struct seq_file *s, void *unused) { diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index abf5459a5b9d..00758523597d 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h @@ -251,6 +251,21 @@ struct dma_buf_ops { void *(*vmap)(struct dma_buf *); void (*vunmap)(struct dma_buf *, void *vaddr); + + /** + * @get_uuid + * + * This is called by dma_buf_get_uuid to get the UUID which identifies + * the buffer to virtio devices. + * + * This callback is optional. + * + * Returns: + * + * 0 on success or a negative error code on failure. On success uuid + * will be populated with the buffer's UUID. + */ + int (*get_uuid)(struct dma_buf *dmabuf, uuid_t *uuid); }; /** @@ -444,4 +459,7 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *, unsigned long); void *dma_buf_vmap(struct dma_buf *); void dma_buf_vunmap(struct dma_buf *, void *vaddr); + +int dma_buf_get_uuid(struct dma_buf *dmabuf, uuid_t *uuid); + #endif /* __DMA_BUF_H__ */ -- 2.25.1.481.gfbce0eb801-goog _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: virtio-dev-return-6916-cohuck=redhat.com@lists.oasis-open.org Sender: List-Post: List-Help: List-Unsubscribe: List-Subscribe: Received: from lists.oasis-open.org (oasis-open.org [10.110.1.242]) by lists.oasis-open.org (Postfix) with ESMTP id 7AD3F985FD9 for ; Wed, 11 Mar 2020 11:20:24 +0000 (UTC) From: David Stevens Date: Wed, 11 Mar 2020 20:20:01 +0900 Message-Id: <20200311112004.47138-2-stevensd@chromium.org> In-Reply-To: <20200311112004.47138-1-stevensd@chromium.org> References: <20200311112004.47138-1-stevensd@chromium.org> MIME-Version: 1.0 Subject: [virtio-dev] [PATCH v3 1/4] dma-buf: add support for virtio exported objects Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable To: Gerd Hoffmann , David Airlie Cc: Daniel Vetter , "Michael S . Tsirkin" , Jason Wang , Sumit Semwal , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Stevens , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, virtio-dev@lists.oasis-open.org List-ID: This change adds a new dma-buf operation that allows dma-bufs to be used by virtio drivers to share exported objects. The new operation allows the importing driver to query the exporting driver for the UUID which identifies the underlying exported object. Signed-off-by: David Stevens --- drivers/dma-buf/dma-buf.c | 12 ++++++++++++ include/linux/dma-buf.h | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index d4097856c86b..fa5210ba6aaa 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -1158,6 +1158,18 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, void *va= ddr) } EXPORT_SYMBOL_GPL(dma_buf_vunmap); =20 +int dma_buf_get_uuid(struct dma_buf *dmabuf, uuid_t *uuid) +{ +=09if (WARN_ON(!dmabuf) || !uuid) +=09=09return -EINVAL; + +=09if (!dmabuf->ops->get_uuid) +=09=09return -ENODEV; + +=09return dmabuf->ops->get_uuid(dmabuf, uuid); +} +EXPORT_SYMBOL_GPL(dma_buf_get_uuid); + #ifdef CONFIG_DEBUG_FS static int dma_buf_debug_show(struct seq_file *s, void *unused) { diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index abf5459a5b9d..00758523597d 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h @@ -251,6 +251,21 @@ struct dma_buf_ops { =20 =09void *(*vmap)(struct dma_buf *); =09void (*vunmap)(struct dma_buf *, void *vaddr); + +=09/** +=09 * @get_uuid +=09 * +=09 * This is called by dma_buf_get_uuid to get the UUID which identifies +=09 * the buffer to virtio devices. +=09 * +=09 * This callback is optional. +=09 * +=09 * Returns: +=09 * +=09 * 0 on success or a negative error code on failure. On success uuid +=09 * will be populated with the buffer's UUID. +=09 */ +=09int (*get_uuid)(struct dma_buf *dmabuf, uuid_t *uuid); }; =20 /** @@ -444,4 +459,7 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struc= t *, =09=09 unsigned long); void *dma_buf_vmap(struct dma_buf *); void dma_buf_vunmap(struct dma_buf *, void *vaddr); + +int dma_buf_get_uuid(struct dma_buf *dmabuf, uuid_t *uuid); + #endif /* __DMA_BUF_H__ */ --=20 2.25.1.481.gfbce0eb801-goog --------------------------------------------------------------------- To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org