search for: dma_handle

Displaying 20 results from an estimated 117 matches for "dma_handle".

2020 Sep 15
0
[PATCH 15/18] dma-mapping: add a new dma_alloc_pages API
..._common_free_pages, }; static int __init diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c index 2bf849caf507b1..f53bc043334c01 100644 --- a/arch/mips/jazz/jazzdma.c +++ b/arch/mips/jazz/jazzdma.c @@ -506,9 +506,6 @@ static void *jazz_dma_alloc(struct device *dev, size_t size, *dma_handle = vdma_alloc(virt_to_phys(ret), size); if (*dma_handle == DMA_MAPPING_ERROR) goto out_free_pages; - - if (attrs & DMA_ATTR_NON_CONSISTENT) - return ret; arch_dma_prep_coherent(page, size); return (void *)(UNCAC_BASE + __pa(ret)); @@ -521,8 +518,6 @@ static void jazz_dma_free(struct...
2020 Aug 19
0
[PATCH 10/28] MIPS/jazzdma: decouple from dma-direct
...nclude <linux/gfp.h> -#include <linux/dma-direct.h> #include <linux/dma-noncoherent.h> #include <asm/mipsregs.h> #include <asm/jazz.h> @@ -492,26 +491,38 @@ int vdma_get_enable(int channel) static void *jazz_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs) { + struct page *page; void *ret; - ret = dma_direct_alloc_pages(dev, size, dma_handle, gfp, attrs); - if (!ret) - return NULL; + if (attrs & DMA_ATTR_NO_WARN) + gfp |= __GFP_NOWARN; - *dma_handle = vdma_alloc(virt_to_phys(ret), size); - if (*dma_handle...
2020 Aug 19
0
[PATCH 19/28] dma-mapping: replace DMA_ATTR_NON_CONSISTENT with dma_{alloc, free}_pages
...direct mapping, but are guaranteed to be DMA addressable. If you don't understand how cache line coherency works between a processor and an I/O device, you should not be using this part of the -API at all. +API. :: void * - dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, - gfp_t flag, unsigned long attrs) + dma_alloc_pages(struct device *dev, size_t size, dma_addr_t *dma_handle, + enum dma_data_direction dir, gfp_t gfp) + +This routine allocates a region of <size> bytes of consistent memory. It +returns a pointer to the allocated region (in the processo...
2016 Jun 02
52
[RFC v3 00/45] dma-mapping: Use unsigned long for dma_attrs
Hi, This is third approach (complete this time) for replacing struct dma_attrs with unsigned long. The main patch (2/45) doing the change is split into many subpatches for easier review (3-43). They should be squashed together when applying. *Important:* Patchset is *only* build tested on allyesconfigs: ARM, ARM64, i386, x86_64 and powerpc. Please provide reviewes and tests for other
2016 Jun 02
0
[RFC v3 02/45] dma-mapping: Use unsigned long for dma_attrs
...C_SINGLE_PAGES (1UL << 8) + /* * A dma_addr_t can hold any valid DMA or bus address for the platform. * It can be given to a device to use as a DMA source or target. A CPU cannot @@ -21,34 +33,35 @@ struct dma_map_ops { void* (*alloc)(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp, - struct dma_attrs *attrs); + unsigned long attrs); void (*free)(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle, - struct dma_attrs *attrs); + unsigned long attrs); int (*mmap)(struct device *, struct vm_area_struct *, - void...
2020 Sep 15
0
[PATCH 08/18] dma-mapping: add a new dma_alloc_noncoherent API
...and an I/O device, you should not be using this part of the -API at all. +If you don't understand how cache line coherency works between a processor and +an I/O device, you should not be using this part of the API. :: void * - dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, - gfp_t flag, unsigned long attrs) + dma_alloc_noncoherent(struct device *dev, size_t size, + dma_addr_t *dma_handle, enum dma_data_direction dir, + gfp_t gfp) -Identical to dma_alloc_coherent() except that when the -DMA_ATTR_NON_CONSISTENT flags is passed in the attrs argument, the -platf...
2018 Jul 30
1
[RFC 1/4] virtio: Define virtio_direct_dma_ops structure
...) > +{ > +} No need to implement no-op callbacks in struct dma_map_ops. > + > +int virtio_direct_mapping_error(struct device *hwdev, dma_addr_t dma_addr) > +{ > + return 0; > +} Including this one. > +void *virtio_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, > + gfp_t gfp, unsigned long attrs) > +{ > + void *queue = alloc_pages_exact(PAGE_ALIGN(size), gfp); > + > + if (queue) { > + phys_addr_t phys_addr = virt_to_phys(queue); > + *dma_handle = (dma_addr_t)phys_addr; > + > + if (WARN_ON_ONCE(*dma_handle != phys_addr)) { &...
2020 Sep 14
20
a saner API for allocating DMA addressable pages v2
Hi all, this series replaced the DMA_ATTR_NON_CONSISTENT flag to dma_alloc_attrs with a separate new dma_alloc_pages API, which is available on all platforms. In addition to cleaning up the convoluted code path, this ensures that other drivers that have asked for better support for non-coherent DMA to pages with incurring bounce buffering over can finally be properly supported. I'm still a
2019 Dec 21
0
[PATCH 6/8] iommu: allow the dma-iommu api to use bounce buffers
...G_ERROR; } return iova + iova_off; @@ -761,10 +823,10 @@ static dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page, { phys_addr_t phys = page_to_phys(page) + offset; bool coherent = dev_is_dma_coherent(dev); - int prot = dma_info_to_prot(dir, coherent, attrs); dma_addr_t dma_handle; - dma_handle = __iommu_dma_map(dev, phys, size, prot, dma_get_mask(dev)); + dma_handle = __iommu_dma_map(dev, phys, size, dma_get_mask(dev), + coherent, dir, attrs); if (!coherent && !(attrs & DMA_ATTR_SKIP_CPU_SYNC) && dma_handle != DMA_MAPPING_ERROR) arch_sync_...
2016 Jun 02
0
[RFC v3 04/45] arc: dma-mapping: Use unsigned long for dma_attrs
...| 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c index 73d7e4c75b7d..3d1f467d1792 100644 --- a/arch/arc/mm/dma.c +++ b/arch/arc/mm/dma.c @@ -22,7 +22,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs) + dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs) { unsigned long order = get_order(size); struct page *page; @@ -90,7 +90,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size, } static void arc_dma_free(struct device *dev, size_t si...
2020 Sep 15
32
a saner API for allocating DMA addressable pages v3
Hi all, this series replaced the DMA_ATTR_NON_CONSISTENT flag to dma_alloc_attrs with a separate new dma_alloc_pages API, which is available on all platforms. In addition to cleaning up the convoluted code path, this ensures that other drivers that have asked for better support for non-coherent DMA to pages with incurring bounce buffering over can finally be properly supported. As a follow up I
2016 Jun 02
0
[RFC v3 29/45] m68k: dma-mapping: Use unsigned long for dma_attrs
...long attrs) { pr_debug("dma_free_coherent: %p, %x\n", addr, handle); vfree(addr); @@ -73,7 +73,7 @@ static void m68k_dma_free(struct device *dev, size_t size, void *addr, #include <asm/cacheflush.h> static void *m68k_dma_alloc(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs) + dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs) { void *ret; /* ignore region specifiers */ @@ -91,7 +91,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size, } static void m68k_dma_free(struct device *dev, size_t size, void *vadd...
2016 Jun 02
0
[RFC v3 10/45] cris: dma-mapping: Use unsigned long for dma_attrs
...s/pci/dma.c b/arch/cris/arch-v32/drivers/pci/dma.c index 8d5efa58cce1..1f0636793f0c 100644 --- a/arch/cris/arch-v32/drivers/pci/dma.c +++ b/arch/cris/arch-v32/drivers/pci/dma.c @@ -17,7 +17,7 @@ #include <asm/io.h> static void *v32_dma_alloc(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs) + dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs) { void *ret; @@ -37,22 +37,21 @@ static void *v32_dma_alloc(struct device *dev, size_t size, } static void v32_dma_free(struct device *dev, size_t size, void *vaddr, - dma_addr_t dma_handle, s...
2019 Apr 10
0
[RFC PATCH 07/12] virtio/s390: use DMA memory for ccw I/O
...gt; > > > > +#define vc_dma_decl_struct(type, field) \ > > > + dma_addr_t field ## _dma_addr; \ > > > + struct type *field > > > + > > > +static inline void *__vc_dma_alloc(struct virtio_device *vdev, size_t size, > > > + dma_addr_t *dma_handle) > > > +{ > > > + return dma_alloc_coherent(vdev->dev.parent, size, dma_handle, > > > + GFP_DMA | GFP_KERNEL | __GFP_ZERO); > > > +} > > > + > > > +static inline void __vc_dma_free(struct virtio_device *vdev, size_t size, > > >...
2019 Sep 08
0
[PATCH V6 4/5] iommu/dma-iommu: Use the dev->coherent_dma_mask
...n, size, dma_get_mask(dev), dev); + iova = iommu_dma_alloc_iova(domain, size, dma_mask, dev); if (!iova) return DMA_MAPPING_ERROR; @@ -735,7 +735,7 @@ static dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page, int prot = dma_info_to_prot(dir, coherent, attrs); dma_addr_t dma_handle; - dma_handle = __iommu_dma_map(dev, phys, size, prot); + dma_handle = __iommu_dma_map(dev, phys, size, prot, dma_get_mask(dev)); if (!coherent && !(attrs & DMA_ATTR_SKIP_CPU_SYNC) && dma_handle != DMA_MAPPING_ERROR) arch_sync_dma_for_device(dev, phys, size, dir); @...
2005 Apr 15
0
[PATCH] Eliminate kernel version checks from i386/kernel/pci-dma.c
...d_offset(d, va) d -#endif struct dma_coherent_mem { void *virt_base; @@ -85,24 +78,13 @@ xen_contig_memory(unsigned long vstart, balloon_unlock(flags); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, - dma_addr_t *dma_handle) -#else void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, int gfp) -#endif { void *ret; unsigned int order = get_order(size); unsigned long vstart; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - int gfp = GFP_ATOMIC; - - if (hwdev == NULL || ((...
2019 Apr 10
0
[RFC PATCH 07/12] virtio/s390: use DMA memory for ccw I/O
...urn container_of(vdev, struct virtio_ccw_device, vdev); > } > > +#define vc_dma_decl_struct(type, field) \ > + dma_addr_t field ## _dma_addr; \ > + struct type *field > + > +static inline void *__vc_dma_alloc(struct virtio_device *vdev, size_t size, > + dma_addr_t *dma_handle) > +{ > + return dma_alloc_coherent(vdev->dev.parent, size, dma_handle, > + GFP_DMA | GFP_KERNEL | __GFP_ZERO); > +} > + > +static inline void __vc_dma_free(struct virtio_device *vdev, size_t size, > + void *cpu_addr, dma_addr_t dma_handle) > +{ > + dma_free_c...
2016 Jun 02
0
[RFC v3 09/45] c6x: dma-mapping: Use unsigned long for dma_attrs
...ct device *dev) extern void coherent_mem_init(u32 start, u32 size); void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, - gfp_t gfp, struct dma_attrs *attrs); + gfp_t gfp, unsigned long attrs); void c6x_dma_free(struct device *dev, size_t size, void *vaddr, - dma_addr_t dma_handle, struct dma_attrs *attrs); + dma_addr_t dma_handle, unsigned long attrs); #endif /* _ASM_C6X_DMA_MAPPING_H */ diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c index 8a80f3a250c0..db4a6a301f5e 100644 --- a/arch/c6x/kernel/dma.c +++ b/arch/c6x/kernel/dma.c @@ -38,7 +38,7 @@ static void...
2020 Jul 17
0
[PATCH] virtio_ring: use alloc_pages_node for NUMA-aware allocation
...284 | phys_addr_t phys_addr = virt_to_phys(queue); | ^~~~~~~~~~~ cc1: some warnings being treated as errors vim +/dev_to_node +280 drivers/virtio/virtio_ring.c 271 272 static void *vring_alloc_queue(struct virtio_device *vdev, size_t size, 273 dma_addr_t *dma_handle, gfp_t flag) 274 { 275 if (vring_use_dma_api(vdev)) { 276 return dma_alloc_coherent(vdev->dev.parent, size, 277 dma_handle, flag); 278 } else { 279 void *queue = NULL; > 280 struct page *page = alloc_pages_node(dev_to_node(&vdev->dev.parent), 281...
2007 Mar 16
7
Physical address mapping to user space in dom0 problem
I have a PCI device which can perform bus master DMA. I developed a PCI device driver which can allocate DMA buffer and provide mmap operation to map the I/O and DMA buffer to user space. The PCI device driver works well under Linux 2.6.20. However it brokes under XEN 3.0.4. It appears that mmap map to the wrong memory. remap_pfn_range in mmap function return no error when it is used to map