Commit 5336940d authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by Jens Axboe

x86: fix pci-gart failure handling

blk_rq_map_sg doesn't initialize sg->dma_address/length to zero
anymore. Some low level drivers reuse sg lists without initializing so
IOMMUs might get non-zero dma_address/length. If map_sg fails, we need
pass the number of the mapped entries to gart_unmap_sg.
Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 93354329
...@@ -435,7 +435,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, ...@@ -435,7 +435,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents,
error: error:
flush_gart(); flush_gart();
gart_unmap_sg(dev, sg, nents, dir); gart_unmap_sg(dev, sg, out, dir);
/* When it was forced or merged try again in a dumb way */ /* When it was forced or merged try again in a dumb way */
if (force_iommu || iommu_merge) { if (force_iommu || iommu_merge) {
out = dma_map_sg_nonforce(dev, sg, nents, dir); out = dma_map_sg_nonforce(dev, sg, nents, dir);
......
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