Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[PATCH] x86_64: GART DMA merging fix

Don't touch the non DMA members in the sg list in dma_map_sg in the IOMMU

Some drivers (in particular ST) ran into problems because they reused the sg
lists after passing them to pci_map_sg(). The merging procedure in the K8
GART IOMMU corrupted the state. This patch changes it to only touch the dma*
entries during merging, but not the other fields. Approach suggested by Dave
Miller.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Andi Kleen and committed by
Linus Torvalds
0d541064 a65d17c9

+2 -4
+2 -4
arch/x86_64/kernel/pci-gart.c
··· 310 310 311 311 for (i = 0; i < nents; i++) { 312 312 struct scatterlist *s = &sg[i]; 313 - if (!s->dma_length || !s->length) 313 + if (!s->dma_length) 314 314 break; 315 315 dma_unmap_single(dev, s->dma_address, s->dma_length, dir); 316 316 } ··· 364 364 365 365 BUG_ON(i > start && s->offset); 366 366 if (i == start) { 367 - *sout = *s; 368 367 sout->dma_address = iommu_bus_base; 369 368 sout->dma_address += iommu_page*PAGE_SIZE + s->offset; 370 369 sout->dma_length = s->length; ··· 378 379 SET_LEAK(iommu_page); 379 380 addr += PAGE_SIZE; 380 381 iommu_page++; 381 - } 382 + } 382 383 } 383 384 BUG_ON(iommu_page - iommu_start != pages); 384 385 return 0; ··· 390 391 { 391 392 if (!need) { 392 393 BUG_ON(stopat - start != 1); 393 - *sout = sg[start]; 394 394 sout->dma_length = sg[start].length; 395 395 return 0; 396 396 }