aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath/ipath_intr.c
diff options
context:
space:
mode:
authorJohn Gregor <john.gregor@qlogic.com>2007-09-05 04:57:14 -0400
committerRoland Dreier <rolandd@cisco.com>2008-01-25 17:15:27 -0500
commite342c119172f87f2d812bccfd0283f62e1bc1c2a (patch)
tree52eb0e75f5f894ab7f0f3c755f0876f18637e5a9 /drivers/infiniband/hw/ipath/ipath_intr.c
parent9ab4295d1d9ab10a249aea002060685f935a528c (diff)
IB/ipath: Fix sendctrl locking
Code review pointed out that the locking around uses of ipath_sendctrl and kr_sendctrl were, in several places, incorrect and/or inconsistent. Signed-off-by: John Gregor <john.gregor@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_intr.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_intr.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c
index ad41cccd2e9f..eac2e9c55281 100644
--- a/drivers/infiniband/hw/ipath/ipath_intr.c
+++ b/drivers/infiniband/hw/ipath/ipath_intr.c
@@ -795,6 +795,7 @@ void ipath_clear_freeze(struct ipath_devdata *dd)
795{ 795{
796 int i, im; 796 int i, im;
797 __le64 val; 797 __le64 val;
798 unsigned long flags;
798 799
799 /* disable error interrupts, to avoid confusion */ 800 /* disable error interrupts, to avoid confusion */
800 ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, 0ULL); 801 ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, 0ULL);
@@ -813,11 +814,14 @@ void ipath_clear_freeze(struct ipath_devdata *dd)
813 dd->ipath_control); 814 dd->ipath_control);
814 815
815 /* ensure pio avail updates continue */ 816 /* ensure pio avail updates continue */
817 spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags);
816 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, 818 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
817 dd->ipath_sendctrl & ~INFINIPATH_S_PIOBUFAVAILUPD); 819 dd->ipath_sendctrl & ~INFINIPATH_S_PIOBUFAVAILUPD);
818 ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); 820 ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
819 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, 821 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
820 dd->ipath_sendctrl); 822 dd->ipath_sendctrl);
823 ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
824 spin_unlock_irqrestore(&dd->ipath_sendctrl_lock, flags);
821 825
822 /* 826 /*
823 * We just enabled pioavailupdate, so dma copy is almost certainly 827 * We just enabled pioavailupdate, so dma copy is almost certainly
@@ -922,6 +926,7 @@ static noinline void ipath_bad_regread(struct ipath_devdata *dd)
922 926
923static void handle_layer_pioavail(struct ipath_devdata *dd) 927static void handle_layer_pioavail(struct ipath_devdata *dd)
924{ 928{
929 unsigned long flags;
925 int ret; 930 int ret;
926 931
927 ret = ipath_ib_piobufavail(dd->verbs_dev); 932 ret = ipath_ib_piobufavail(dd->verbs_dev);
@@ -930,9 +935,12 @@ static void handle_layer_pioavail(struct ipath_devdata *dd)
930 935
931 return; 936 return;
932set: 937set:
933 set_bit(IPATH_S_PIOINTBUFAVAIL, &dd->ipath_sendctrl); 938 spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags);
939 dd->ipath_sendctrl |= INFINIPATH_S_PIOINTBUFAVAIL;
934 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, 940 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
935 dd->ipath_sendctrl); 941 dd->ipath_sendctrl);
942 ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
943 spin_unlock_irqrestore(&dd->ipath_sendctrl_lock, flags);
936} 944}
937 945
938/* 946/*
@@ -1168,9 +1176,14 @@ irqreturn_t ipath_intr(int irq, void *data)
1168 handle_urcv(dd, istat); 1176 handle_urcv(dd, istat);
1169 1177
1170 if (istat & INFINIPATH_I_SPIOBUFAVAIL) { 1178 if (istat & INFINIPATH_I_SPIOBUFAVAIL) {
1171 clear_bit(IPATH_S_PIOINTBUFAVAIL, &dd->ipath_sendctrl); 1179 unsigned long flags;
1180
1181 spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags);
1182 dd->ipath_sendctrl &= ~INFINIPATH_S_PIOINTBUFAVAIL;
1172 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, 1183 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
1173 dd->ipath_sendctrl); 1184 dd->ipath_sendctrl);
1185 ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
1186 spin_unlock_irqrestore(&dd->ipath_sendctrl_lock, flags);
1174 1187
1175 handle_layer_pioavail(dd); 1188 handle_layer_pioavail(dd);
1176 } 1189 }