search for: dma_address

Displaying 20 results from an estimated 83 matches for "dma_address".

2023 Mar 02
1
[PATCH vhost v1 02/12] virtio_ring: split: separate DMA codes
DMA-related logic is separated from the virtqueue_add_vring_split() to prepare for subsequent support for premapped. DMA address will be saved as sg->dma_address, then virtqueue_add_vring_split() will use it directly. If it is a premapped scene, the transmitted sgs should have saved DMA address in dma_address, and in virtio core, we need to pass virtqueue_map_sgs(). Signed-off-by: Xuan Zhuo <xuanzhuo at linux.alibaba.com> --- drivers/virtio/virtio_...
2023 May 09
12
[PATCH vhost v8 00/12] virtio core prepares for AF_XDP
...| 771670 Before achieving the function of Virtio-Net, we also have to let virtio core support these features: 1. virtio core support premapped 2. virtio core support reset per-queue 3. introduce DMA APIs to virtio core Please review. Thanks. v8: 1. vring_sg_address: check by sg_page(sg) not dma_address. Because 0 is a valid dma address 2. remove unused code from vring_map_one_sg() v7: 1. virtqueue_dma_dev() return NULL when virtio is without DMA API. v6: 1. change the size of the flags to u32. v5: 1. fix for error handler 2. add flags to record internal dma mapping v4: 1. rename map_int...
2023 Mar 21
11
[PATCH vhost v3 00/11] virtio core prepares for AF_XDP
...so have to let virtio core support these features: 1. virtio core support premapped 2. virtio core support reset per-queue 3. introduce DMA APIs to virtio core Please review. Thanks. v3: 1. add map_inter to struct desc state to reocrd whether virtio core do dma map v2: 1. based on sgs[0]->dma_address to judgment is premapped 2. based on extra.addr to judgment to do unmap for no-indirect desc 3. based on indir_desc to judgment to do unmap for indirect desc 4. rename virtqueue_get_dma_dev to virtqueue_dma_dev v1: 1. expose dma device. NO introduce the api for dma and sync 2. split some comm...
2023 Mar 21
1
[PATCH vhost v3 01/11] virtio_ring: split: separate dma codes
DMA-related logic is separated from the virtqueue_add_split() to one new function. DMA address will be saved as sg->dma_address if use_dma_api is true, then virtqueue_add_split() will use it directly. Unmap operation will be simpler. The purpose of this is to facilitate subsequent support to receive dma address mapped by drivers. Signed-off-by: Xuan Zhuo <xuanzhuo at linux.alibaba.com> --- drivers/virtio/virtio_rin...
2023 Mar 22
11
[PATCH vhost v4 00/11] virtio core prepares for AF_XDP
...DMA APIs to virtio core Please review. Thanks. v4: 1. rename map_inter to dma_map_internal 2. fix: Excess function parameter 'vq' description in 'virtqueue_dma_dev' v3: 1. add map_inter to struct desc state to reocrd whether virtio core do dma map v2: 1. based on sgs[0]->dma_address to judgment is premapped 2. based on extra.addr to judgment to do unmap for no-indirect desc 3. based on indir_desc to judgment to do unmap for indirect desc 4. rename virtqueue_get_dma_dev to virtqueue_dma_dev v1: 1. expose dma device. NO introduce the api for dma and sync 2. split some comm...
2023 Mar 24
11
[PATCH vhost v5 00/11] virtio core prepares for AF_XDP
...ler 2. add flags to record internal dma mapping v4: 1. rename map_inter to dma_map_internal 2. fix: Excess function parameter 'vq' description in 'virtqueue_dma_dev' v3: 1. add map_inter to struct desc state to reocrd whether virtio core do dma map v2: 1. based on sgs[0]->dma_address to judgment is premapped 2. based on extra.addr to judgment to do unmap for no-indirect desc 3. based on indir_desc to judgment to do unmap for indirect desc 4. rename virtqueue_get_dma_dev to virtqueue_dma_dev v1: 1. expose dma device. NO introduce the api for dma and sync 2. split some comm...
2023 Mar 27
11
[PATCH vhost v6 00/11] virtio core prepares for AF_XDP
...ler 2. add flags to record internal dma mapping v4: 1. rename map_inter to dma_map_internal 2. fix: Excess function parameter 'vq' description in 'virtqueue_dma_dev' v3: 1. add map_inter to struct desc state to reocrd whether virtio core do dma map v2: 1. based on sgs[0]->dma_address to judgment is premapped 2. based on extra.addr to judgment to do unmap for no-indirect desc 3. based on indir_desc to judgment to do unmap for indirect desc 4. rename virtqueue_get_dma_dev to virtqueue_dma_dev v1: 1. expose dma device. NO introduce the api for dma and sync 2. split some comm...
2023 Apr 25
12
[PATCH vhost v7 00/11] virtio core prepares for AF_XDP
...ler 2. add flags to record internal dma mapping v4: 1. rename map_inter to dma_map_internal 2. fix: Excess function parameter 'vq' description in 'virtqueue_dma_dev' v3: 1. add map_inter to struct desc state to reocrd whether virtio core do dma map v2: 1. based on sgs[0]->dma_address to judgment is premapped 2. based on extra.addr to judgment to do unmap for no-indirect desc 3. based on indir_desc to judgment to do unmap for indirect desc 4. rename virtqueue_get_dma_dev to virtqueue_dma_dev v1: 1. expose dma device. NO introduce the api for dma and sync 2. split some comm...
2023 Apr 25
1
[PATCH vhost v7 01/11] virtio_ring: split: separate dma codes
DMA-related logic is separated from the virtqueue_add_split() to one new function. DMA address will be saved as sg->dma_address if use_dma_api is true, then virtqueue_add_split() will use it directly. Unmap operation will be simpler. The purpose of this is to facilitate subsequent support to receive dma address mapped by drivers. Signed-off-by: Xuan Zhuo <xuanzhuo at linux.alibaba.com> --- drivers/virtio/virtio_rin...
2014 Jul 31
2
[PATCH v5] drm/nouveau: map pages using DMA API
...ttm->bdev); device = nv_device(drm->device); dev = drm->dev; + pdev = nv_device_base(device); #if __OS_HAS_AGP if (drm->agp.stat == ENABLED) { @@ -1377,17 +1379,22 @@ nouveau_ttm_tt_populate(struct ttm_tt *ttm) } for (i = 0; i < ttm->num_pages; i++) { - ttm_dma->dma_address[i] = nv_device_map_page(device, - ttm->pages[i]); - if (!ttm_dma->dma_address[i]) { + dma_addr_t addr; + + addr = dma_map_page(pdev, ttm->pages[i], 0, PAGE_SIZE, + DMA_BIDIRECTIONAL); + + if (dma_mapping_error(pdev, addr)) { while (--i) { - nv_device_unmap_page...
2018 Feb 27
4
[PATCH 4/5] drm/ttm: add ttm_sg_tt_init
...; --- a/drivers/gpu/drm/ttm/ttm_tt.c > +++ b/drivers/gpu/drm/ttm/ttm_tt.c > @@ -108,6 +108,16 @@ static int ttm_dma_tt_alloc_page_directory(struct ttm_dma_tt *ttm) > return 0; > } > > +static int ttm_sg_tt_alloc_page_directory(struct ttm_dma_tt *ttm) > +{ > + ttm->dma_address = kvmalloc_array(ttm->ttm.num_pages, > + sizeof(*ttm->dma_address), > + GFP_KERNEL | __GFP_ZERO); > + if (!ttm->dma_address) > + return -ENOMEM; > + return 0; > +} > + > #ifdef CONFIG_X86 > static inline int ttm_tt_set_page_caching(struct page *p...
2023 Mar 22
1
[PATCH vhost v4 01/11] virtio_ring: split: separate dma codes
DMA-related logic is separated from the virtqueue_add_split() to one new function. DMA address will be saved as sg->dma_address if use_dma_api is true, then virtqueue_add_split() will use it directly. Unmap operation will be simpler. The purpose of this is to facilitate subsequent support to receive dma address mapped by drivers. Signed-off-by: Xuan Zhuo <xuanzhuo at linux.alibaba.com> --- drivers/virtio/virtio_rin...
2023 Feb 20
2
[PATCH vhost 01/10] virtio_ring: split: refactor virtqueue_add_split() for premapped
...for (sg = sgs[n]; sg; sg = sg_next(sg)) { > + dma_addr_t addr = vring_map_one_sg(vq, sg, DMA_TO_DEVICE); > + > + if (vring_mapping_error(vq, addr)) > + return -ENOMEM; > + > + sg->dma_address = addr; > + } > + } > + for (; n < (out_sgs + in_sgs); n++) { > + for (sg = sgs[n]; sg; sg = sg_next(sg)) { > + dma_addr_t addr = vring_map_one_sg(vq, sg, DMA_FROM_DEVICE); > + > + if (vring_...
2014 Aug 04
0
[PATCH v5] drm/nouveau: map pages using DMA API
...); > dev = drm->dev; > + pdev = nv_device_base(device); > > #if __OS_HAS_AGP > if (drm->agp.stat == ENABLED) { > @@ -1377,17 +1379,22 @@ nouveau_ttm_tt_populate(struct ttm_tt *ttm) > } > > for (i = 0; i < ttm->num_pages; i++) { > - ttm_dma->dma_address[i] = nv_device_map_page(device, > - ttm->pages[i]); > - if (!ttm_dma->dma_address[i]) { > + dma_addr_t addr; > + > + addr = dma_map_page(pdev, ttm->pages[i], 0, PAGE_SIZE, > + DMA_BIDIRECTIONAL); > + > + if (dma_mapping_error(pdev, addr)) { &gt...
2023 Mar 02
1
[PATCH vhost v1 06/12] virtio_ring: packed: separate DMA codes
DMA-related logic is separated from the virtqueue_add_vring_packed() to prepare for subsequent support for premapped. DMA address will be saved as sg->dma_address, then virtqueue_add_vring_packed() will use it directly. If it is a premapped scene, the transmitted sgs should have saved DMA address in dma_address, and in virtio core, we need to pass virtqueue_map_sgs(). Signed-off-by: Xuan Zhuo <xuanzhuo at linux.alibaba.com> --- drivers/virtio/virtio...
2023 Mar 22
1
[PATCH vhost v4 04/11] virtio_ring: split: support premapped
virtio core only supports virtual addresses, dma is completed in virtio core. In some scenarios (such as the AF_XDP), the memory is allocated and DMA mapping is completed in advance, so it is necessary for us to support passing the DMA address to virtio core. Drives can use sg->dma_address to pass the mapped dma address to virtio core. If one sg->dma_address is used then all sgs must use sg->dma_address, otherwise all must be null when passing it to the APIs of virtio. Signed-off-by: Xuan Zhuo <xuanzhuo at linux.alibaba.com> --- drivers/virtio/virtio_ring.c | 27 +++++++...
2023 Mar 21
1
[PATCH vhost v3 04/11] virtio_ring: split: support premapped
...pports virtual addresses, dma is completed in virtio > core. > > In some scenarios (such as the AF_XDP), the memory is allocated > and DMA mapping is completed in advance, so it is necessary for us to > support passing the DMA address to virtio core. > > Drives can use sg->dma_address to pass the mapped dma address to virtio > core. If one sg->dma_address is used then all sgs must use > sg->dma_address, otherwise all must be null when passing it to the APIs > of virtio. > > Signed-off-by: Xuan Zhuo <xuanzhuo at linux.alibaba.com> > --- > driver...
2017 Aug 18
0
[PATCH] drm/nouveau: use new TTM populate/DMA map function
...pulate(ttm); - if (r) { - return r; - } - - for (i = 0; i < ttm->num_pages; i++) { - dma_addr_t addr; - - addr = dma_map_page(pdev, ttm->pages[i], 0, PAGE_SIZE, - DMA_BIDIRECTIONAL); - - if (dma_mapping_error(pdev, addr)) { - while (i--) { - dma_unmap_page(pdev, ttm_dma->dma_address[i], - PAGE_SIZE, DMA_BIDIRECTIONAL); - ttm_dma->dma_address[i] = 0; - } - ttm_pool_unpopulate(ttm); - return -EFAULT; - } - - ttm_dma->dma_address[i] = addr; - } - return 0; + return ttm_populate_and_map_pages(pdev, ttm_dma); } static void @@ -1514,7 +1489,6 @@ nouve...
2014 Jul 08
8
[PATCH v4 0/6] drm: nouveau: memory coherency on ARM
Another revision of this patchset critical for GK20A to operate. Previous attempts were exclusively using either TTM's regular page allocator or the DMA API one. Both have their advantages and drawbacks: the page allocator is fast but requires explicit synchronization on non-coherent architectures, whereas the DMA allocator always returns coherent memory, but is also slower, creates a
2018 Mar 05
0
[PATCH 4/5] drm/ttm: add ttm_sg_tt_init
...gt;> +++ b/drivers/gpu/drm/ttm/ttm_tt.c >> @@ -108,6 +108,16 @@ static int >> ttm_dma_tt_alloc_page_directory(struct ttm_dma_tt *ttm) >>       return 0; >>   } >>   +static int ttm_sg_tt_alloc_page_directory(struct ttm_dma_tt *ttm) >> +{ >> +    ttm->dma_address = kvmalloc_array(ttm->ttm.num_pages, >> +                      sizeof(*ttm->dma_address), >> +                      GFP_KERNEL | __GFP_ZERO); >> +    if (!ttm->dma_address) >> +        return -ENOMEM; >> +    return 0; >> +} >> + >>   #ifdef...