diff options
author | Darrick J. Wong <djwong@us.ibm.com> | 2006-11-10 19:59:24 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-07-18 12:14:47 -0400 |
commit | ba330ffebb43c37cabc765c7cb0a80df01554657 (patch) | |
tree | d703cb707917d1ce5daf0224b3d10b51c8825415 /drivers/scsi/aic94xx/aic94xx_task.c | |
parent | 338ec57003ff9d7bc1471677e61872455977a5de (diff) |
[SCSI] aic94xx: Don't call pci_map_sg for already-mapped scatterlists
It turns out that libata has already dma_map_sg'd the scatterlist
entries that go with an ata_queued_cmd by the time it calls
sas_ata_qc_issue. sas_ata_qc_issue passes this scatterlist to aic94xx.
Unfortunately, aic94xx assumes that any scatterlist passed to it needs
to be pci_map_sg'd... which blows away the mapping that libata created!
This causes (on a x260) Calgary IOMMU table leaks and duplicate frees
when aic94xx and libata try to {pci,dma}_unmap_sg the scatterlist.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Key this check off ATA_PROTOCOL_STP
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/aic94xx/aic94xx_task.c')
-rw-r--r-- | drivers/scsi/aic94xx/aic94xx_task.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c index 9b65abec2f6e..6c12c0f19f39 100644 --- a/drivers/scsi/aic94xx/aic94xx_task.c +++ b/drivers/scsi/aic94xx/aic94xx_task.c | |||
@@ -74,8 +74,13 @@ static inline int asd_map_scatterlist(struct sas_task *task, | |||
74 | return 0; | 74 | return 0; |
75 | } | 75 | } |
76 | 76 | ||
77 | num_sg = pci_map_sg(asd_ha->pcidev, task->scatter, task->num_scatter, | 77 | /* STP tasks come from libata which has already mapped |
78 | task->data_dir); | 78 | * the SG list */ |
79 | if (task->task_proto == SAS_PROTOCOL_STP) | ||
80 | num_sg = task->num_scatter; | ||
81 | else | ||
82 | num_sg = pci_map_sg(asd_ha->pcidev, task->scatter, | ||
83 | task->num_scatter, task->data_dir); | ||
79 | if (num_sg == 0) | 84 | if (num_sg == 0) |
80 | return -ENOMEM; | 85 | return -ENOMEM; |
81 | 86 | ||
@@ -120,8 +125,9 @@ static inline int asd_map_scatterlist(struct sas_task *task, | |||
120 | 125 | ||
121 | return 0; | 126 | return 0; |
122 | err_unmap: | 127 | err_unmap: |
123 | pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter, | 128 | if (task->task_proto != SAS_PROTOCOL_STP) |
124 | task->data_dir); | 129 | pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter, |
130 | task->data_dir); | ||
125 | return res; | 131 | return res; |
126 | } | 132 | } |
127 | 133 | ||
@@ -142,8 +148,9 @@ static inline void asd_unmap_scatterlist(struct asd_ascb *ascb) | |||
142 | } | 148 | } |
143 | 149 | ||
144 | asd_free_coherent(asd_ha, ascb->sg_arr); | 150 | asd_free_coherent(asd_ha, ascb->sg_arr); |
145 | pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter, | 151 | if (task->task_proto != SAS_PROTOCOL_STP) |
146 | task->data_dir); | 152 | pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter, |
153 | task->data_dir); | ||
147 | } | 154 | } |
148 | 155 | ||
149 | /* ---------- Task complete tasklet ---------- */ | 156 | /* ---------- Task complete tasklet ---------- */ |