Commit 44193e9c authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] Fix critical issue in x86-64 IOMMU code

The K8 IOMMU code had some broken BUG_ON()s that hit with <4K aligned IO
through the IOMMU.

This patch fixes this. Without this database raw IO is often broken.
parent f194a1ee
...@@ -395,7 +395,7 @@ static int __pci_map_cont(struct scatterlist *sg, int start, int stopat, ...@@ -395,7 +395,7 @@ static int __pci_map_cont(struct scatterlist *sg, int start, int stopat,
for (i = start; i < stopat; i++) { for (i = start; i < stopat; i++) {
struct scatterlist *s = &sg[i]; struct scatterlist *s = &sg[i];
unsigned long start_addr = s->dma_address; unsigned long start_addr = s->dma_address;
BUG_ON(i > 0 && s->offset); BUG_ON(i > start && s->offset);
if (i == start) { if (i == start) {
*sout = *s; *sout = *s;
sout->dma_address = iommu_bus_base; sout->dma_address = iommu_bus_base;
...@@ -410,7 +410,6 @@ static int __pci_map_cont(struct scatterlist *sg, int start, int stopat, ...@@ -410,7 +410,6 @@ static int __pci_map_cont(struct scatterlist *sg, int start, int stopat,
addr += PAGE_SIZE; addr += PAGE_SIZE;
iommu_page++; iommu_page++;
} }
BUG_ON(i > 0 && addr % PAGE_SIZE);
} }
BUG_ON(iommu_page - iommu_start != pages); BUG_ON(iommu_page - iommu_start != pages);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment