Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1205618 > unrolled thread
| Started by | Christoph Hellwig <hch@lst.de> |
|---|---|
| First post | 2015-08-12 09:10 +0200 |
| Last post | 2015-08-12 12:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[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
| From | Christoph Hellwig <hch@lst.de> |
|---|---|
| Date | 2015-08-12 09:10 +0200 |
| Subject | [PATCH 19/31] arc: handle page-less SG entries |
| Message-ID | <pWykF-5Aj-13@gated-at.bofh.it> |
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>
---
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);
+ }
+ }
}
static inline int dma_supported(struct device *dev, u64 dma_mask)
--
1.9.1
--
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/
[toc] | [next] | [standalone]
| From | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| Date | 2015-08-12 12:30 +0200 |
| Message-ID | <pWBsd-1Ag-1@gated-at.bofh.it> |
| In reply to | #1205618 |
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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web