From patchwork Wed May 25 19:48:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9136141 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DB6C7607D3 for ; Wed, 25 May 2016 19:51:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA8D3281D4 for ; Wed, 25 May 2016 19:51:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD349282B3; Wed, 25 May 2016 19:51:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5CCD9281D4 for ; Wed, 25 May 2016 19:51:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b5eos-0005R8-T3; Wed, 25 May 2016 19:50:18 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b5eoo-0005QU-NQ for linux-arm-kernel@bombadil.infradead.org; Wed, 25 May 2016 19:50:14 +0000 Received: from mail-qk0-f169.google.com ([209.85.220.169]) by merlin.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1b5eom-0005Ks-Sc for linux-arm-kernel@lists.infradead.org; Wed, 25 May 2016 19:50:13 +0000 Received: by mail-qk0-f169.google.com with SMTP id h185so14795201qke.2 for ; Wed, 25 May 2016 12:49:49 -0700 (PDT) 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; bh=8etTKom8f5FiY5MzDS7feqB+L5yoX3xkbbRSSDwJ5RQ=; b=ma4ioGC69dKas/nugAvwVihEHhZx2Ne2F75BK5UoLOYAn8Y3R94BIBNserRnm4s3Cg lWf0c3F0B21BiBRhkQ9cUo7+pGsQ0cJ0towM3iscSbfQoIPXnnfzLNzKbxbS+II78Vvn cjY9UcOpFi7xK64/3sjfakjm70KI0AhdAJZlmCdfcXl04hDh1iIFbN60MZcyGtEJtWeF gNmSeYClsWWZdqBBWe5MtQDpH0fVyfklIPu2/M9ZJoBUdTr+WqRjtSZ1fxsfTCsHKp30 d6FwHQ0QFJrWk9tR6FsTdBqCcpwvzaRx3JZHJ2aJ4+mbdesAcYiKtO4FFAa+hz/xkHiF pDng== X-Gm-Message-State: ALyK8tLIy8kT/8rAPUa1RFqWOcCFzwa67oFu3UZPVpD8SVMgzTgxzsVnwjZgisHUWu5zM4aF X-Received: by 10.55.97.74 with SMTP id v71mr5662778qkb.39.1464205698523; Wed, 25 May 2016 12:48:18 -0700 (PDT) Received: from labbott-redhat-machine.redhat.com ([2601:602:9800:177f::337f]) by smtp.gmail.com with ESMTPSA id w48sm101110qgd.42.2016.05.25.12.48.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 May 2016 12:48:17 -0700 (PDT) From: Laura Abbott To: Sumit Semwal , John Stultz , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Riley Andrews Subject: [RFC][PATCH 2/3] staging: ion: Add support for syncing with DMA_BUF_IOCTL_SYNC Date: Wed, 25 May 2016 12:48:03 -0700 Message-Id: <1464205684-5587-3-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464205684-5587-1-git-send-email-labbott@redhat.com> References: <1464205684-5587-1-git-send-email-labbott@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160525_155012_956208_74930BB1 X-CRM114-Status: GOOD ( 12.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, Jon Medhurst , Android Kernel Team , Greg Kroah-Hartman , Daniel Vetter , Will Deacon , Russell King , linux-kernel@vger.kernel.org, linaro-mm-sig@lists.linaro.org, Rohit kumar , Bryan Huntsman , Jeremy Gebben , Eun Taik Lee , Catalin Marinas , Liviu Dudau , Laura Abbott , Mitchel Humpherys , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP dma_buf added support for a userspace syncing ioctl. It is implemented by calling dma_buf_begin_cpu_access and dma_buf_end_cpu_access. Ion currently lacks cache operations on this code path. Add them for compatibility with the dma_buf ioctl. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 9282d96a..2096592 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -1117,6 +1117,11 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, mutex_lock(&buffer->lock); vaddr = ion_buffer_kmap_get(buffer); mutex_unlock(&buffer->lock); + + if (direction != DMA_TO_DEVICE) { + ion_invalidate_buffer(buffer); + } + return PTR_ERR_OR_ZERO(vaddr); } @@ -1129,6 +1134,12 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf, ion_buffer_kmap_put(buffer); mutex_unlock(&buffer->lock); + if (direction == DMA_FROM_DEVICE) { + ion_invalidate_buffer(buffer); + } else { + ion_clean_buffer(buffer); + } + return 0; } @@ -1259,6 +1270,8 @@ static int ion_sync_for_device(struct ion_client *client, int fd) struct dma_buf *dmabuf; struct ion_buffer *buffer; + WARN_ONCE(1, "This API is deprecated in favor of the dma_buf ioctl\n"); + dmabuf = dma_buf_get(fd); if (IS_ERR(dmabuf)) return PTR_ERR(dmabuf);