From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Wei Hu (Xavier)" Subject: Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08 Date: Thu, 9 Nov 2017 09:30:08 +0800 Message-ID: <5A03AFA0.5090505@huawei.com> References: <1506763741-81429-1-git-send-email-xavier.huwei@huawei.com> <1506763741-81429-3-git-send-email-xavier.huwei@huawei.com> <20170930161023.GI2965@mtr-leonro.local> <59DF60A3.7080803@huawei.com> <5fe5f9b9-2c2b-ab3c-dafa-3e2add051bbb@arm.com> <59F97BBE.5070207@huawei.com> <5A011E49.6060407@huawei.com> <20171107154838.GC21466@ziepe.ca> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20171107154838.GC21466-uk2M96/98Pc@public.gmane.org> Sender: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Jason Gunthorpe Cc: Robin Murphy , Leon Romanovsky , shaobo.xu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, xavier.huwei-WVlzvzqoTvw@public.gmane.org, lijun_nudt-9Onoh4P/yGk@public.gmane.org, oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, charles.chenxin-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, linuxarm-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, liuyixian-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, zhangxiping3-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, shaoboxu-WVlzvzqoTvw@public.gmane.org List-Id: iommu@lists.linux-foundation.org On 2017/11/7 23:48, Jason Gunthorpe wrote: > On Tue, Nov 07, 2017 at 10:45:29AM +0800, Wei Hu (Xavier) wrote: > >> We reconstruct the code as below: >> It replaces dma_alloc_coherent with __get_free_pages and >> dma_map_single functions. So, we can vmap serveral ptrs returned by >> __get_free_pages, right? > Can't you just use vmalloc and dma_map that? Other drivers follow that > approach.. > > However, dma_alloc_coherent and dma_map_single are not the same > thing. You can't touch the vmap memory once you call dma_map unless > the driver also includes dma cache flushing calls in all the right > places. > > The difference is that alloc_coherent will return non-cachable memory > if necessary, while get_free_pages does not. > > Jason Hi, Jason Thanks for your suggestion. We will fix it. Regards Wei Hu > > . > -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f70.google.com (mail-pg0-f70.google.com [74.125.83.70]) by kanga.kvack.org (Postfix) with ESMTP id 23B1D440460 for ; Wed, 8 Nov 2017 20:30:38 -0500 (EST) Received: by mail-pg0-f70.google.com with SMTP id p9so4464027pgc.6 for ; Wed, 08 Nov 2017 17:30:38 -0800 (PST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com. [45.249.212.190]) by mx.google.com with ESMTPS id k6si4832192pgq.102.2017.11.08.17.30.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 08 Nov 2017 17:30:37 -0800 (PST) Subject: Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08 References: <1506763741-81429-1-git-send-email-xavier.huwei@huawei.com> <1506763741-81429-3-git-send-email-xavier.huwei@huawei.com> <20170930161023.GI2965@mtr-leonro.local> <59DF60A3.7080803@huawei.com> <5fe5f9b9-2c2b-ab3c-dafa-3e2add051bbb@arm.com> <59F97BBE.5070207@huawei.com> <5A011E49.6060407@huawei.com> <20171107154838.GC21466@ziepe.ca> From: "Wei Hu (Xavier)" Message-ID: <5A03AFA0.5090505@huawei.com> Date: Thu, 9 Nov 2017 09:30:08 +0800 MIME-Version: 1.0 In-Reply-To: <20171107154838.GC21466@ziepe.ca> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Jason Gunthorpe Cc: Robin Murphy , Leon Romanovsky , shaobo.xu@intel.com, xavier.huwei@tom.com, lijun_nudt@163.com, oulijun@huawei.com, linux-rdma@vger.kernel.org, charles.chenxin@huawei.com, linuxarm@huawei.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, dledford@redhat.com, liuyixian@huawei.com, zhangxiping3@huawei.com, shaoboxu@tom.com On 2017/11/7 23:48, Jason Gunthorpe wrote: > On Tue, Nov 07, 2017 at 10:45:29AM +0800, Wei Hu (Xavier) wrote: > >> We reconstruct the code as below: >> It replaces dma_alloc_coherent with __get_free_pages and >> dma_map_single functions. So, we can vmap serveral ptrs returned by >> __get_free_pages, right? > Can't you just use vmalloc and dma_map that? Other drivers follow that > approach.. > > However, dma_alloc_coherent and dma_map_single are not the same > thing. You can't touch the vmap memory once you call dma_map unless > the driver also includes dma cache flushing calls in all the right > places. > > The difference is that alloc_coherent will return non-cachable memory > if necessary, while get_free_pages does not. > > Jason Hi, Jason Thanks for your suggestion. We will fix it. Regards Wei Hu > > . > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752961AbdKIBaY (ORCPT ); Wed, 8 Nov 2017 20:30:24 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:9980 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752727AbdKIBaX (ORCPT ); Wed, 8 Nov 2017 20:30:23 -0500 Subject: Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08 To: Jason Gunthorpe References: <1506763741-81429-1-git-send-email-xavier.huwei@huawei.com> <1506763741-81429-3-git-send-email-xavier.huwei@huawei.com> <20170930161023.GI2965@mtr-leonro.local> <59DF60A3.7080803@huawei.com> <5fe5f9b9-2c2b-ab3c-dafa-3e2add051bbb@arm.com> <59F97BBE.5070207@huawei.com> <5A011E49.6060407@huawei.com> <20171107154838.GC21466@ziepe.ca> CC: Robin Murphy , Leon Romanovsky , , , , , , , , , , , , , , From: "Wei Hu (Xavier)" Message-ID: <5A03AFA0.5090505@huawei.com> Date: Thu, 9 Nov 2017 09:30:08 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20171107154838.GC21466@ziepe.ca> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.57.115.182] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.5A03AFAB.0104,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 7a7349b7098a8622296339ee4102705a Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/11/7 23:48, Jason Gunthorpe wrote: > On Tue, Nov 07, 2017 at 10:45:29AM +0800, Wei Hu (Xavier) wrote: > >> We reconstruct the code as below: >> It replaces dma_alloc_coherent with __get_free_pages and >> dma_map_single functions. So, we can vmap serveral ptrs returned by >> __get_free_pages, right? > Can't you just use vmalloc and dma_map that? Other drivers follow that > approach.. > > However, dma_alloc_coherent and dma_map_single are not the same > thing. You can't touch the vmap memory once you call dma_map unless > the driver also includes dma cache flushing calls in all the right > places. > > The difference is that alloc_coherent will return non-cachable memory > if necessary, while get_free_pages does not. > > Jason Hi, Jason Thanks for your suggestion. We will fix it. Regards Wei Hu > > . >