Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1205907
| From | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 19/31] arc: handle page-less SG entries |
| Date | 2015-08-12 12:30 +0200 |
| Message-ID | <pWBsd-1Ag-1@gated-at.bofh.it> (permalink) |
| References | <pWykF-5Aj-9@gated-at.bofh.it> <pWykF-5Aj-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wednesday 12 August 2015 12:39 PM, Christoph Hellwig wrote:
> Make all cache invalidation conditional on sg_has_page() and use
> sg_phys to get the physical address directly.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
With a minor nit below.
Acked-by: Vineet Gupta <vgupta@synopsys.com>
> ---
> arch/arc/include/asm/dma-mapping.h | 26 +++++++++++++++++++-------
> 1 file changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arc/include/asm/dma-mapping.h b/arch/arc/include/asm/dma-mapping.h
> index 2d28ba9..42eb526 100644
> --- a/arch/arc/include/asm/dma-mapping.h
> +++ b/arch/arc/include/asm/dma-mapping.h
> @@ -108,9 +108,13 @@ dma_map_sg(struct device *dev, struct scatterlist *sg,
> struct scatterlist *s;
> int i;
>
> - for_each_sg(sg, s, nents, i)
> - s->dma_address = dma_map_page(dev, sg_page(s), s->offset,
> - s->length, dir);
> + for_each_sg(sg, s, nents, i) {
> + if (sg_has_page(s)) {
> + _dma_cache_sync((unsigned long)sg_virt(s), s->length,
> + dir);
> + }
> + s->dma_address = sg_phys(s);
> + }
>
> return nents;
> }
> @@ -163,8 +167,12 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nelems,
> int i;
> struct scatterlist *sg;
>
> - for_each_sg(sglist, sg, nelems, i)
> - _dma_cache_sync((unsigned int)sg_virt(sg), sg->length, dir);
> + for_each_sg(sglist, sg, nelems, i) {
> + if (sg_has_page(sg)) {
> + _dma_cache_sync((unsigned int)sg_virt(sg), sg->length,
> + dir);
> + }
> + }
> }
>
> static inline void
> @@ -174,8 +182,12 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist,
> int i;
> struct scatterlist *sg;
>
> - for_each_sg(sglist, sg, nelems, i)
> - _dma_cache_sync((unsigned int)sg_virt(sg), sg->length, dir);
> + for_each_sg(sglist, sg, nelems, i) {
> + if (sg_has_page(sg)) {
> + _dma_cache_sync((unsigned int)sg_virt(sg), sg->length,
> + dir);
For consistency, could u please fix the left alignment of @dir above - another tab
perhaps ?
> + }
> + }
> }
>
> static inline int dma_supported(struct device *dev, u64 dma_mask)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 19/31] arc: handle page-less SG entries Christoph Hellwig <hch@lst.de> - 2015-08-12 09:10 +0200 Re: [PATCH 19/31] arc: handle page-less SG entries Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2015-08-12 12:30 +0200
csiph-web