x86-64: pci-gart iommu sg chaining zeroes wrong sg.
PATCH 1/1 x86-64: pci-gart iommu sg chaining zeroes wrong sg.
This patch is for Jens' block tree (sg chaining branch).
I don't have the hardware but this looks like a bug.
---
From: FUJITA Tomonori <[email protected]>
Subject: [PATCH] x86-64: pci-gart iommu sg chaining zeroes a wrong sg's dma_length
Needs to zero the end of the list.
--- arch/x86_64/kernel/pci-gart.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86_64/kernel/pci-gart.c +2 -1
@@ -425,9 +425,10 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)if (dma_map_cont (start_sg, i - start, sgmap, pages, need) <0 ) goto error; out++; + sgmap =sg_next (sgmap);flush_gart ();if (out < nents) - ps->dma_length =0 ; + sgmap->dma_length =0 ;return out; error:
Signature · 1 line
1.5.2.4
Quoted 20 lines · On Fri, 28 Sep 2007 01:38:27 +0900 FUJITA Tomonori <[email protected]> wrote:
This patch is for Jens' block tree (sg chaining branch).
I don't have the hardware but this looks like a bug.
---
From: FUJITA Tomonori <[email protected]>
Subject: [PATCH] x86-64: pci-gart iommu sg chaining zeroes a wrong sg'sdma_lengthNeeds to zero the end of the list.
Signed-off-by FUJITA Tomonori <[email protected]>--- arch/x86_64/kernel/pci-gart.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)arch/x86_64/kernel/pci-gart.c +0
-0
arch/x86_64/kernel/pci-gart.c int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) · line 432
Quoted 9 lines
arch/x86_64/kernel/pci-gart.c +2
-1@@ -425,9 +425,10 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)if (dma_map_cont (start_sg, i - start, sgmap, pages, need) <0 ) goto error; out++; + sgmap =sg_next (sgmap);flush_gart ();if (out < nents) - ps->dma_length =0 ; + sgmap->dma_length =0 ;return out;
Sorry, it should be:
arch/x86_64/kernel/pci-gart.c +4 -2
@@ -426,8 +426,10 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) goto error; out++;flush_gart (); -if (out < nents) - ps->dma_length =0 ; +if (out < nents) { + sgmap =sg_next (sgmap); + sgmap->dma_length =0 ; + }return out; error:
Quoted 41 lines · FUJITA Tomonori
Quoted 20 lines · On Fri, 28 Sep 2007 01:38:27 +0900 FUJITA Tomonori <[email protected]> wrote:
This patch is for Jens' block tree (sg chaining branch).
I don't have the hardware but this looks like a bug.
---
From: FUJITA Tomonori <[email protected]>
Subject: [PATCH] x86-64: pci-gart iommu sg chaining zeroes a wrong sg'sdma_lengthNeeds to zero the end of the list.
Signed-off-by FUJITA Tomonori <[email protected]>--- arch/x86_64/kernel/pci-gart.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)arch/x86_64/kernel/pci-gart.c +0
-0arch/x86_64/kernel/pci-gart.c int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) · line 432
Quoted 9 lines
arch/x86_64/kernel/pci-gart.c +2
-1@@ -425,9 +425,10 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)if (dma_map_cont (start_sg, i - start, sgmap, pages, need) <0 ) goto error; out++; + sgmap =sg_next (sgmap);flush_gart ();if (out < nents) - ps->dma_length =0 ; + sgmap->dma_length =0 ;return out;Sorry, it should be:
arch/x86_64/kernel/pci-gart.c +0
-0
arch/x86_64/kernel/pci-gart.c int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) · line 432
Quoted 9 lines
arch/x86_64/kernel/pci-gart.c +4
-2@@ -426,8 +426,10 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) goto error; out++;flush_gart (); -if (out < nents) - ps->dma_length =0 ; +if (out < nents) { + sgmap =sg_next (sgmap); + sgmap->dma_length =0 ; + }
looks correct to me.
ps points at the previous "scanned" sg entry while you want to zero out dma_length at the entry immediately following the last entry mapped (if (out < nents))
the original code before 62296749bd421904dace1e6b0fc3c4538aac7111 was:
- if (out < nents)
- sg[out].dma_length = 0;
Benny
Quoted 8 lines
arch/x86_64/kernel/pci-gart.c +0
-1return out; error: -To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html