aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorEric Moore <eric.moore@lsi.com>2009-04-21 17:37:57 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-04-27 11:53:53 -0400
commit03ea1115506c53b46cec2177deb189d186bb80dd (patch)
tree69218847c35e9b54487a67fa9524d4d9e52f263c /drivers/scsi
parentfd01825c70006638dee16f48c810c20c54f6cd15 (diff)
[SCSI] mpt2sas : the sanity check in base_interrupt needs to be on dword boundary
The poison sanity check on the reply_post_free register needs to be by 32bit, not 64bit. The poison check is there because its possible that the driver read the 1st 32bit before the 2nd 32bit has been written to by firmware. In other words, this handles race between driver reading the 64 bit register, and it being dma'd across pci memory from controller firmware as two 32bit pci writes. Signed-off-by: Eric Moore <eric.moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index a91f5143ceac..12ecffbf518f 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -636,6 +636,14 @@ _base_unmask_interrupts(struct MPT2SAS_ADAPTER *ioc)
636static irqreturn_t 636static irqreturn_t
637_base_interrupt(int irq, void *bus_id) 637_base_interrupt(int irq, void *bus_id)
638{ 638{
639 union reply_descriptor {
640 u64 word;
641 struct {
642 u32 low;
643 u32 high;
644 } u;
645 };
646 union reply_descriptor rd;
639 u32 post_index, post_index_next, completed_cmds; 647 u32 post_index, post_index_next, completed_cmds;
640 u8 request_desript_type; 648 u8 request_desript_type;
641 u16 smid; 649 u16 smid;
@@ -656,7 +664,8 @@ _base_interrupt(int irq, void *bus_id)
656 664
657 completed_cmds = 0; 665 completed_cmds = 0;
658 do { 666 do {
659 if (ioc->reply_post_free[post_index].Words == ~0ULL) 667 rd.word = ioc->reply_post_free[post_index].Words;
668 if (rd.u.low == UINT_MAX || rd.u.high == UINT_MAX)
660 goto out; 669 goto out;
661 reply = 0; 670 reply = 0;
662 cb_idx = 0xFF; 671 cb_idx = 0xFF;
@@ -721,7 +730,7 @@ _base_interrupt(int irq, void *bus_id)
721 for (i = 0 ; i < completed_cmds; i++) { 730 for (i = 0 ; i < completed_cmds; i++) {
722 post_index = post_index_next; 731 post_index = post_index_next;
723 /* poison the reply post descriptor */ 732 /* poison the reply post descriptor */
724 ioc->reply_post_free[post_index_next].Words = ~0ULL; 733 ioc->reply_post_free[post_index_next].Words = ULLONG_MAX;
725 post_index_next = (post_index == 734 post_index_next = (post_index ==
726 (ioc->reply_post_queue_depth - 1)) 735 (ioc->reply_post_queue_depth - 1))
727 ? 0 : post_index + 1; 736 ? 0 : post_index + 1;
@@ -3068,7 +3077,7 @@ _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
3068 3077
3069 /* initialize Reply Post Free Queue */ 3078 /* initialize Reply Post Free Queue */
3070 for (i = 0; i < ioc->reply_post_queue_depth; i++) 3079 for (i = 0; i < ioc->reply_post_queue_depth; i++)
3071 ioc->reply_post_free[i].Words = ~0ULL; 3080 ioc->reply_post_free[i].Words = ULLONG_MAX;
3072 3081
3073 r = _base_send_ioc_init(ioc, VF_ID, sleep_flag); 3082 r = _base_send_ioc_init(ioc, VF_ID, sleep_flag);
3074 if (r) 3083 if (r)