Received: by 10.223.176.5 with SMTP id f5csp2337554wra; Wed, 31 Jan 2018 22:10:35 -0800 (PST) X-Google-Smtp-Source: AH8x224HRsq76sDDIENnAIDCwLnalN95wUVXwrkD5tax7hnstDDaGV0sYjrBqwNr+cVjpdkJTMGY X-Received: by 2002:a17:902:6c:: with SMTP id 99-v6mr28903630pla.409.1517465434937; Wed, 31 Jan 2018 22:10:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517465434; cv=none; d=google.com; s=arc-20160816; b=eJeJM2ESGx6O29BvI0vU1TxgMBUBGrv3aeOGTXlVnbG2gnsnqBIKzRsTSYGqftWwcF ZfZpgFGn7DwBTOovind05mKLNbZTrkpX4nJaBrudBmhCVY//WKDlTv3Mv8gNhMkXWurm 3T/0bnW/skFmRHaQgBByr/AteX4XQvNzxO+2YSYXhkvyHm6SsG/1+5KRwFdv++tCqHMd ISPIB29G3ogrEf8fbIfvWXL/qA2ll6mhE1A1k8hi2mpBNDVgyCj6ESq12r1aI0+orBpr /cvn4fxTutlJQSgT1csJt8uO+X9f/46lGlmDYoSH6nkSemEke+E07jKe4l2/C2qTxqBD 3IvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=6GnDEZpDJrAdfwrh0xhpT0HhmX+Hks47vEODbI4Vynk=; b=Ul/0JKSUUKxHenc/DK+UkdZAZtuoMozKd0MjD8cATdS9TITCty5k+Ia0OkZFqUzQ80 GyEpzRoYRY+927jSblFhH/f6PaVZKdWWvVUn1guDkVVA/Pd91vAjfXpj+tQumjpcZHAG 2PSFelr+a9HSWR1XOys2RApmcOEGzWOBCelmYQ5885HpRPP5x83zC9f3BwRQw++khLRZ Qdap7ZGZocldTPEuC3pv9sR0vusS7YnXqxVAv7faqtrRBXTIc4XNTWdhDDK+m0GX9HGu D/DOKWXsoq8b4rekAEpszpqtrWRsEnR3+YrbuynU9qN3jgIhgPqBDSNstsjNcsXbzUSh L+bg== 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 d9si2918327pgp.285.2018.01.31.22.10.20; Wed, 31 Jan 2018 22:10:34 -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 S1751604AbeBAGJ5 (ORCPT + 99 others); Thu, 1 Feb 2018 01:09:57 -0500 Received: from mga11.intel.com ([192.55.52.93]:14366 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751172AbeBAGJz (ORCPT ); Thu, 1 Feb 2018 01:09:55 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2018 22:09:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,443,1511856000"; d="scan'208";a="27156581" Received: from alexey-system-product-name.iil.intel.com (HELO [10.236.193.125]) ([10.236.193.125]) by fmsmga001.fm.intel.com with ESMTP; 31 Jan 2018 22:09:39 -0800 Subject: Re: [PATCH v3] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap To: Greg KH Cc: devel@driverdev.osuosl.org, labbott@redhat.com, tkjos@android.com, rve@android.com, linux-kernel@vger.kernel.org, maco@android.com, sumit.semwal@linaro.org References: <1517400222-2854-1-git-send-email-alexey.skidanov@intel.com> <20180131130047.GA22917@kroah.com> From: Alexey Skidanov Message-ID: <89be45dd-ac0e-4efb-2b21-e6c07b0cd66e@intel.com> Date: Thu, 1 Feb 2018 08:10:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180131130047.GA22917@kroah.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/31/2018 03:00 PM, Greg KH wrote: > On Wed, Jan 31, 2018 at 02:03:42PM +0200, Alexey Skidanov wrote: >> 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 >> --- > > No review from any other Intel developers? :( Will add. > > Anyway, what in-tree driver needs access to these functions? I'm not sure that there are the in-tree drivers using these functions and ion as buffer exporter because they are not implemented in ion :) But there are some in-tree drivers using these APIs (gpu drivers) with other buffer exporters. > > And are you sure that you don't need to do any "real" logic in the > vmap/vunmap calls? That feels like there would be some reference > counting problems here. dma_buf_start_cpu_access is called before the call to dma_buf_vmap. It actually increments the reference count. dma_buf_end_cpu_access is called after the dma_buf_vunmap. It actually decrements the reference count.>> >> 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; > > Just call ion_dma_buf_kmap(dmabuf, 0)? Sure. > > Again, please get this reviewed by someone else in Intel first. Don't > ignore the resources you have, to do so would be foolish :) Sure. Will do. > > thanks, > > greg k-h > Thanks, Alexey