search for: dma_alloc_coherent

Displaying 20 results from an estimated 225 matches for "dma_alloc_coherent".

2012 Jun 01
2
Question regarding Virtio Console and Remoteproc
...access kernel memory (no IOMMU and limited address range). Instead we have a designated shared memory region used for IPC. Due to this I cannot use kmalloc() for buffer allocation, but I have to allocate buffers from the memory region shared with the modem. In remoteproc this is solved by using dma_alloc_coherent() for all memory to be shared with the modem. This works fine for me, because I can pass the IPC memory region to dma_declare_coherent_memory() so dma_alloc_coherent() will allocate from this memory region. I think I can solve this issue in Virtio Console by changing calls to kmalloc() to somethi...
2012 Jun 01
2
Question regarding Virtio Console and Remoteproc
...access kernel memory (no IOMMU and limited address range). Instead we have a designated shared memory region used for IPC. Due to this I cannot use kmalloc() for buffer allocation, but I have to allocate buffers from the memory region shared with the modem. In remoteproc this is solved by using dma_alloc_coherent() for all memory to be shared with the modem. This works fine for me, because I can pass the IPC memory region to dma_declare_coherent_memory() so dma_alloc_coherent() will allocate from this memory region. I think I can solve this issue in Virtio Console by changing calls to kmalloc() to somethi...
2016 Dec 08
3
[PATCH 0/2] Virtio ring works with DMA coherent memory
RPMsg uses dma_alloc_coherent() to allocate memory to shared with the remote. In this case, as there is no pages setup in the dma_alloc_coherent(), we cannot get the physical address back from the virtual address, and thus, we can set the sg_dma_addr to store the DMA address and mark it already DMA mapped. When virtio vring se...
2016 Dec 08
3
[PATCH 0/2] Virtio ring works with DMA coherent memory
RPMsg uses dma_alloc_coherent() to allocate memory to shared with the remote. In this case, as there is no pages setup in the dma_alloc_coherent(), we cannot get the physical address back from the virtual address, and thus, we can set the sg_dma_addr to store the DMA address and mark it already DMA mapped. When virtio vring se...
2014 May 30
0
[PATCH] drm/gk20a/fb: use dma_alloc_coherent() for VRAM
GK20A's RAM driver was using CMA functions in order to allocate VRAM. This is wrong because these functions are not exported, which causes compilation to fail when CMA is enabled and Nouveau is built as a module. On top of that the driver was leaking (or rather bleeding) memory. dma_alloc_coherent() will also use CMA when needed but has the advantage of being properly exported. It creates a permanent kernel mapping, but experiment revealed that the lowmem mapping is actually reused, and this mapping can also be taken advantage of to implement faster instmem. We lose the ability to allocate m...
2016 Dec 06
2
[RFC LINUX PATCH 0/2] Virtio ring works with DMA coherent memory
RPMsg uses dma_alloc_coherent() to allocate memory to shared with the remote. In this case, as there is no pages setup in the dma_alloc_coherent(), we cannot get the physical address back from the virtual address, and thus, we can set the sg_dma_addr to store the DMA address and mark it already DMA mapped. When virtio vring se...
2016 Dec 06
2
[RFC LINUX PATCH 0/2] Virtio ring works with DMA coherent memory
RPMsg uses dma_alloc_coherent() to allocate memory to shared with the remote. In this case, as there is no pages setup in the dma_alloc_coherent(), we cannot get the physical address back from the virtual address, and thus, we can set the sg_dma_addr to store the DMA address and mark it already DMA mapped. When virtio vring se...
2016 Nov 22
2
[RFC LINUX PATCH 0/2] Virtio ring works with DMA coherent memory
RPMsg uses dma_alloc_coherent() to allocate memory to shared with the remote. In this case, as there is no pages setup in the dma_alloc_coherent(), we cannot get the physical address back from the virtual address, and thus, we can set the sg_dma_addr to store the DMA address and mark it already DMA mapped. When virtio vring se...
2016 Dec 06
2
[RFC LINUX PATCH 0/2] Virtio ring works with DMA coherent memory
RPMsg uses dma_alloc_coherent() to allocate memory to shared with the remote. In this case, as there is no pages setup in the dma_alloc_coherent(), we cannot get the physical address back from the virtual address, and thus, we can set the sg_dma_addr to store the DMA address and mark it already DMA mapped. When virtio vring se...
2016 Nov 22
2
[RFC LINUX PATCH 0/2] Virtio ring works with DMA coherent memory
RPMsg uses dma_alloc_coherent() to allocate memory to shared with the remote. In this case, as there is no pages setup in the dma_alloc_coherent(), we cannot get the physical address back from the virtual address, and thus, we can set the sg_dma_addr to store the DMA address and mark it already DMA mapped. When virtio vring se...
2016 Dec 06
2
[RFC LINUX PATCH 0/2] Virtio ring works with DMA coherent memory
RPMsg uses dma_alloc_coherent() to allocate memory to shared with the remote. In this case, as there is no pages setup in the dma_alloc_coherent(), we cannot get the physical address back from the virtual address, and thus, we can set the sg_dma_addr to store the DMA address and mark it already DMA mapped. When virtio vring se...
2024 Apr 28
1
[PATCH 1/2] drm/nouveau/firmware: Fix SG_DEBUG error with nvkm_firmware_ctor()
...uding coherent memory in a scatterlist > is bad. Thanks for asking this as I think you unintentionally pointed out this explanation I gave doesn't make sense - so I looked a bit more into it. The issue isn't coherent memory in the scatterlist, the issue is that we're allocating with dma_alloc_coherent(). And according to the source in dma_alloc_attrs() (which dma_alloc_coherent() is just a wrapper) for): /* * DMA allocations can never be turned back into a page pointer, so * requesting compound pages doesn't make sense (and can't even be * supported at all by various back...
2019 May 27
3
[PATCH v2 2/8] s390/cio: introduce DMA pools to cio
...create(struct device *dma_dev, int nr_pages) > +{ > + struct gen_pool *gp_dma; > + void *cpu_addr; > + dma_addr_t dma_addr; > + int i; > + > + gp_dma = gen_pool_create(3, -1); > + if (!gp_dma) > + return NULL; > + for (i = 0; i < nr_pages; ++i) { > + cpu_addr = dma_alloc_coherent(dma_dev, PAGE_SIZE, &dma_addr, > + CIO_DMA_GFP); > + if (!cpu_addr) > + return gp_dma; So, you may return here with no memory added to the pool at all (or less than requested), but for the caller that is indistinguishable from an allocation that went all right. May that b...
2019 May 27
3
[PATCH v2 2/8] s390/cio: introduce DMA pools to cio
...create(struct device *dma_dev, int nr_pages) > +{ > + struct gen_pool *gp_dma; > + void *cpu_addr; > + dma_addr_t dma_addr; > + int i; > + > + gp_dma = gen_pool_create(3, -1); > + if (!gp_dma) > + return NULL; > + for (i = 0; i < nr_pages; ++i) { > + cpu_addr = dma_alloc_coherent(dma_dev, PAGE_SIZE, &dma_addr, > + CIO_DMA_GFP); > + if (!cpu_addr) > + return gp_dma; So, you may return here with no memory added to the pool at all (or less than requested), but for the caller that is indistinguishable from an allocation that went all right. May that b...
2013 Aug 23
1
[PATCH] VMXNET3: Add support for virtual IOMMU
...sz; + BUG_ON(tq->tx_ring.base || tq->data_ring.base || tq->comp_ring.base || tq->buf_info); - tq->tx_ring.base = pci_alloc_consistent(adapter->pdev, tq->tx_ring.size - * sizeof(struct Vmxnet3_TxDesc), - &tq->tx_ring.basePA); + tq->tx_ring.base = dma_alloc_coherent(&adapter->pdev->dev, + tq->tx_ring.size * sizeof(struct Vmxnet3_TxDesc), + &tq->tx_ring.basePA, GFP_KERNEL); if (!tq->tx_ring.base) { netdev_err(adapter->netdev, "failed to allocate tx ring\n"); goto err; } - tq->data_ring.base = pci_alloc_cons...
2013 Aug 23
1
[PATCH] VMXNET3: Add support for virtual IOMMU
...sz; + BUG_ON(tq->tx_ring.base || tq->data_ring.base || tq->comp_ring.base || tq->buf_info); - tq->tx_ring.base = pci_alloc_consistent(adapter->pdev, tq->tx_ring.size - * sizeof(struct Vmxnet3_TxDesc), - &tq->tx_ring.basePA); + tq->tx_ring.base = dma_alloc_coherent(&adapter->pdev->dev, + tq->tx_ring.size * sizeof(struct Vmxnet3_TxDesc), + &tq->tx_ring.basePA, GFP_KERNEL); if (!tq->tx_ring.base) { netdev_err(adapter->netdev, "failed to allocate tx ring\n"); goto err; } - tq->data_ring.base = pci_alloc_cons...
2016 Dec 08
1
[PATCH 1/2] virtio_ring: Do not call dma_map_page if sg is already mapped.
On Wed, Dec 07, 2016 at 10:59:12PM -0800, Wendy Liang wrote: > If sg is already dma mapped, do not call dma_map_page() in > vring_map_one_sg(). > > In case of rpmsg, rpmsg uses dma_alloc_coherent() to allocate > memory to share with the remote. There is no pages setup > in dma_alloc_coherent(). > > In this case, we cannot convert the virtual address back to the > physical address. In this case, we can setup the sg_dma_addr to > store the DMA address, and also mark the sg...
2016 Dec 08
1
[PATCH 1/2] virtio_ring: Do not call dma_map_page if sg is already mapped.
On Wed, Dec 07, 2016 at 10:59:12PM -0800, Wendy Liang wrote: > If sg is already dma mapped, do not call dma_map_page() in > vring_map_one_sg(). > > In case of rpmsg, rpmsg uses dma_alloc_coherent() to allocate > memory to share with the remote. There is no pages setup > in dma_alloc_coherent(). > > In this case, we cannot convert the virtual address back to the > physical address. In this case, we can setup the sg_dma_addr to > store the DMA address, and also mark the sg...
2019 May 08
3
[PATCH 06/10] s390/cio: add basic protected virtualization support
...evice_private), > + GFP_KERNEL | GFP_DMA); Do we still need GFP_DMA here (since we now have cdev->private->dma_area)? > @@ -1062,6 +1082,14 @@ static int io_subchannel_probe(struct subchannel *sch) > if (!io_priv) > goto out_schedule; > > + io_priv->dma_area = dma_alloc_coherent(&sch->dev, > + sizeof(*io_priv->dma_area), > + &io_priv->dma_area_dma, GFP_KERNEL); This needs GFP_DMA. You use a genpool for ccw_private->dma and not for iopriv->dma - looks kinda inconsistent.
2019 May 08
3
[PATCH 06/10] s390/cio: add basic protected virtualization support
...evice_private), > + GFP_KERNEL | GFP_DMA); Do we still need GFP_DMA here (since we now have cdev->private->dma_area)? > @@ -1062,6 +1082,14 @@ static int io_subchannel_probe(struct subchannel *sch) > if (!io_priv) > goto out_schedule; > > + io_priv->dma_area = dma_alloc_coherent(&sch->dev, > + sizeof(*io_priv->dma_area), > + &io_priv->dma_area_dma, GFP_KERNEL); This needs GFP_DMA. You use a genpool for ccw_private->dma and not for iopriv->dma - looks kinda inconsistent.