From patchwork Mon Mar 21 07:30:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 8629941 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AADC29F372 for ; Mon, 21 Mar 2016 07:30:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BBE0E20272 for ; Mon, 21 Mar 2016 07:30:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C199720270 for ; Mon, 21 Mar 2016 07:30:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B0296E0D9; Mon, 21 Mar 2016 07:30:03 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) by gabe.freedesktop.org (Postfix) with ESMTPS id E33416E15D for ; Mon, 21 Mar 2016 07:30:00 +0000 (UTC) Received: by mail-wm0-x234.google.com with SMTP id p65so110371635wmp.0 for ; Mon, 21 Mar 2016 00:30:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=b2GV87w77tPMxReMIEtWHdSfvVW2KgBXi5SPDOjqqok=; b=hQaHTRifepdQVfQ1hiv1D91J2SsPKhX580gLy1i5S+FflMrA0sB3ARAtbAgGKydCC/ k/Bc+3PVy5SekHgXc0rwvbEQwODHru9WMUnYXiSOEbZQLesb5nV47HhHQ72rdwv+DOep AtGzre56Ua4b+cQzr5Ydlf5m3sL9B+NMKyHSE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=b2GV87w77tPMxReMIEtWHdSfvVW2KgBXi5SPDOjqqok=; b=KRlQwE1RxyVe5Ji7e8HEUgq/lhMwzCdxDl2Gffx2ztD0dWSml3mCWETy/wZQAEpvzp QL5keceBDm8/+KiA2jvysOASVbbkiHtpOUhDTNnCN4ElY0ryW7NRHG4IqzR8c5aGDKJs 7SliT+Q3Jw7jw4JVub2SFv8/bDgVR+qmS452moH9ah5N7SIIw7RnWweOJxWbRLI+6ygG jFSXjCKUNWUx8f6lHUuUinIZ5seTvzLsvf4w5oy5daDYs/oXhdQxToxzNfae/H4+WrR5 p1gMvA/fu4Z8gpKXZ4JckBySg1FpWRPYUl2kkpQe2dpE8JdUpn2/kBURDZCe7V8xQwiO 5iQg== X-Gm-Message-State: AD7BkJJY1bAlfJsIK3bWFOa2uemmz7p6XusuajJIcvJK7HP+Cc/X+wZeR9sTUdJJPCRC1g== X-Received: by 10.28.111.92 with SMTP id k89mr12711773wmc.36.1458545398841; Mon, 21 Mar 2016 00:29:58 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:56b5:0:ac27:b86c:7764:9429]) by smtp.gmail.com with ESMTPSA id o128sm11005517wmb.19.2016.03.21.00.29.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Mar 2016 00:29:58 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Mon, 21 Mar 2016 08:30:43 +0100 Message-Id: <1458545443-3302-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.8.0.rc3 In-Reply-To: References: MIME-Version: 1.0 Cc: devel@driverdev.osuosl.org, Daniel Vetter , Daniel Vetter , intel-gfx@lists.freedesktop.org, David Herrmann , linaro-mm-sig@lists.linaro.org, Sumit Semwal , linux-media@vger.kernel.org Subject: [Intel-gfx] [PATCH] dma-buf: Update docs for SYNC ioctl X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Just a bit of wording polish plus mentioning that it can fail and must be restarted. Requested by Sumit. Cc: Chris Wilson Cc: Tiago Vignatti Cc: Stéphane Marchesin Cc: David Herrmann Cc: Sumit Semwal Cc: Daniel Vetter CC: linux-media@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: linaro-mm-sig@lists.linaro.org Cc: intel-gfx@lists.freedesktop.org Cc: devel@driverdev.osuosl.org Signed-off-by: Daniel Vetter Acked-by: Sumit Semwal --- Documentation/dma-buf-sharing.txt | 11 ++++++----- drivers/dma-buf/dma-buf.c | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Documentation/dma-buf-sharing.txt b/Documentation/dma-buf-sharing.txt index 32ac32e773e1..5c4e3e586ec8 100644 --- a/Documentation/dma-buf-sharing.txt +++ b/Documentation/dma-buf-sharing.txt @@ -352,7 +352,8 @@ Being able to mmap an export dma-buf buffer object has 2 main use-cases: No special interfaces, userspace simply calls mmap on the dma-buf fd, making sure that the cache synchronization ioctl (DMA_BUF_IOCTL_SYNC) is *always* - used when the access happens. This is discussed next paragraphs. + used when the access happens. Note that DMA_BUF_IOCTL_SYNC can fail with + -EGAIN or -EINTR, in which case it must be restarted. Some systems might need some sort of cache coherency management e.g. when CPU and GPU domains are being accessed through dma-buf at the same time. To @@ -366,10 +367,10 @@ Being able to mmap an export dma-buf buffer object has 2 main use-cases: want (with the new data being consumed by the GPU or say scanout device) - munmap once you don't need the buffer any more - Therefore, for correctness and optimal performance, systems with the memory - cache shared by the GPU and CPU i.e. the "coherent" and also the - "incoherent" are always required to use SYNC_START and SYNC_END before and - after, respectively, when accessing the mapped address. + For correctness and optimal performance, it is always required to use + SYNC_START and SYNC_END before and after, respectively, when accessing the + mapped address. Userspace cannot on coherent access, even when there are + systems where it just works without calling these ioctls. 2. Supporting existing mmap interfaces in importers diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 774a60f4309a..4a2c07ee6677 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -612,7 +612,7 @@ EXPORT_SYMBOL_GPL(dma_buf_begin_cpu_access); * @dmabuf: [in] buffer to complete cpu access for. * @direction: [in] length of range for cpu access. * - * This call must always succeed. + * Can return negative error values, returns 0 on success. */ int dma_buf_end_cpu_access(struct dma_buf *dmabuf, enum dma_data_direction direction)