search for: get_dma_op

Displaying 20 results from an estimated 46 matches for "get_dma_op".

Did you mean: get_dma_ops
2016 Jun 02
0
[RFC v3 02/45] dma-mapping: Use unsigned long for dma_attrs
...-code compatiblity reasons). + */ +static inline bool dma_get_attr(unsigned long attr, unsigned long attrs) +{ + return !!(attr & attrs); +} + #ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT /* * These three functions are only for dma allocator. @@ -123,7 +149,7 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, size_t size, enum dma_data_direction dir, - struct dma_attrs *attrs) + unsigned long attrs) { struct dma_map_ops *ops = get_dma_ops(dev); dma_addr_t ad...
2020 Sep 15
0
[PATCH 15/18] dma-mapping: add a new dma_alloc_pages API
...BINE) @@ -461,6 +459,65 @@ void dma_free_attrs(struct device *dev, size_t size, void *cpu_addr, } EXPORT_SYMBOL(dma_free_attrs); +struct page *dma_alloc_pages(struct device *dev, size_t size, + dma_addr_t *dma_handle, enum dma_data_direction dir, gfp_t gfp) +{ + const struct dma_map_ops *ops = get_dma_ops(dev); + struct page *page; + + if (WARN_ON_ONCE(!dev->coherent_dma_mask)) + return NULL; + if (WARN_ON_ONCE(gfp & (__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM))) + return NULL; + + size = PAGE_ALIGN(size); + if (dma_alloc_direct(dev, ops)) + page = dma_direct_alloc_pages(dev, size, dma_handl...
2013 Oct 17
42
[PATCH v8 0/19] enable swiotlb-xen on arm and arm64
...oduce a p2m for xen on arm and arm64; - call __set_phys_to_machine_multi from xen_create_contiguous_region to update the p2m; - remove XENMEM_unpin and XENMEM_exchange_and_pin; - set nr_exchanged to 0 before calling the hypercall; - return xen_dma_ops only if we are the initial domain; - rename __get_dma_ops to __generic_dma_ops; - call __generic_dma_ops(hwdev)->alloc/free on arm64 too; - introduce xen_dma_map/unmap_page and xen_dma_sync_single_for_cpu/device; - use xen_dma_map/unmap_page, xen_dma_sync_single_for_cpu/device in swiotlb-xen; - use dev_warn instead of pr_warn; - remove the extra aut...
2013 Nov 11
0
[GIT PULL] (xen) stable/for-linus-3.13-rc0-tag
...DMA_ERROR_CODE arm/xen,arm64/xen: introduce p2m xen/x86: allow __set_phys_to_machine for autotranslate guests xen: make xen_create_contiguous_region return the dma address xen/arm,arm64: enable SWIOTLB_XEN swiotlb-xen: introduce xen_swiotlb_set_dma_mask arm/xen: get_dma_ops: return xen_dma_ops if we are running as xen_initial_domain arm64/xen: get_dma_ops: return xen_dma_ops if we are running as xen_initial_domain xen: introduce xen_alloc/free_coherent_pages swiotlb-xen: use xen_alloc/free_coherent_pages xen: introduce xen_dma_map/unmap_page a...
2020 Sep 15
0
[PATCH 14/18] dma-mapping: remove dma_cache_sync
.../mapping.c +++ b/kernel/dma/mapping.c @@ -518,20 +518,6 @@ int dma_set_coherent_mask(struct device *dev, u64 mask) EXPORT_SYMBOL(dma_set_coherent_mask); #endif -void dma_cache_sync(struct device *dev, void *vaddr, size_t size, - enum dma_data_direction dir) -{ - const struct dma_map_ops *ops = get_dma_ops(dev); - - BUG_ON(!valid_dma_direction(dir)); - - if (dma_alloc_direct(dev, ops)) - arch_dma_cache_sync(dev, vaddr, size, dir); - else if (ops->cache_sync) - ops->cache_sync(dev, vaddr, size, dir); -} -EXPORT_SYMBOL(dma_cache_sync); - size_t dma_max_mapping_size(struct device *dev) { co...
2016 Jul 19
5
[PATCH v3] virtio: new feature to detect IOMMU device quirk
The interaction between virtio and IOMMUs is messy. On most systems with virtio, physical addresses match bus addresses, and it doesn't particularly matter which one we use to program the device. On some systems, including Xen and any system with a physical device that speaks virtio behind a physical IOMMU, we must program the IOMMU for virtio DMA to work at all. On other systems, including
2016 Jul 19
5
[PATCH v3] virtio: new feature to detect IOMMU device quirk
The interaction between virtio and IOMMUs is messy. On most systems with virtio, physical addresses match bus addresses, and it doesn't particularly matter which one we use to program the device. On some systems, including Xen and any system with a physical device that speaks virtio behind a physical IOMMU, we must program the IOMMU for virtio DMA to work at all. On other systems, including
2020 Aug 19
0
[PATCH 19/28] dma-mapping: replace DMA_ATTR_NON_CONSISTENT with dma_{alloc, free}_pages
...ITE_COMBINE) @@ -461,6 +459,45 @@ void dma_free_attrs(struct device *dev, size_t size, void *cpu_addr, } EXPORT_SYMBOL(dma_free_attrs); +void *dma_alloc_pages(struct device *dev, size_t size, dma_addr_t *dma_handle, + enum dma_data_direction dir, gfp_t gfp) +{ + const struct dma_map_ops *ops = get_dma_ops(dev); + void *vaddr; + + if (WARN_ON_ONCE(!dev->coherent_dma_mask)) + return NULL; + if (WARN_ON_ONCE(gfp & (__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM))) + return NULL; + + size = PAGE_ALIGN(size); + if (dma_alloc_direct(dev, ops)) + vaddr = dma_direct_alloc_pages(dev, size, dma_handle, di...
2008 Dec 22
17
[PATCH 0 of 9] swiotlb: use phys_addr_t for pages
Hi all, Here''s a work in progress series whcih does a partial revert of the previous swiotlb changes, and does a partial replacement with Becky Bruce''s series. The most important difference is Becky''s use of phys_addr_t rather than page+offset to represent arbitrary pages. This turns out to be simpler. I didn''t replicate the map_single_page changes, since
2016 Jul 25
0
[PATCH v3] virtio: new feature to detect IOMMU device quirk
...gt; code for now, and move when it becomes possible. So work on making it ready. We're close to there, and given that virtio needs it, finish it off. We now have everyone using the operation vectors for DMA, so the only thing you need is a dma_ops pointer in struct device initialized to what get_dma_ops returns.
2018 Jul 30
1
[RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively
> > + > > + if (xen_domain()) > > + goto skip_override; > > + > > + if (virtio_has_iommu_quirk(dev)) > > + set_dma_ops(dev->dev.parent, &virtio_direct_dma_ops); > > + > > + skip_override: > > + > > I prefer normal if scoping as opposed to goto spaghetti pls. > Better yet move vring_use_dma_api here and use it. > Less of a
2015 Oct 30
0
[PATCH 3/3] s390/dma: Allow per device dma ops
...b3fd54d..cb05f5c 100644 --- a/arch/s390/include/asm/dma-mapping.h +++ b/arch/s390/include/asm/dma-mapping.h @@ -11,11 +11,13 @@ #define DMA_ERROR_CODE (~(dma_addr_t) 0x0) -extern struct dma_map_ops s390_dma_ops; +extern struct dma_map_ops s390_pci_dma_ops; static inline struct dma_map_ops *get_dma_ops(struct device *dev) { - return &s390_dma_ops; + if (dev && dev->archdata.dma_ops) + return dev->archdata.dma_ops; + return &dma_noop_ops; } static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/p...
2016 Jun 02
0
[RFC v3 09/45] c6x: dma-mapping: Use unsigned long for dma_attrs
...hanged, 8 insertions(+), 9 deletions(-) diff --git a/arch/c6x/include/asm/dma-mapping.h b/arch/c6x/include/asm/dma-mapping.h index 6b5cd7b0cf32..5717b1e52d96 100644 --- a/arch/c6x/include/asm/dma-mapping.h +++ b/arch/c6x/include/asm/dma-mapping.h @@ -26,8 +26,8 @@ static inline struct dma_map_ops *get_dma_ops(struct 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_a...
2015 Nov 03
0
[PATCH 3/3] s390/dma: Allow per device dma ops
...b3fd54d..cb05f5c 100644 --- a/arch/s390/include/asm/dma-mapping.h +++ b/arch/s390/include/asm/dma-mapping.h @@ -11,11 +11,13 @@ #define DMA_ERROR_CODE (~(dma_addr_t) 0x0) -extern struct dma_map_ops s390_dma_ops; +extern struct dma_map_ops s390_pci_dma_ops; static inline struct dma_map_ops *get_dma_ops(struct device *dev) { - return &s390_dma_ops; + if (dev && dev->archdata.dma_ops) + return dev->archdata.dma_ops; + return &dma_noop_ops; } static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/p...
2016 Feb 01
0
[PATCH v6 3/9] s390/dma: Allow per device dma ops
...2f..3249b7464889 100644 --- a/arch/s390/include/asm/dma-mapping.h +++ b/arch/s390/include/asm/dma-mapping.h @@ -11,11 +11,13 @@ #define DMA_ERROR_CODE (~(dma_addr_t) 0x0) -extern struct dma_map_ops s390_dma_ops; +extern struct dma_map_ops s390_pci_dma_ops; static inline struct dma_map_ops *get_dma_ops(struct device *dev) { - return &s390_dma_ops; + if (dev && dev->archdata.dma_ops) + return dev->archdata.dma_ops; + return &dma_noop_ops; } static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/p...
2019 Feb 07
0
[PATCH v7 3/5] dma: Introduce dma_max_mapping_size()
...el/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -357,3 +357,17 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size, ops->cache_sync(dev, vaddr, size, dir); } EXPORT_SYMBOL(dma_cache_sync); + +size_t dma_max_mapping_size(struct device *dev) +{ + const struct dma_map_ops *ops = get_dma_ops(dev); + size_t size = SIZE_MAX; + + if (dma_is_direct(ops)) + size = dma_direct_max_mapping_size(dev); + else if (ops && ops->max_mapping_size) + size = ops->max_mapping_size(dev); + + return size; +} +EXPORT_SYMBOL_GPL(dma_max_mapping_size); -- 2.17.1
2015 Nov 05
0
[GIT PULL v4 3/3] s390/dma: Allow per device dma ops
...b3fd54d..cb05f5c 100644 --- a/arch/s390/include/asm/dma-mapping.h +++ b/arch/s390/include/asm/dma-mapping.h @@ -11,11 +11,13 @@ #define DMA_ERROR_CODE (~(dma_addr_t) 0x0) -extern struct dma_map_ops s390_dma_ops; +extern struct dma_map_ops s390_pci_dma_ops; static inline struct dma_map_ops *get_dma_ops(struct device *dev) { - return &s390_dma_ops; + if (dev && dev->archdata.dma_ops) + return dev->archdata.dma_ops; + return &dma_noop_ops; } static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/p...
2019 May 16
2
[PATCH 06/10] s390/cio: add basic protected virtualization support
...e of that ccw > device is used as the first argument of dma_alloc_coherent(). > > Considering > > void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, > gfp_t flag, unsigned long attrs) > { > const struct dma_map_ops *ops = get_dma_ops(dev); > void *cpu_addr; > > WARN_ON_ONCE(dev && !dev->coherent_dma_mask); > > if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr)) > return cpu_addr; > > /* let the implementation decide on the...
2019 May 16
2
[PATCH 06/10] s390/cio: add basic protected virtualization support
...e of that ccw > device is used as the first argument of dma_alloc_coherent(). > > Considering > > void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, > gfp_t flag, unsigned long attrs) > { > const struct dma_map_ops *ops = get_dma_ops(dev); > void *cpu_addr; > > WARN_ON_ONCE(dev && !dev->coherent_dma_mask); > > if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr)) > return cpu_addr; > > /* let the implementation decide on the...
2019 May 18
0
[PATCH 06/10] s390/cio: add basic protected virtualization support
...used as the first argument of > > dma_alloc_coherent(). > > > > Considering > > > > void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t > > *dma_handle, gfp_t flag, unsigned long attrs) > > { > > const struct dma_map_ops *ops = get_dma_ops(dev); > > void *cpu_addr; > > > > WARN_ON_ONCE(dev && !dev->coherent_dma_mask); > > > > if (dma_alloc_from_dev_coherent(dev, size, dma_handle, > > &cpu_addr)) return cpu_addr; > > > > /* let the imple...