From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932741AbcFJKzU (ORCPT ); Fri, 10 Jun 2016 06:55:20 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:49147 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932245AbcFJKzO (ORCPT ); Fri, 10 Jun 2016 06:55:14 -0400 X-AuditID: cbfec7f5-f792a6d000001302-6e-575a9c8e64b7 Subject: Re: [PATCH v4 05/44] arm64: dma-mapping: Use unsigned long for dma_attrs To: Robin Murphy , Andrew Morton References: <1465553521-27303-1-git-send-email-k.kozlowski@samsung.com> <1465553521-27303-6-git-send-email-k.kozlowski@samsung.com> <575A9BC4.3090603@arm.com> Cc: Jisheng Zhang , Joerg Roedel , Arnd Bergmann , Bartlomiej Zolnierkiewicz , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, hch@infradead.org, "Suthikulpanit, Suravee" , linux-arm-kernel@lists.infradead.org, Marek Szyprowski From: Krzysztof Kozlowski Message-id: <575A9C8D.1060203@samsung.com> Date: Fri, 10 Jun 2016 12:55:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-version: 1.0 In-reply-to: <575A9BC4.3090603@arm.com> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRmVeSWpSXmKPExsVy+t/xK7p9c6LCDbraFS3mrF/DZvF30jF2 i40z1rNavF/Ww2hxesIiJovJp+YyWbw7vpvF4vULQ4tNj6+xWlzeNYfNYu2Ru+wWBz88YbWY +GMBo8XLjydYHPg8Wi/9ZfNYM28No8fvX5MYPTav0PI4MeM3i8fmJfUekxdeZPbo27IKKHy6 2uPzJrkArigum5TUnMyy1CJ9uwSujM0P+5gLWlwrZuxLbmBcb9DFyMEhIWAiMeN7ehcjJ5Ap JnHh3nq2LkYuDiGBpYwS66b0sEI4zxglJvzZxQbSICwQLHFxnxxIg4hAiMSjI+ehGhYxSjQs uQHWwCywjVni15QNbCBVbALGEpuXLwGzeQW0JF78m8IMYrMIqEoce9QMFhcViJCYtf0HE0SN oMSPyfdYQGxOAXWJc5NPgy1mFtCTuH9RCyTMLCAvsXnNW+YJjAKzkHTMQqiahaRqASPzKkbR 1NLkguKk9FwjveLE3OLSvHS95PzcTYyQiPq6g3HpMatDjAIcjEo8vBG7IsOFWBPLiitzDzFK cDArifD2TY8KF+JNSaysSi3Kjy8qzUktPsQozcGiJM47c9f7ECGB9MSS1OzU1ILUIpgsEwen VANjQ4JTUURd3fXI7KgW0wUzvi3weui1VtwgNdZudaVcY8Tuf7qRee+L8gOmTg1U19d9ZX/r pOsF+0nPeFPLpov3Gz16vebm2tkeCkZMc+53GXF/nShjLZlWuT5letKW3dUrA/Qui6lPcLnV 8OexbuiD70qGy91e1LbdNZNJvSFmZbdNPfnmdlUlluKMREMt5qLiRADQcS9qpAIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/10/2016 12:51 PM, Robin Murphy wrote: > 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 >> --- >> 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 >> >> -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) Yes, the series replace completely my previous const changes (applied by Andrew Morton). I rebased the patchset on linux-next so I could grab all recent changes around dma_attrs. Probably that should be changed before applying - choose one tree to base on (Andrew's?). If you would like to play with the entire series (on top of next): https://github.com/krzk/linux/tree/for-next/dma-attrs-const-v4 > >> { >> 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 Right, thanks! Best regards, Krzysztof