Re: [PATCH] Chaining sg lists for big IO commands v5

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jens Axboe
Date: Sunday, May 20, 2007 - 11:35 pm

On Mon, May 21 2007, Jens Axboe wrote:

If iommu=off works, can you try a normal boot but with this applied on
top of the sglist patches? That should fix gart mapping.

diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index 2e22a3a..b16384f 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -381,7 +381,7 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
 	int start;
 	unsigned long pages = 0;
 	int need = 0, nextneed;
-	struct scatterlist *s, *ps, *start_sg;
+	struct scatterlist *s, *ps, *start_sg, *sgmap;
 
 	if (nents == 0) 
 		return 0;
@@ -391,7 +391,7 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
 
 	out = 0;
 	start = 0;
-	start_sg = sg;
+	start_sg = sgmap = sg;
 	ps = NULL; /* shut up gcc */
 	for_each_sg(sg, s, nents, i) {
 		dma_addr_t addr = page_to_phys(s->page) + s->offset;
@@ -405,11 +405,12 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
 			/* Can only merge when the last chunk ends on a page 
 			   boundary and the new one doesn't have an offset. */
 			if (!iommu_merge || !nextneed || !need || s->offset ||
-			    (ps->offset + ps->length) % PAGE_SIZE) { 
-				if (dma_map_cont(start_sg, i - start, sg+out,
+			    (ps->offset + ps->length) % PAGE_SIZE) {
+				if (dma_map_cont(start_sg, i - start, sgmap,
 						  pages, need) < 0)
 					goto error;
 				out++;
+				sgmap = sg_next(sgmap);
 				pages = 0;
 				start = i;
 				start_sg = s;
@@ -420,7 +421,7 @@ int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
 		pages += to_pages(s->offset, s->length);
 		ps = s;
 	}
-	if (dma_map_cont(start_sg, i - start, sg+out, pages, need) < 0)
+	if (dma_map_cont(start_sg, i - start, sgmap, pages, need) < 0)
 		goto error;
 	out++;
 	flush_gart();

-- 
Jens Axboe

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Fri May 11, 6:51 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Tue May 15, 10:15 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Tue May 15, 10:20 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Tue May 15, 10:43 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Tue May 15, 10:50 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Tue May 15, 11:23 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Wed May 16, 1:58 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Wed May 16, 2:01 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Wed May 16, 11:27 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Thu May 17, 8:11 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Thu May 17, 8:15 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Fri May 18, 12:33 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Fri May 18, 12:35 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Fri May 18, 9:03 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Fri May 18, 10:03 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Fri May 18, 10:50 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Fri May 18, 10:51 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Sun May 20, 11:14 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Sun May 20, 11:35 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Benny Halevy, (Mon May 21, 12:14 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Tue May 22, 8:35 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Tue May 22, 3:15 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Thu May 24, 2:34 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, FUJITA Tomonori, (Thu May 24, 2:43 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Thu May 24, 3:00 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Thu May 24, 5:05 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Thu May 24, 5:05 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, FUJITA Tomonori, (Thu May 24, 5:44 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Thu May 24, 5:49 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Thu May 24, 8:25 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, James Bottomley, (Thu May 24, 8:39 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, FUJITA Tomonori, (Thu May 24, 9:01 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, James Bottomley, (Thu May 24, 9:08 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Thu May 24, 11:49 pm)