Received: by 10.223.176.5 with SMTP id f5csp1286915wra; Wed, 31 Jan 2018 04:15:59 -0800 (PST) X-Google-Smtp-Source: AH8x226tfDd5XyiehrgyMd8VTa21XJbx0ITt+f+h2YkHqfdqmJNlPivPNzEimiulfNJYZ43l+/Zu X-Received: by 2002:a17:902:1c3:: with SMTP id b61-v6mr28262917plb.190.1517400959031; Wed, 31 Jan 2018 04:15:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517400959; cv=none; d=google.com; s=arc-20160816; b=tOBGd2zm7AlPje1Ba9CK1ixOepYeE9+YVBD4KWqN+rGJnbArPAHb2ucUtAMA7f2rxi gb9+O9V9NnTu7X9U3flhpSIsOmW4kRXNxojOcTSa6v7vAhJs0MZoOeJUVdpLHjw+/XVZ /DHD3Gc9EKuVYmwuuLGEL3WYuC2jwrN5s5C002XDlwPwqaxI6M9T1XQpFVJsHFMlDlz4 RmJGVoIPcS+HptCvw2PoLqi05lqFUWJRH6i4vJJ/h2/5Z8VRADdq5AelMHiCu9TxovAy Kjep980URLjuxhbTfunoIjqGaUjZi7+Dn2JW14El2NMabkzdY/pejbWWe6MEM6zJRZBy ACMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ky4NnXcOhHrblDNMz6lrsxbwPj1hvc0zMqeofCCY8L0=; b=PkNSu+Yl0iYEUi+rL3PAPFy2qbLhLQV8lkJtqA/s6qGJbOLaAAr12yyqkpajQFiysn uIAlTPCZFbN003A9XjuVfzVN1b5NrtDb77cQb2rNXyXLk5PySQG86w1x3bWT98OcVo4T /yO8FyTbotzCkVJVKPoLSpPumJB5GqXIgcD5cwluqEdLuCTkbEwwhk0ktFazCCDD8AGW XOTBD8dSrqlh2+TiuIA1QZ8uujQfr8hJcRXDsfdsNTq6o9CikYrKKZ/aC61FOWY6w1wV gF+huBZt/R1yt1APtux9v082oAPgGd3PYfHsimn7TPxI1hHASLqRPkzoXvjS2WxTkZQg ZUWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1-v6si6143724plt.588.2018.01.31.04.15.44; Wed, 31 Jan 2018 04:15:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753680AbeAaME3 (ORCPT + 99 others); Wed, 31 Jan 2018 07:04:29 -0500 Received: from mga07.intel.com ([134.134.136.100]:28908 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752437AbeAaME1 (ORCPT ); Wed, 31 Jan 2018 07:04:27 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2018 04:04:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,440,1511856000"; d="scan'208";a="15836992" Received: from alexey-system-product-name.iil.intel.com ([10.236.193.125]) by fmsmga002.fm.intel.com with ESMTP; 31 Jan 2018 04:04:24 -0800 From: Alexey Skidanov To: devel@driverdev.osuosl.org, labbott@redhat.com, gregkh@linuxfoundation.org Cc: sumit.semwal@linaro.org, rve@android.com, tkjos@android.com, maco@android.com, linux-kernel@vger.kernel.org, Alexey Skidanov Subject: [PATCH v3] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap Date: Wed, 31 Jan 2018 14:03:42 +0200 Message-Id: <1517400222-2854-1-git-send-email-alexey.skidanov@intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Any driver may access shared buffers, created by ion, using dma_buf_vmap and dma_buf_vunmap dma-buf API that maps/unmaps previosuly allocated buffers into the kernel virtual address space. The implementation of these API is missing in the current ion implementation. Signed-off-by: Alexey Skidanov --- 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 f480885..4f1dc7f 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -327,6 +327,17 @@ static void ion_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset, { } +static void *ion_dma_buf_vmap(struct dma_buf *dmabuf) +{ + struct ion_buffer *buffer = dmabuf->priv; + + return buffer->vaddr; +} + +static void ion_dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr) +{ +} + static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, enum dma_data_direction direction) { @@ -388,6 +399,8 @@ static const struct dma_buf_ops dma_buf_ops = { .unmap_atomic = ion_dma_buf_kunmap, .map = ion_dma_buf_kmap, .unmap = ion_dma_buf_kunmap, + .vmap = ion_dma_buf_vmap, + .vunmap = ion_dma_buf_vunmap }; int ion_alloc(size_t len, unsigned int heap_id_mask, unsigned int flags) -- 2.7.4