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: 8630061 Return-Path: X-Original-To: patchwork-dri-devel@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 7FDE79F36E for ; Mon, 21 Mar 2016 07:51:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 78FC820279 for ; Mon, 21 Mar 2016 07:51:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8784920270 for ; Mon, 21 Mar 2016 07:51:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A0BDD6E23C; Mon, 21 Mar 2016 07:51:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x230.google.com (mail-wm0-x230.google.com [IPv6:2a00:1450:400c:c09::230]) by gabe.freedesktop.org (Postfix) with ESMTPS id 47D416E23B for ; Mon, 21 Mar 2016 07:51:02 +0000 (UTC) Received: by mail-wm0-x230.google.com with SMTP id l68so140664526wml.0 for ; Mon, 21 Mar 2016 00:51:02 -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=DS78uLHYIZCfRp/UiAzdRWHBLJMIB8TrKCWPCfkIvjWw4jeXqsKkpGKrG8P9dQZaD7 0Irib+uSezd7cPoQKrKEwsxWOk76+P5h2G+6ahHyOYpBhn7IFRWX7VmXXnQo0hkeQvMh NOUN+4TGLouGGZOgMszlaQGTV2Dw9UUXxMGJYfii6KkI8o9kNMDXVL0x13umrvtrAEJx rMPaKIfPAcBozk/g49ghp9nOI1rd0M2Z5K8PfU02BGWT+qanfBFiEPPUfwlRI+9KAUGF 8LtrMZdY1sm3Ir45OquEWpUKxIPA29B2zZ/sDxCULI6Mah7H6PMcNWnmXfqFHgjGDjEw Ib+w== X-Gm-Message-State: AD7BkJIsMMmGgP6wUGI88pAFtEkDDvmC8wrwnkBuWargfz6aAdINiaa9OwvTWjCri22mOw== 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 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 Cc: devel@driverdev.osuosl.org, Daniel Vetter , Daniel Vetter , intel-gfx@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, =?UTF-8?q?St=C3=A9phane=20Marchesin?= , linux-media@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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. 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)