Skip to contentSkip to conversation

aic94xx: fix SMP request DMA direction

PATCH In review Jeff Garzik 3 participants 6 messages Sep 28, 2007 – Sep 30, 2007 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 aic94xx: fix SMP request DMA direction

Unless I'm missing something, the SMP request goes /to/ the PCI device :)

---
 drivers/scsi/aic94xx/aic94xx_task.c |    4 -
 2 files changed, 83 insertions(+), 17 deletions(-)
drivers/scsi/aic94xx/aic94xx_task.c +2 -2
index d5d8cab..ab13824 100644
@@ -451,7 +451,7 @@ static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task,
 	struct scb *scb;
 
 	pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_req, 1,
-		   PCI_DMA_FROMDEVICE);
+		   PCI_DMA_TODEVICE);
 	pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_resp, 1,
 		   PCI_DMA_FROMDEVICE);
 
@@ -486,7 +486,7 @@ static void asd_unbuild_smp_ascb(struct asd_ascb *a)
 
 	BUG_ON(!task);
 	pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_req, 1,
-		     PCI_DMA_FROMDEVICE);
+		     PCI_DMA_TODEVICE);
 	pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_resp, 1,
 		     PCI_DMA_FROMDEVICE);
 }
#1 lore raw
Quoted 4 lines · Jeff Garzik

Unless I'm missing something, the SMP request goes /to/ the PCI device :)

ACK; builds ok and SMP commands seem to work ok (not that they didn't before).

--Darrick

Quoted 30 lines
---
 drivers/scsi/aic94xx/aic94xx_task.c |    4 -
 2 files changed, 83 insertions(+), 17 deletions(-)
drivers/scsi/aic94xx/aic94xx_task.c +2 -3
index d5d8cab..ab13824 100644
@@ -451,7 +451,7 @@ static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task,
 	struct scb *scb;
 
 	pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_req, 1,
-		   PCI_DMA_FROMDEVICE);
+		   PCI_DMA_TODEVICE);
 	pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_resp, 1,
 		   PCI_DMA_FROMDEVICE);
 
@@ -486,7 +486,7 @@ static void asd_unbuild_smp_ascb(struct asd_ascb *a)
 
 	BUG_ON(!task);
 	pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_req, 1,
-		     PCI_DMA_FROMDEVICE);
+		     PCI_DMA_TODEVICE);
 	pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_resp, 1,
 		     PCI_DMA_FROMDEVICE);
 }
-

To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 8 lines · Darrick J. Wong
Quoted 4 lines · Jeff Garzik

Unless I'm missing something, the SMP request goes /to/ the PCI device :)

ACK; builds ok and SMP commands seem to work ok (not that they didn't before).

Could this explain some weirdness we were seeing with aic94xx and Calgary/CalIOC2 enabled, or are SMP commands not likely to be used in normal operation? We map the IOMMU entries differently for FROMDEVICE (RW) and TODEVICE(RO).

Cheers,
Muli

Signature · 4 lines
SYSTOR 2007 --- 1st Annual Haifa Systems and Storage Conference 2007
http://www.haifa.il.ibm.com/Workshops/systor2007/

Oct 29, 2007: virtualization workshop | Oct 30, 2007: storage workshop
#3 lore raw
Quoted 4 lines · Muli Ben-Yehuda
Quoted 3 lines · Darrick J. Wong
Quoted 2 lines · Jeff Garzik

Unless I'm missing something, the SMP request goes /to/ the PCI device :)

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

ACK; builds ok and SMP commands seem to work ok (not that they didn't before).

Could this explain some weirdness we were seeing with aic94xx and Calgary/CalIOC2 enabled, or are SMP commands not likely to be used in normal operation? We map the IOMMU entries differently for FROMDEVICE (RW) and TODEVICE(RO).

SMP == scsi management == not used during normal data transfer.

It could certainly explain flakiness if you have expanders, though

Jeff

#4 lore raw
Quoted 9 lines · Jeff Garzik
Quoted 8 lines · Muli Ben-Yehuda
Quoted 7 lines · Darrick J. Wong
Quoted 4 lines · Jeff Garzik

Unless I'm missing something, the SMP request goes /to/ the PCI device :)

ACK; builds ok and SMP commands seem to work ok (not that they didn't before).

Quoted 8 lines
Quoted 4 lines

Could this explain some weirdness we were seeing with aic94xx and Calgary/CalIOC2 enabled, or are SMP commands not likely to be used in normal operation? We map the IOMMU entries differently for FROMDEVICE (RW) and TODEVICE(RO).

SMP == scsi management == not used during normal data transfer.

It could certainly explain flakiness if you have expanders, though

Actually, SMP commands are used during device discovery to find things attached to expanders, so it seems likely that "it blows up almost immediately after loading the module" symptoms are a result of this bug.

That said, the bug that Jeff fixed resulted in extra permissions (+w) being set for the SMP request buffer, so that's probably why I've never seen any problems manifesting on x260/x3800 systems.

(Unless the CalIOC2 has a write only mode?)

--D

#5 lore raw
Quoted 10 lines · Darrick J. Wong

Actually, SMP commands are used during device discovery to find things attached to expanders, so it seems likely that "it blows up almost immediately after loading the module" symptoms are a result of this bug.

That said, the bug that Jeff fixed resulted in extra permissions (+w) being set for the SMP request buffer, so that's probably why I've never seen any problems manifesting on x260/x3800 systems.

(Unless the CalIOC2 has a write only mode?)

It does (you can turn on each of the R and W bits in the TCE entry seperately) but we don't make use of it - we set it to either none, RO or RW.

Cheers,
Muli