Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-08 Thread Wei Hu (Xavier)
On 2017/11/1 20:26, Robin Murphy wrote: > On 01/11/17 07:46, Wei Hu (Xavier) wrote: >> >> On 2017/10/12 20:59, Robin Murphy wrote: >>> On 12/10/17 13:31, Wei Hu (Xavier) wrote: On 2017/10/1 0:10, Leon Romanovsky wrote: > On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote:

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-08 Thread Wei Hu (Xavier)
On 2017/11/1 20:26, Robin Murphy wrote: > On 01/11/17 07:46, Wei Hu (Xavier) wrote: >> >> On 2017/10/12 20:59, Robin Murphy wrote: >>> On 12/10/17 13:31, Wei Hu (Xavier) wrote: On 2017/10/1 0:10, Leon Romanovsky wrote: > On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote:

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-08 Thread Wei Hu (Xavier)
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

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-08 Thread Wei Hu (Xavier)
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

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-08 Thread Wei Hu (Xavier)
On 2017/11/7 23:58, Christoph Hellwig wrote: > On Tue, Nov 07, 2017 at 08:48:38AM -0700, Jason Gunthorpe wrote: >> Can't you just use vmalloc and dma_map that? Other drivers follow that >> approach.. > You can't easily due to the flushing requirements. We used to do that > in XFS and it led to

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-08 Thread Wei Hu (Xavier)
On 2017/11/7 23:58, Christoph Hellwig wrote: > On Tue, Nov 07, 2017 at 08:48:38AM -0700, Jason Gunthorpe wrote: >> Can't you just use vmalloc and dma_map that? Other drivers follow that >> approach.. > You can't easily due to the flushing requirements. We used to do that > in XFS and it led to

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-08 Thread Wei Hu (Xavier)
On 2017/11/7 14:32, Leon Romanovsky wrote: > On Tue, Nov 07, 2017 at 10:45:29AM +0800, Wei Hu (Xavier) wrote: >> >> On 2017/11/1 20:26, Robin Murphy wrote: >>> On 01/11/17 07:46, Wei Hu (Xavier) wrote: On 2017/10/12 20:59, Robin Murphy wrote: > On 12/10/17 13:31, Wei Hu (Xavier) wrote:

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-08 Thread Wei Hu (Xavier)
On 2017/11/7 14:32, Leon Romanovsky wrote: > On Tue, Nov 07, 2017 at 10:45:29AM +0800, Wei Hu (Xavier) wrote: >> >> On 2017/11/1 20:26, Robin Murphy wrote: >>> On 01/11/17 07:46, Wei Hu (Xavier) wrote: On 2017/10/12 20:59, Robin Murphy wrote: > On 12/10/17 13:31, Wei Hu (Xavier) wrote:

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-07 Thread Jason Gunthorpe
On Tue, Nov 07, 2017 at 07:58:05AM -0800, Christoph Hellwig wrote: > On Tue, Nov 07, 2017 at 08:48:38AM -0700, Jason Gunthorpe wrote: > > Can't you just use vmalloc and dma_map that? Other drivers follow that > > approach.. > > You can't easily due to the flushing requirements. We used to do

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-07 Thread Jason Gunthorpe
On Tue, Nov 07, 2017 at 07:58:05AM -0800, Christoph Hellwig wrote: > On Tue, Nov 07, 2017 at 08:48:38AM -0700, Jason Gunthorpe wrote: > > Can't you just use vmalloc and dma_map that? Other drivers follow that > > approach.. > > You can't easily due to the flushing requirements. We used to do

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-07 Thread Christoph Hellwig
On Tue, Nov 07, 2017 at 08:48:38AM -0700, Jason Gunthorpe wrote: > Can't you just use vmalloc and dma_map that? Other drivers follow that > approach.. You can't easily due to the flushing requirements. We used to do that in XFS and it led to problems. You need the page allocator + vmap +

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-07 Thread Christoph Hellwig
On Tue, Nov 07, 2017 at 08:48:38AM -0700, Jason Gunthorpe wrote: > Can't you just use vmalloc and dma_map that? Other drivers follow that > approach.. You can't easily due to the flushing requirements. We used to do that in XFS and it led to problems. You need the page allocator + vmap +

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-07 Thread Jason Gunthorpe
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

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-07 Thread Jason Gunthorpe
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

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-06 Thread Leon Romanovsky
On Tue, Nov 07, 2017 at 10:45:29AM +0800, Wei Hu (Xavier) wrote: > > > On 2017/11/1 20:26, Robin Murphy wrote: > > On 01/11/17 07:46, Wei Hu (Xavier) wrote: > >> > >> On 2017/10/12 20:59, Robin Murphy wrote: > >>> On 12/10/17 13:31, Wei Hu (Xavier) wrote: > On 2017/10/1 0:10, Leon Romanovsky

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-06 Thread Leon Romanovsky
On Tue, Nov 07, 2017 at 10:45:29AM +0800, Wei Hu (Xavier) wrote: > > > On 2017/11/1 20:26, Robin Murphy wrote: > > On 01/11/17 07:46, Wei Hu (Xavier) wrote: > >> > >> On 2017/10/12 20:59, Robin Murphy wrote: > >>> On 12/10/17 13:31, Wei Hu (Xavier) wrote: > On 2017/10/1 0:10, Leon Romanovsky

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-06 Thread Wei Hu (Xavier)
On 2017/11/1 20:26, Robin Murphy wrote: > On 01/11/17 07:46, Wei Hu (Xavier) wrote: >> >> On 2017/10/12 20:59, Robin Murphy wrote: >>> On 12/10/17 13:31, Wei Hu (Xavier) wrote: On 2017/10/1 0:10, Leon Romanovsky wrote: > On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote:

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-06 Thread Wei Hu (Xavier)
On 2017/11/1 20:26, Robin Murphy wrote: > On 01/11/17 07:46, Wei Hu (Xavier) wrote: >> >> On 2017/10/12 20:59, Robin Murphy wrote: >>> On 12/10/17 13:31, Wei Hu (Xavier) wrote: On 2017/10/1 0:10, Leon Romanovsky wrote: > On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote:

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-01 Thread Robin Murphy
On 01/11/17 07:46, Wei Hu (Xavier) wrote: > > > On 2017/10/12 20:59, Robin Murphy wrote: >> On 12/10/17 13:31, Wei Hu (Xavier) wrote: >>> >>> On 2017/10/1 0:10, Leon Romanovsky wrote: On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: > If the IOMMU is enabled, the length

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-01 Thread Robin Murphy
On 01/11/17 07:46, Wei Hu (Xavier) wrote: > > > On 2017/10/12 20:59, Robin Murphy wrote: >> On 12/10/17 13:31, Wei Hu (Xavier) wrote: >>> >>> On 2017/10/1 0:10, Leon Romanovsky wrote: On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: > If the IOMMU is enabled, the length

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-01 Thread Wei Hu (Xavier)
On 2017/10/12 20:59, Robin Murphy wrote: > On 12/10/17 13:31, Wei Hu (Xavier) wrote: >> >> On 2017/10/1 0:10, Leon Romanovsky wrote: >>> On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: If the IOMMU is enabled, the length of sg obtained from __iommu_map_sg_attrs is not

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-11-01 Thread Wei Hu (Xavier)
On 2017/10/12 20:59, Robin Murphy wrote: > On 12/10/17 13:31, Wei Hu (Xavier) wrote: >> >> On 2017/10/1 0:10, Leon Romanovsky wrote: >>> On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: If the IOMMU is enabled, the length of sg obtained from __iommu_map_sg_attrs is not

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-10-18 Thread Leon Romanovsky
On Wed, Oct 18, 2017 at 05:12:02PM +0800, Wei Hu (Xavier) wrote: > > > On 2017/10/18 16:42, Wei Hu (Xavier) wrote: > > > > > > On 2017/10/1 0:10, Leon Romanovsky wrote: > > > On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: > > > > If the IOMMU is enabled, the length of sg obtained

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-10-18 Thread Leon Romanovsky
On Wed, Oct 18, 2017 at 05:12:02PM +0800, Wei Hu (Xavier) wrote: > > > On 2017/10/18 16:42, Wei Hu (Xavier) wrote: > > > > > > On 2017/10/1 0:10, Leon Romanovsky wrote: > > > On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: > > > > If the IOMMU is enabled, the length of sg obtained

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-10-18 Thread Wei Hu (Xavier)
On 2017/10/18 16:42, Wei Hu (Xavier) wrote: On 2017/10/1 0:10, Leon Romanovsky wrote: On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: If the IOMMU is enabled, the length of sg obtained from __iommu_map_sg_attrs is not 4kB. When the IOVA is set with the sg dma address, the

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-10-18 Thread Wei Hu (Xavier)
On 2017/10/18 16:42, Wei Hu (Xavier) wrote: On 2017/10/1 0:10, Leon Romanovsky wrote: On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: If the IOMMU is enabled, the length of sg obtained from __iommu_map_sg_attrs is not 4kB. When the IOVA is set with the sg dma address, the

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-10-18 Thread Wei Hu (Xavier)
On 2017/10/1 0:10, Leon Romanovsky wrote: On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: If the IOMMU is enabled, the length of sg obtained from __iommu_map_sg_attrs is not 4kB. When the IOVA is set with the sg dma address, the IOVA will not be page continuous. and the VA

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-10-18 Thread Wei Hu (Xavier)
On 2017/10/1 0:10, Leon Romanovsky wrote: On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: If the IOMMU is enabled, the length of sg obtained from __iommu_map_sg_attrs is not 4kB. When the IOVA is set with the sg dma address, the IOVA will not be page continuous. and the VA

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-10-12 Thread Leon Romanovsky
On Thu, Oct 12, 2017 at 08:31:31PM +0800, Wei Hu (Xavier) wrote: > > > On 2017/10/1 0:10, Leon Romanovsky wrote: > > On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: > > > If the IOMMU is enabled, the length of sg obtained from > > > __iommu_map_sg_attrs is not 4kB. When the IOVA

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-10-12 Thread Leon Romanovsky
On Thu, Oct 12, 2017 at 08:31:31PM +0800, Wei Hu (Xavier) wrote: > > > On 2017/10/1 0:10, Leon Romanovsky wrote: > > On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: > > > If the IOMMU is enabled, the length of sg obtained from > > > __iommu_map_sg_attrs is not 4kB. When the IOVA

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-10-12 Thread Wei Hu (Xavier)
On 2017/10/1 0:10, Leon Romanovsky wrote: On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: If the IOMMU is enabled, the length of sg obtained from __iommu_map_sg_attrs is not 4kB. When the IOVA is set with the sg dma address, the IOVA will not be page continuous. and the VA

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-10-12 Thread Wei Hu (Xavier)
On 2017/10/1 0:10, Leon Romanovsky wrote: On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: If the IOMMU is enabled, the length of sg obtained from __iommu_map_sg_attrs is not 4kB. When the IOVA is set with the sg dma address, the IOVA will not be page continuous. and the VA

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-09-30 Thread Leon Romanovsky
On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: > If the IOMMU is enabled, the length of sg obtained from > __iommu_map_sg_attrs is not 4kB. When the IOVA is set with the sg > dma address, the IOVA will not be page continuous. and the VA > returned from dma_alloc_coherent is a

Re: [PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-09-30 Thread Leon Romanovsky
On Sat, Sep 30, 2017 at 05:28:59PM +0800, Wei Hu (Xavier) wrote: > If the IOMMU is enabled, the length of sg obtained from > __iommu_map_sg_attrs is not 4kB. When the IOVA is set with the sg > dma address, the IOVA will not be page continuous. and the VA > returned from dma_alloc_coherent is a

[PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-09-30 Thread Wei Hu (Xavier)
If the IOMMU is enabled, the length of sg obtained from __iommu_map_sg_attrs is not 4kB. When the IOVA is set with the sg dma address, the IOVA will not be page continuous. and the VA returned from dma_alloc_coherent is a vmalloc address. However, the VA obtained by the page_address is a

[PATCH for-next 2/4] RDMA/hns: Add IOMMU enable support in hip08

2017-09-30 Thread Wei Hu (Xavier)
If the IOMMU is enabled, the length of sg obtained from __iommu_map_sg_attrs is not 4kB. When the IOVA is set with the sg dma address, the IOVA will not be page continuous. and the VA returned from dma_alloc_coherent is a vmalloc address. However, the VA obtained by the page_address is a