From: Robin Murphy <robin.murphy@arm.com>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Jisheng Zhang <jszhang@marvell.com>,
Joerg Roedel <jroedel@suse.de>, Arnd Bergmann <arnd@arndb.de>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
linux-kernel@vger.kernel.org, hch@infradead.org, "Suthikulpanit,
Suravee" <Suravee.Suthikulpanit@amd.com>,
linux-arm-kernel@lists.infradead.org,
Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH v4 05/44] arm64: dma-mapping: Use unsigned long for dma_attrs
Date: Fri, 10 Jun 2016 11:51:48 +0100 [thread overview]
Message-ID: <575A9BC4.3090603@arm.com> (raw)
In-Reply-To: <1465553521-27303-6-git-send-email-k.kozlowski@samsung.com>
Hi Krzysztof,
On 10/06/16 11:11, Krzysztof Kozlowski wrote:
> Split out subsystem specific changes for easier reviews. This will be
> squashed with main commit.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> ---
> arch/arm64/mm/dma-mapping.c | 57 +++++++++++++++++++++++----------------------
> 1 file changed, 29 insertions(+), 28 deletions(-)
>
> diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
> index 0ef620a34c4e..a7686028dfeb 100644
> --- a/arch/arm64/mm/dma-mapping.c
> +++ b/arch/arm64/mm/dma-mapping.c
> @@ -29,7 +29,7 @@
>
> #include <asm/cacheflush.h>
>
> -static pgprot_t __get_dma_pgprot(const struct dma_attrs *attrs, pgprot_t prot,
> +static pgprot_t __get_dma_pgprot(unsigned long attrs, pgprot_t prot,
> bool coherent)
Is this series intended to replace the patches currently in -next adding
that "const"? (I was momentarily puzzled why this wouldn't apply locally)
> {
> if (!coherent || dma_get_attr(DMA_ATTR_WRITE_COMBINE, attrs))
> @@ -88,7 +88,7 @@ static int __free_from_pool(void *start, size_t size)
>
> static void *__dma_alloc_coherent(struct device *dev, size_t size,
> dma_addr_t *dma_handle, gfp_t flags,
> - const struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> if (dev == NULL) {
> WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
> @@ -118,7 +118,7 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size,
>
> static void __dma_free_coherent(struct device *dev, size_t size,
> void *vaddr, dma_addr_t dma_handle,
> - const struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> bool freed;
> phys_addr_t paddr = dma_to_phys(dev, dma_handle);
> @@ -137,7 +137,7 @@ static void __dma_free_coherent(struct device *dev, size_t size,
>
> static void *__dma_alloc(struct device *dev, size_t size,
> dma_addr_t *dma_handle, gfp_t flags,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> struct page *page;
> void *ptr, *coherent_ptr;
> @@ -185,7 +185,7 @@ no_mem:
>
> static void __dma_free(struct device *dev, size_t size,
> void *vaddr, dma_addr_t dma_handle,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> void *swiotlb_addr = phys_to_virt(dma_to_phys(dev, dma_handle));
>
> @@ -202,7 +202,7 @@ static void __dma_free(struct device *dev, size_t size,
> static dma_addr_t __swiotlb_map_page(struct device *dev, struct page *page,
> unsigned long offset, size_t size,
> enum dma_data_direction dir,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> dma_addr_t dev_addr;
>
> @@ -216,7 +216,7 @@ static dma_addr_t __swiotlb_map_page(struct device *dev, struct page *page,
>
> static void __swiotlb_unmap_page(struct device *dev, dma_addr_t dev_addr,
> size_t size, enum dma_data_direction dir,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> if (!is_device_dma_coherent(dev))
> __dma_unmap_area(phys_to_virt(dma_to_phys(dev, dev_addr)), size, dir);
> @@ -225,7 +225,7 @@ static void __swiotlb_unmap_page(struct device *dev, dma_addr_t dev_addr,
>
> static int __swiotlb_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
> int nelems, enum dma_data_direction dir,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> struct scatterlist *sg;
> int i, ret;
> @@ -242,7 +242,7 @@ static int __swiotlb_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
> static void __swiotlb_unmap_sg_attrs(struct device *dev,
> struct scatterlist *sgl, int nelems,
> enum dma_data_direction dir,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> struct scatterlist *sg;
> int i;
> @@ -303,7 +303,7 @@ static void __swiotlb_sync_sg_for_device(struct device *dev,
> static int __swiotlb_mmap(struct device *dev,
> struct vm_area_struct *vma,
> void *cpu_addr, dma_addr_t dma_addr, size_t size,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> int ret = -ENXIO;
> unsigned long nr_vma_pages = (vma->vm_end - vma->vm_start) >>
> @@ -330,7 +330,7 @@ static int __swiotlb_mmap(struct device *dev,
>
> static int __swiotlb_get_sgtable(struct device *dev, struct sg_table *sgt,
> void *cpu_addr, dma_addr_t handle, size_t size,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> int ret = sg_alloc_table(sgt, 1, GFP_KERNEL);
>
> @@ -425,21 +425,21 @@ out:
>
> static void *__dummy_alloc(struct device *dev, size_t size,
> dma_addr_t *dma_handle, gfp_t flags,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> return NULL;
> }
>
> static void __dummy_free(struct device *dev, size_t size,
> void *vaddr, dma_addr_t dma_handle,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> }
>
> static int __dummy_mmap(struct device *dev,
> struct vm_area_struct *vma,
> void *cpu_addr, dma_addr_t dma_addr, size_t size,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> return -ENXIO;
> }
> @@ -447,20 +447,20 @@ static int __dummy_mmap(struct device *dev,
> static dma_addr_t __dummy_map_page(struct device *dev, struct page *page,
> unsigned long offset, size_t size,
> enum dma_data_direction dir,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> return DMA_ERROR_CODE;
> }
>
> static void __dummy_unmap_page(struct device *dev, dma_addr_t dev_addr,
> size_t size, enum dma_data_direction dir,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> }
>
> static int __dummy_map_sg(struct device *dev, struct scatterlist *sgl,
> int nelems, enum dma_data_direction dir,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> return 0;
> }
> @@ -468,7 +468,7 @@ static int __dummy_map_sg(struct device *dev, struct scatterlist *sgl,
> static void __dummy_unmap_sg(struct device *dev,
> struct scatterlist *sgl, int nelems,
> enum dma_data_direction dir,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> }
>
> @@ -540,7 +540,7 @@ static void flush_page(struct device *dev, const void *virt, phys_addr_t phys)
>
> static void *__iommu_alloc_attrs(struct device *dev, size_t size,
> dma_addr_t *handle, gfp_t gfp,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> bool coherent = is_device_dma_coherent(dev);
> int ioprot = dma_direction_to_prot(DMA_BIDIRECTIONAL, coherent);
> @@ -600,7 +600,8 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size,
> }
>
> static void __iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,
> - dma_addr_t handle, struct dma_attrs *attrs)
> + dma_addr_t handle,
> + unsigned long attrs)
Nit: unnecessary line break?
Otherwise, though, I'm all for the idea;
Acked-by: Robin Murphy <robin.murphy@arm.com>
> {
> size_t iosize = size;
>
> @@ -616,7 +617,7 @@ static void __iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,
> * Hence how dodgy the below logic looks...
> */
> if (__in_atomic_pool(cpu_addr, size)) {
> - iommu_dma_unmap_page(dev, handle, iosize, 0, NULL);
> + iommu_dma_unmap_page(dev, handle, iosize, 0, 0);
> __free_from_pool(cpu_addr, size);
> } else if (is_vmalloc_addr(cpu_addr)){
> struct vm_struct *area = find_vm_area(cpu_addr);
> @@ -626,14 +627,14 @@ static void __iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,
> iommu_dma_free(dev, area->pages, iosize, &handle);
> dma_common_free_remap(cpu_addr, size, VM_USERMAP);
> } else {
> - iommu_dma_unmap_page(dev, handle, iosize, 0, NULL);
> + iommu_dma_unmap_page(dev, handle, iosize, 0, 0);
> __free_pages(virt_to_page(cpu_addr), get_order(size));
> }
> }
>
> static int __iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
> void *cpu_addr, dma_addr_t dma_addr, size_t size,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> struct vm_struct *area;
> int ret;
> @@ -653,7 +654,7 @@ static int __iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
>
> static int __iommu_get_sgtable(struct device *dev, struct sg_table *sgt,
> void *cpu_addr, dma_addr_t dma_addr,
> - size_t size, struct dma_attrs *attrs)
> + size_t size, unsigned long attrs)
> {
> unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
> struct vm_struct *area = find_vm_area(cpu_addr);
> @@ -694,7 +695,7 @@ static void __iommu_sync_single_for_device(struct device *dev,
> static dma_addr_t __iommu_map_page(struct device *dev, struct page *page,
> unsigned long offset, size_t size,
> enum dma_data_direction dir,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> bool coherent = is_device_dma_coherent(dev);
> int prot = dma_direction_to_prot(dir, coherent);
> @@ -709,7 +710,7 @@ static dma_addr_t __iommu_map_page(struct device *dev, struct page *page,
>
> static void __iommu_unmap_page(struct device *dev, dma_addr_t dev_addr,
> size_t size, enum dma_data_direction dir,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs))
> __iommu_sync_single_for_cpu(dev, dev_addr, size, dir);
> @@ -747,7 +748,7 @@ static void __iommu_sync_sg_for_device(struct device *dev,
>
> static int __iommu_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
> int nelems, enum dma_data_direction dir,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> bool coherent = is_device_dma_coherent(dev);
>
> @@ -761,7 +762,7 @@ static int __iommu_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
> static void __iommu_unmap_sg_attrs(struct device *dev,
> struct scatterlist *sgl, int nelems,
> enum dma_data_direction dir,
> - struct dma_attrs *attrs)
> + unsigned long attrs)
> {
> if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs))
> __iommu_sync_sg_for_cpu(dev, sgl, nelems, dir);
>
next prev parent reply other threads:[~2016-06-10 10:51 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-10 10:11 [PATCH v4 00/44] dma-mapping: Use unsigned long for dma_attrs Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 01/44] " Krzysztof Kozlowski
2016-06-10 14:49 ` Luis R. Rodriguez
2016-06-10 20:16 ` Krzysztof Kozlowski
2016-06-10 20:23 ` Luis R. Rodriguez
2016-06-10 20:44 ` Krzysztof Kozlowski
2016-06-10 21:08 ` Luis R. Rodriguez
2016-06-13 16:00 ` Christoph Hellwig
2016-06-13 17:41 ` Luis R. Rodriguez
2016-06-10 10:11 ` [PATCH v4 02/44] alpha: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 03/44] arc: " Krzysztof Kozlowski
2016-06-10 10:54 ` Vineet Gupta
2016-06-10 10:11 ` [PATCH v4 04/44] ARM: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 05/44] arm64: " Krzysztof Kozlowski
2016-06-10 10:51 ` Robin Murphy [this message]
2016-06-10 10:55 ` Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 06/44] avr32: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 07/44] blackfin: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 08/44] c6x: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 09/44] cris: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 10/44] frv: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 11/44] drm/exynos: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 12/44] drm/mediatek: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 13/44] drm/msm: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 14/44] drm/nouveau: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 15/44] drm/rockship: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 16/44] infiniband: " Krzysztof Kozlowski
2016-06-10 18:18 ` Bart Van Assche
2016-06-13 15:08 ` Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 17/44] iommu: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 18/44] [media] " Krzysztof Kozlowski
[not found] ` <575AB26E.4020401@st.com>
2016-06-10 12:37 ` Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 19/44] xen: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 20/44] swiotlb: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 21/44] powerpc: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 22/44] video: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 23/44] x86: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 24/44] iommu: intel: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 25/44] h8300: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 26/44] hexagon: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 27/44] ia64: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 28/44] m68k: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 29/44] metag: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 30/44] microblaze: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 31/44] mips: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 32/44] mn10300: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 33/44] nios2: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 34/44] openrisc: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 35/44] parisc: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 36/44] misc: mic: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 37/44] s390: " Krzysztof Kozlowski
2016-06-10 16:30 ` Gerald Schaefer
2016-06-10 10:11 ` [PATCH v4 38/44] sh: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 39/44] sparc: " Krzysztof Kozlowski
2016-06-10 17:43 ` David Miller
2016-06-10 20:03 ` Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 40/44] tile: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 41/44] unicore32: " Krzysztof Kozlowski
2016-06-10 10:11 ` [PATCH v4 42/44] xtensa: " Krzysztof Kozlowski
2016-06-10 10:12 ` [PATCH v4 44/44] dma-mapping: Document the DMA attributes next to the declaration Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=575A9BC4.3090603@arm.com \
--to=robin.murphy@arm.com \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=b.zolnierkie@samsung.com \
--cc=catalin.marinas@arm.com \
--cc=hch@infradead.org \
--cc=jroedel@suse.de \
--cc=jszhang@marvell.com \
--cc=k.kozlowski@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox