From patchwork Mon Mar 21 07:51:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 8630031 Return-Path: X-Original-To: patchwork-linux-media@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 75DF29F36E for ; Mon, 21 Mar 2016 07:51:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7528D20279 for ; Mon, 21 Mar 2016 07:51:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4964720270 for ; Mon, 21 Mar 2016 07:51:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752594AbcCUHvD (ORCPT ); Mon, 21 Mar 2016 03:51:03 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:38401 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752638AbcCUHvB (ORCPT ); Mon, 21 Mar 2016 03:51:01 -0400 Received: by mail-wm0-f47.google.com with SMTP id l68so110862632wml.1 for ; Mon, 21 Mar 2016 00:51: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=hMpICxRQf63h0OkCtMwaD8ZH+alIzjPLtD3lGU+fg0I=; b=Apmu2ypqa5YjzfpOn47Z64dkHRtQ4UxqiQw2da9p8Iatqigg3EpmJJfqf/xynue9EX KzxDSGelE1ghPRx0rNA0RtH14f1VLcGP0V7592BnZ+Dtz1L4A15ekwd8uX+gT8ucbh0v 2P8wU1T6WEa5MppGj5RCHI704POpEikjG44dQ= 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=hMpICxRQf63h0OkCtMwaD8ZH+alIzjPLtD3lGU+fg0I=; b=Fu6XwOJ2Q15yCMiMPs4UKGMUzlZVxdQYXMCANZZXoM7cqFTn84Bdi2q7Ui8actrebL T3PHicORDePIjzYqnVFyiS1Fq7Fvmkwivaa8JrG/jBv5axcxeVo9Wp8cV2oedv5f81kO cECNloUGVuGbnssNpVpONHyOfuBCbkANgydjv+OlNHdUaED+VNCcdSQF6FbonbrJj9ag +BFVPwZpgrvorXGJ01kYnf+L/bS578Zjz0RFQeO5t3090VUvofhEuYuYQvFuN/S3h753 rTlTDt5p4zw5J7yv+6l7j8x+LmnJd1HFaeXB98crgjUbnXyWE8r7fxJMKYuMROt7LCyA Nvvg== X-Gm-Message-State: AD7BkJLbAxKnvZJnyTCHac0ftX8eOQLLVxEq331WYdd+piftv0Gx/GOxv6/vc1/jeBNJnQ== X-Received: by 10.28.104.131 with SMTP id d125mr11431306wmc.99.1458546660081; Mon, 21 Mar 2016 00:51:00 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:56b5:0:ac27:b86c:7764:9429]) by smtp.gmail.com with ESMTPSA id a1sm8387479wje.43.2016.03.21.00.50.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Mar 2016 00:50:59 -0700 (PDT) From: Daniel Vetter To: DRI Development Cc: Daniel Vetter , Chris Wilson , Tiago Vignatti , =?UTF-8?q?St=C3=A9phane=20Marchesin?= , David Herrmann , Sumit Semwal , Daniel Vetter , linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, intel-gfx@lists.freedesktop.org, devel@driverdev.osuosl.org, Hans Verkuil Subject: [PATCH] dma-buf: Update docs for SYNC ioctl Date: Mon, 21 Mar 2016 08:51:45 +0100 Message-Id: <1458546705-3564-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 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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. v2: Fix them typos (Hans). 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 Cc: Hans Verkuil Acked-by: Sumit Semwal Signed-off-by: Daniel Vetter Acked-by: Hans Verkuil Reviewed-by: Tiago Vignatti --- 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..ca44c5820585 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 + -EAGAIN 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 rely 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)